@@ -872,6 +872,10 @@ function assertConfigEquals(config, widgetConfig) {
872872
873873
874874function testConfig ( ) {
875+ testStubs . set (
876+ firebaseui . auth . log ,
877+ 'warning' ,
878+ goog . testing . recordFunction ( ) ) ;
875879 createAndInstallTestInstances ( ) ;
876880 // Check configuration set correctly for each app.
877881 assertConfigEquals (
@@ -883,10 +887,55 @@ function testConfig() {
883887 assertConfigEquals (
884888 config3 ,
885889 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 ) ) ;
886931}
887932
888933
889934function testUpdateConfig ( ) {
935+ testStubs . set (
936+ firebaseui . auth . log ,
937+ 'warning' ,
938+ goog . testing . recordFunction ( ) ) ;
890939 createAndInstallTestInstances ( ) ;
891940 // Original config.
892941 var config = {
@@ -915,6 +964,34 @@ function testUpdateConfig() {
915964 assertConfigEquals (
916965 expectedConfig ,
917966 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 ( ) ) ;
918995}
919996
920997
@@ -1350,7 +1427,7 @@ function testStartSignInWithEmailAndPassword_success() {
13501427 assertObjectEquals ( expectedUserCredential , userCredential ) ;
13511428 asyncTestCase . signal ( ) ;
13521429 } ) ;
1353- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1430+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
13541431 [ 'user@example.com' , 'password' ] ,
13551432 function ( ) {
13561433 app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1380,7 +1457,7 @@ function testStartSignInWithEmailAndPassword_error() {
13801457 assertEquals ( expectedError , error ) ;
13811458 asyncTestCase . signal ( ) ;
13821459 } ) ;
1383- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1460+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
13841461 [ 'user@example.com' , 'password' ] ,
13851462 null ,
13861463 expectedError ) ;
@@ -1427,7 +1504,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_isAnonymous_success() {
14271504 } ) ;
14281505 // Simulate anonymous user logged in on external instance.
14291506 testAuth . setUser ( anonymousUser ) ;
1430- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1507+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
14311508 [ 'user@example.com' , 'password' ] ,
14321509 function ( ) {
14331510 app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1480,7 +1557,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_isAnon_error() {
14801557 asyncTestCase . signal ( ) ;
14811558 } ) ;
14821559 // Simulate wrong password error on sign-in.
1483- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1560+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
14841561 [ 'user@example.com' , 'password' ] ,
14851562 null ,
14861563 expectedError ) ;
@@ -1511,7 +1588,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_nonAnon_success() {
15111588 assertObjectEquals ( expectedUserCredential , userCredential ) ;
15121589 asyncTestCase . signal ( ) ;
15131590 } ) ;
1514- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1591+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
15151592 [ 'user@example.com' , 'password' ] ,
15161593 function ( ) {
15171594 app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1551,7 +1628,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnonymous_noUser_success() {
15511628 assertObjectEquals ( expectedUserCredential , userCredential ) ;
15521629 asyncTestCase . signal ( ) ;
15531630 } ) ;
1554- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
1631+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
15551632 [ 'user@example.com' , 'password' ] ,
15561633 function ( ) {
15571634 app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1587,7 +1664,7 @@ function testStartCreateUserWithEmailAndPassword_success() {
15871664 assertObjectEquals ( expectedUserCredential , userCredential ) ;
15881665 asyncTestCase . signal ( ) ;
15891666 } ) ;
1590- app . getAuth ( ) . assertCreateUserAndRetrieveDataWithEmailAndPassword (
1667+ app . getAuth ( ) . assertCreateUserWithEmailAndPassword (
15911668 [ 'user@example.com' , 'password' ] ,
15921669 function ( ) {
15931670 app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1617,7 +1694,7 @@ function testStartCreateUserWithEmailAndPassword_error() {
16171694 assertEquals ( expectedError , error ) ;
16181695 asyncTestCase . signal ( ) ;
16191696 } ) ;
1620- app . getAuth ( ) . assertCreateUserAndRetrieveDataWithEmailAndPassword (
1697+ app . getAuth ( ) . assertCreateUserWithEmailAndPassword (
16211698 [ 'user@example.com' , 'password' ] ,
16221699 null ,
16231700 expectedError ) ;
@@ -1694,7 +1771,7 @@ function testStartCreateUserWithEmailAndPassword__upgradeAnon_noUser_success() {
16941771 app . getExternalAuth ( ) . runAuthChangeHandler ( ) ;
16951772 // createUserWithEmailAndPassword called on internal Auth instance as no user
16961773 // available.
1697- app . getAuth ( ) . assertCreateUserAndRetrieveDataWithEmailAndPassword (
1774+ app . getAuth ( ) . assertCreateUserWithEmailAndPassword (
16981775 [ 'user@example.com' , 'password' ] ,
16991776 function ( ) {
17001777 app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -1780,7 +1857,7 @@ function testStartCreateUserWithEmailAndPassword_upgradeAnon_nonAnon_success() {
17801857 } ) ;
17811858 // Trigger initial onAuthStateChanged listener.
17821859 app . getExternalAuth ( ) . runAuthChangeHandler ( ) ;
1783- app . getAuth ( ) . assertCreateUserAndRetrieveDataWithEmailAndPassword (
1860+ app . getAuth ( ) . assertCreateUserWithEmailAndPassword (
17841861 [ 'user@example.com' , 'password' ] ,
17851862 function ( ) {
17861863 app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -3812,7 +3889,7 @@ function testSignInWithExistingEmailAndPasswordForLinking_success() {
38123889 assertObjectEquals ( expectedUserCredential , userCredential ) ;
38133890 asyncTestCase . signal ( ) ;
38143891 } ) ;
3815- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
3892+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
38163893 [ 'user@example.com' , 'password' ] ,
38173894 function ( ) {
38183895 app . getAuth ( ) . setUser ( expectedUser ) ;
@@ -3843,7 +3920,7 @@ function testSignInWithExistingEmailAndPasswordForLinking_error() {
38433920 assertEquals ( expectedError , error ) ;
38443921 asyncTestCase . signal ( ) ;
38453922 } ) ;
3846- app . getAuth ( ) . assertSignInAndRetrieveDataWithEmailAndPassword (
3923+ app . getAuth ( ) . assertSignInWithEmailAndPassword (
38473924 [ 'user@example.com' , 'password' ] ,
38483925 null ,
38493926 expectedError ) ;
0 commit comments