@@ -73,6 +73,8 @@ var appId1 = 'appId1';
73
73
var appId2 = 'appId2' ;
74
74
var auth1 = null ;
75
75
var auth2 = null ;
76
+ var authInternal1 = null ;
77
+ var authInternal2 = null ;
76
78
var app1 = null ;
77
79
var app2 = null ;
78
80
var authUi1 = null ;
@@ -1014,17 +1016,18 @@ function testGetUid_userSignedIn() {
1014
1016
// Initialize App and Auth.
1015
1017
app1 = firebase . initializeApp ( config1 , appId1 ) ;
1016
1018
auth1 = app1 . auth ( ) ;
1019
+ authInternal1 = app1 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
1017
1020
// Initially getUid() should return null;
1018
1021
assertNull ( auth1 . getUid ( ) ) ;
1019
- assertNull ( app1 . INTERNAL . getUid ( ) ) ;
1022
+ assertNull ( authInternal1 . getUid ( ) ) ;
1020
1023
// Listen to Auth changes.
1021
1024
var unsubscribe = auth1 . onIdTokenChanged ( function ( currentUser ) {
1022
1025
// Unsubscribe of Auth state change listener.
1023
1026
unsubscribe ( ) ;
1024
1027
// Logged in test user should be detected.
1025
1028
// Confirm getUid() returns expected UID.
1026
1029
assertEquals ( accountInfo1 [ 'uid' ] , auth1 . getUid ( ) ) ;
1027
- assertEquals ( accountInfo1 [ 'uid' ] , app1 . INTERNAL . getUid ( ) ) ;
1030
+ assertEquals ( accountInfo1 [ 'uid' ] , authInternal1 . getUid ( ) ) ;
1028
1031
goog . Timer . promise ( 10 ) . then ( function ( ) {
1029
1032
// Sign out.
1030
1033
return auth1 . signOut ( ) ;
@@ -1033,7 +1036,7 @@ function testGetUid_userSignedIn() {
1033
1036
} ) . then ( function ( ) {
1034
1037
// getUid() should return null.
1035
1038
assertNull ( auth1 . getUid ( ) ) ;
1036
- assertNull ( app1 . INTERNAL . getUid ( ) ) ;
1039
+ assertNull ( authInternal1 . getUid ( ) ) ;
1037
1040
asyncTestCase . signal ( ) ;
1038
1041
} ) ;
1039
1042
} ) ;
@@ -1065,19 +1068,20 @@ function testGetUid_noUserSignedIn() {
1065
1068
// Initialize App and Auth.
1066
1069
app1 = firebase . initializeApp ( config1 , appId1 ) ;
1067
1070
auth1 = app1 . auth ( ) ;
1071
+ authInternal1 = app1 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
1068
1072
// Listen to Auth changes.
1069
1073
var unsubscribe = auth1 . onIdTokenChanged ( function ( currentUser ) {
1070
1074
// Unsubscribe of Auth state change listener.
1071
1075
unsubscribe ( ) ;
1072
1076
// Initially getUid() should return null;
1073
1077
assertNull ( auth1 . getUid ( ) ) ;
1074
- assertNull ( app1 . INTERNAL . getUid ( ) ) ;
1078
+ assertNull ( authInternal1 . getUid ( ) ) ;
1075
1079
// Sign in with email and password.
1076
1080
auth1 . signInWithEmailAndPassword ( '[email protected] ' , 'password' )
1077
1081
. then ( function ( userCredential ) {
1078
1082
// getUid() should return the test user UID.
1079
1083
assertEquals ( accountInfo1 [ 'uid' ] , auth1 . getUid ( ) ) ;
1080
- assertEquals ( accountInfo1 [ 'uid' ] , app1 . INTERNAL . getUid ( ) ) ;
1084
+ assertEquals ( accountInfo1 [ 'uid' ] , authInternal1 . getUid ( ) ) ;
1081
1085
asyncTestCase . signal ( ) ;
1082
1086
} ) ;
1083
1087
} ) ;
@@ -1118,11 +1122,13 @@ function testNotifyAuthListeners() {
1118
1122
config1 [ 'apiKey' ] + ':' + appId1 ) ;
1119
1123
currentUserStorageManager . setCurrentUser ( user ) . then ( function ( ) {
1120
1124
app1 = firebase . initializeApp ( config1 , appId1 ) ;
1121
- app1 . INTERNAL . addAuthTokenListener ( app1AuthTokenListener ) ;
1122
1125
auth1 = app1 . auth ( ) ;
1126
+ authInternal1 = app1 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
1127
+ authInternal1 . addAuthTokenListener ( app1AuthTokenListener ) ;
1123
1128
app2 = firebase . initializeApp ( config2 , appId2 ) ;
1124
- app2 . INTERNAL . addAuthTokenListener ( app2AuthTokenListener ) ;
1125
1129
auth2 = app2 . auth ( ) ;
1130
+ authInternal2 = app2 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
1131
+ authInternal2 . addAuthTokenListener ( app2AuthTokenListener ) ;
1126
1132
// Confirm all listeners reset.
1127
1133
assertEquals ( 0 , listener1 . getCallCount ( ) ) ;
1128
1134
assertEquals ( 0 , listener2 . getCallCount ( ) ) ;
@@ -1170,7 +1176,7 @@ function testNotifyAuthListeners() {
1170
1176
app1AuthTokenListener . reset ( ) ;
1171
1177
listener2 . reset ( ) ;
1172
1178
auth1 . removeAuthTokenListener ( listener2 ) ;
1173
- app1 . INTERNAL . removeAuthTokenListener ( app1AuthTokenListener ) ;
1179
+ authInternal1 . removeAuthTokenListener ( app1AuthTokenListener ) ;
1174
1180
// Force token change.
1175
1181
currentAccessToken = 'accessToken3' ;
1176
1182
auth1 [ 'currentUser' ] . getIdToken ( ) . then ( function ( token ) {
@@ -10077,7 +10083,7 @@ function testAuth_proactiveTokenRefresh_multipleUsers() {
10077
10083
auth1 = app1 . auth ( ) ;
10078
10084
var subscriber = function ( token ) { } ;
10079
10085
// Simulate Firebase service added.
10080
- app1 . INTERNAL . addAuthTokenListener ( subscriber ) ;
10086
+ app1 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) . addAuthTokenListener ( subscriber ) ;
10081
10087
// Simulate user1 signed in.
10082
10088
auth1 . signInWithIdTokenResponse ( expectedTokenResponse ) . then ( function ( ) {
10083
10089
// Current user should be set to user1.
@@ -10155,7 +10161,7 @@ function testAuth_proactiveTokenRefresh_firebaseServiceAddedAfterSignIn() {
10155
10161
assertEquals (
10156
10162
0 , fireauth . AuthUser . prototype . startProactiveRefresh . getCallCount ( ) ) ;
10157
10163
// Simulate Firebase service added.
10158
- app1 . INTERNAL . addAuthTokenListener ( subscriber ) ;
10164
+ app1 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) . addAuthTokenListener ( subscriber ) ;
10159
10165
// Confirm proactive refresh started on that user.
10160
10166
assertEquals (
10161
10167
1 , fireauth . AuthUser . prototype . startProactiveRefresh . getCallCount ( ) ) ;
@@ -10199,10 +10205,11 @@ function testAuth_proactiveTokenRefresh_firebaseServiceRemovedAfterSignIn() {
10199
10205
auth1 = app1 . auth ( ) ;
10200
10206
var subscriber = function ( token ) { } ;
10201
10207
// Simulate Firebase service added.
10202
- app1 . INTERNAL . addAuthTokenListener ( subscriber ) ;
10208
+ authInternal1 = app1 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
10209
+ authInternal1 . addAuthTokenListener ( subscriber ) ;
10203
10210
// Add same listener again to check that removing it once will ensure the
10204
10211
// proactive refresh is stopped.
10205
- app1 . INTERNAL . addAuthTokenListener ( subscriber ) ;
10212
+ authInternal1 . addAuthTokenListener ( subscriber ) ;
10206
10213
// Simulate user signed in.
10207
10214
auth1 . signInWithIdTokenResponse ( expectedTokenResponse ) . then ( function ( ) {
10208
10215
// Current user should be set to user1.
@@ -10214,7 +10221,7 @@ function testAuth_proactiveTokenRefresh_firebaseServiceRemovedAfterSignIn() {
10214
10221
assertEquals (
10215
10222
0 , fireauth . AuthUser . prototype . stopProactiveRefresh . getCallCount ( ) ) ;
10216
10223
// Simulate Firebase service removed.
10217
- app1 . INTERNAL . removeAuthTokenListener ( subscriber ) ;
10224
+ authInternal1 . removeAuthTokenListener ( subscriber ) ;
10218
10225
// Confirm proactive refresh stopped on that user.
10219
10226
assertEquals (
10220
10227
1 , fireauth . AuthUser . prototype . stopProactiveRefresh . getCallCount ( ) ) ;
0 commit comments