@@ -872,6 +872,10 @@ function assertConfigEquals(config, widgetConfig) {
872
872
873
873
874
874
function testConfig ( ) {
875
+ testStubs . set (
876
+ firebaseui . auth . log ,
877
+ 'warning' ,
878
+ goog . testing . recordFunction ( ) ) ;
875
879
createAndInstallTestInstances ( ) ;
876
880
// Check configuration set correctly for each app.
877
881
assertConfigEquals (
@@ -883,10 +887,55 @@ function testConfig() {
883
887
assertConfigEquals (
884
888
config3 ,
885
889
app3 . getConfig ( ) ) ;
890
+ app1 . setConfig ( config1 ) ;
891
+ /** @suppress {missingRequire} */
892
+ assertEquals ( 0 , firebaseui . auth . log . warning . getCallCount ( ) ) ;
893
+ // Verifies that signInSuccess callback throws deprecation warning.
894
+ var callbacks = {
895
+ 'signInSuccess' : function ( currentUser , credential , redirectUrl ) {
896
+ return true ;
897
+ }
898
+ } ;
899
+ app1 . setConfig ( {
900
+ 'callbacks' : callbacks
901
+ } ) ;
902
+ assertConfigEquals (
903
+ {
904
+ 'signInSuccessUrl' : 'http://localhost/home1' ,
905
+ 'widgetUrl' : 'http://localhost/firebase1' ,
906
+ 'callbacks' : callbacks
907
+ } ,
908
+ app1 . getConfig ( ) ) ;
909
+ var deprecateWarning = 'signInSuccess callback is deprecated. Please use ' +
910
+ 'signInSuccessWithAuthResult callback instead.' ;
911
+ /** @suppress {missingRequire} */
912
+ assertEquals ( 1 , firebaseui . auth . log . warning . getCallCount ( ) ) ;
913
+ /** @suppress {missingRequire} */
914
+ assertEquals ( deprecateWarning ,
915
+ firebaseui . auth . log . warning . getLastCall ( ) . getArgument ( 0 ) ) ;
916
+ app1 . setConfig ( {
917
+ 'callbacks' : callbacks
918
+ } ) ;
919
+ // Deprecation warning should be only shown once.
920
+ /** @suppress {missingRequire} */
921
+ assertEquals ( 1 , firebaseui . auth . log . warning . getCallCount ( ) ) ;
922
+ // Verifies that warning is shown for new instance.
923
+ app2 . setConfig ( {
924
+ 'callbacks' : callbacks
925
+ } ) ;
926
+ /** @suppress {missingRequire} */
927
+ assertEquals ( 2 , firebaseui . auth . log . warning . getCallCount ( ) ) ;
928
+ /** @suppress {missingRequire} */
929
+ assertEquals ( deprecateWarning ,
930
+ firebaseui . auth . log . warning . getLastCall ( ) . getArgument ( 0 ) ) ;
886
931
}
887
932
888
933
889
934
function testUpdateConfig ( ) {
935
+ testStubs . set (
936
+ firebaseui . auth . log ,
937
+ 'warning' ,
938
+ goog . testing . recordFunction ( ) ) ;
890
939
createAndInstallTestInstances ( ) ;
891
940
// Original config.
892
941
var config = {
@@ -915,6 +964,34 @@ function testUpdateConfig() {
915
964
assertConfigEquals (
916
965
expectedConfig ,
917
966
app1 . getConfig ( ) ) ;
967
+ /** @suppress {missingRequire} */
968
+ assertEquals ( 0 , firebaseui . auth . log . warning . getCallCount ( ) ) ;
969
+ // Verifies that signInSuccess callback throws deprecation warning.
970
+ var callbacks = {
971
+ 'signInSuccess' : function ( currentUser , credential , redirectUrl ) {
972
+ return true ;
973
+ }
974
+ } ;
975
+ app1 . updateConfig ( 'callbacks' , callbacks ) ;
976
+ assertConfigEquals (
977
+ {
978
+ 'signInSuccessUrl' : 'http://localhost/home1' ,
979
+ 'widgetUrl' : 'http://localhost/firebase1' ,
980
+ 'siteName' : 'Other_Site_Name' ,
981
+ 'callbacks' : callbacks
982
+ } ,
983
+ app1 . getConfig ( ) ) ;
984
+ var deprecateWarning = 'signInSuccess callback is deprecated. Please use ' +
985
+ 'signInSuccessWithAuthResult callback instead.' ;
986
+ /** @suppress {missingRequire} */
987
+ assertEquals ( 1 , firebaseui . auth . log . warning . getCallCount ( ) ) ;
988
+ /** @suppress {missingRequire} */
989
+ assertEquals ( deprecateWarning ,
990
+ firebaseui . auth . log . warning . getLastCall ( ) . getArgument ( 0 ) ) ;
991
+ // Deprecation warning should be only shown once.
992
+ app1 . updateConfig ( 'callbacks' , callbacks ) ;
993
+ /** @suppress {missingRequire} */
994
+ assertEquals ( 1 , firebaseui . auth . log . warning . getCallCount ( ) ) ;
918
995
}
919
996
920
997
@@ -1350,7 +1427,7 @@ function testStartSignInWithEmailAndPassword_success() {
1350
1427
assertObjectEquals ( expectedUserCredential , userCredential ) ;
1351
1428
asyncTestCase . signal ( ) ;
1352
1429
} ) ;
1353
- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1430
+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
1354
1431
[ '[email protected] ' , 'password' ] ,
1355
1432
function ( ) {
1356
1433
app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1380,7 +1457,7 @@ function testStartSignInWithEmailAndPassword_error() {
1380
1457
assertEquals ( expectedError , error ) ;
1381
1458
asyncTestCase . signal ( ) ;
1382
1459
} ) ;
1383
- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1460
+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
1384
1461
[ '[email protected] ' , 'password' ] ,
1385
1462
null ,
1386
1463
expectedError ) ;
@@ -1427,7 +1504,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_isAnonymous_success() {
1427
1504
} ) ;
1428
1505
// Simulate anonymous user logged in on external instance.
1429
1506
testAuth . setUser ( anonymousUser ) ;
1430
- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1507
+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
1431
1508
[ '[email protected] ' , 'password' ] ,
1432
1509
function ( ) {
1433
1510
app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1480,7 +1557,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_isAnon_error() {
1480
1557
asyncTestCase . signal ( ) ;
1481
1558
} ) ;
1482
1559
// Simulate wrong password error on sign-in.
1483
- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1560
+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
1484
1561
[ '[email protected] ' , 'password' ] ,
1485
1562
null ,
1486
1563
expectedError ) ;
@@ -1511,7 +1588,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_nonAnon_success() {
1511
1588
assertObjectEquals ( expectedUserCredential , userCredential ) ;
1512
1589
asyncTestCase . signal ( ) ;
1513
1590
} ) ;
1514
- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1591
+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
1515
1592
[ '[email protected] ' , 'password' ] ,
1516
1593
function ( ) {
1517
1594
app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1551,7 +1628,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnonymous_noUser_success() {
1551
1628
assertObjectEquals ( expectedUserCredential , userCredential ) ;
1552
1629
asyncTestCase . signal ( ) ;
1553
1630
} ) ;
1554
- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1631
+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
1555
1632
[ '[email protected] ' , 'password' ] ,
1556
1633
function ( ) {
1557
1634
app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1587,7 +1664,7 @@ function testStartCreateUserWithEmailAndPassword_success() {
1587
1664
assertObjectEquals ( expectedUserCredential , userCredential ) ;
1588
1665
asyncTestCase . signal ( ) ;
1589
1666
} ) ;
1590
- app . getAuth ( ) . assertCreateUserAndRetrieveDataWithEmailAndPassword (
1667
+ app . getAuth ( ) . assertCreateUserWithEmailAndPassword (
1591
1668
[ '[email protected] ' , 'password' ] ,
1592
1669
function ( ) {
1593
1670
app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1617,7 +1694,7 @@ function testStartCreateUserWithEmailAndPassword_error() {
1617
1694
assertEquals ( expectedError , error ) ;
1618
1695
asyncTestCase . signal ( ) ;
1619
1696
} ) ;
1620
- app . getAuth ( ) . assertCreateUserAndRetrieveDataWithEmailAndPassword (
1697
+ app . getAuth ( ) . assertCreateUserWithEmailAndPassword (
1621
1698
[ '[email protected] ' , 'password' ] ,
1622
1699
null ,
1623
1700
expectedError ) ;
@@ -1694,7 +1771,7 @@ function testStartCreateUserWithEmailAndPassword__upgradeAnon_noUser_success() {
1694
1771
app . getExternalAuth ( ) . runAuthChangeHandler ( ) ;
1695
1772
// createUserWithEmailAndPassword called on internal Auth instance as no user
1696
1773
// available.
1697
- app . getAuth ( ) . assertCreateUserAndRetrieveDataWithEmailAndPassword (
1774
+ app . getAuth ( ) . assertCreateUserWithEmailAndPassword (
1698
1775
[ '[email protected] ' , 'password' ] ,
1699
1776
function ( ) {
1700
1777
app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1780,7 +1857,7 @@ function testStartCreateUserWithEmailAndPassword_upgradeAnon_nonAnon_success() {
1780
1857
} ) ;
1781
1858
// Trigger initial onAuthStateChanged listener.
1782
1859
app . getExternalAuth ( ) . runAuthChangeHandler ( ) ;
1783
- app . getAuth ( ) . assertCreateUserAndRetrieveDataWithEmailAndPassword (
1860
+ app . getAuth ( ) . assertCreateUserWithEmailAndPassword (
1784
1861
[ '[email protected] ' , 'password' ] ,
1785
1862
function ( ) {
1786
1863
app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -3812,7 +3889,7 @@ function testSignInWithExistingEmailAndPasswordForLinking_success() {
3812
3889
assertObjectEquals ( expectedUserCredential , userCredential ) ;
3813
3890
asyncTestCase . signal ( ) ;
3814
3891
} ) ;
3815
- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
3892
+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
3816
3893
[ '[email protected] ' , 'password' ] ,
3817
3894
function ( ) {
3818
3895
app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -3843,7 +3920,7 @@ function testSignInWithExistingEmailAndPasswordForLinking_error() {
3843
3920
assertEquals ( expectedError , error ) ;
3844
3921
asyncTestCase . signal ( ) ;
3845
3922
} ) ;
3846
- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
3923
+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
3847
3924
[ '[email protected] ' , 'password' ] ,
3848
3925
null ,
3849
3926
expectedError ) ;
0 commit comments