@@ -1014,17 +1014,18 @@ function testGetUid_userSignedIn() {
1014
1014
// Initialize App and Auth.
1015
1015
app1 = firebase . initializeApp ( config1 , appId1 ) ;
1016
1016
auth1 = app1 . auth ( ) ;
1017
+ var authInternal1 = app1 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
1017
1018
// Initially getUid() should return null;
1018
1019
assertNull ( auth1 . getUid ( ) ) ;
1019
- assertNull ( app1 . INTERNAL . getUid ( ) ) ;
1020
+ assertNull ( authInternal1 . getUid ( ) ) ;
1020
1021
// Listen to Auth changes.
1021
1022
var unsubscribe = auth1 . onIdTokenChanged ( function ( currentUser ) {
1022
1023
// Unsubscribe of Auth state change listener.
1023
1024
unsubscribe ( ) ;
1024
1025
// Logged in test user should be detected.
1025
1026
// Confirm getUid() returns expected UID.
1026
1027
assertEquals ( accountInfo1 [ 'uid' ] , auth1 . getUid ( ) ) ;
1027
- assertEquals ( accountInfo1 [ 'uid' ] , app1 . INTERNAL . getUid ( ) ) ;
1028
+ assertEquals ( accountInfo1 [ 'uid' ] , authInternal1 . getUid ( ) ) ;
1028
1029
goog . Timer . promise ( 10 ) . then ( function ( ) {
1029
1030
// Sign out.
1030
1031
return auth1 . signOut ( ) ;
@@ -1033,7 +1034,7 @@ function testGetUid_userSignedIn() {
1033
1034
} ) . then ( function ( ) {
1034
1035
// getUid() should return null.
1035
1036
assertNull ( auth1 . getUid ( ) ) ;
1036
- assertNull ( app1 . INTERNAL . getUid ( ) ) ;
1037
+ assertNull ( authInternal1 . getUid ( ) ) ;
1037
1038
asyncTestCase . signal ( ) ;
1038
1039
} ) ;
1039
1040
} ) ;
@@ -1065,19 +1066,20 @@ function testGetUid_noUserSignedIn() {
1065
1066
// Initialize App and Auth.
1066
1067
app1 = firebase . initializeApp ( config1 , appId1 ) ;
1067
1068
auth1 = app1 . auth ( ) ;
1069
+ var authInternal1 = app1 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
1068
1070
// Listen to Auth changes.
1069
1071
var unsubscribe = auth1 . onIdTokenChanged ( function ( currentUser ) {
1070
1072
// Unsubscribe of Auth state change listener.
1071
1073
unsubscribe ( ) ;
1072
1074
// Initially getUid() should return null;
1073
1075
assertNull ( auth1 . getUid ( ) ) ;
1074
- assertNull ( app1 . INTERNAL . getUid ( ) ) ;
1076
+ assertNull ( authInternal1 . getUid ( ) ) ;
1075
1077
// Sign in with email and password.
1076
1078
auth1 . signInWithEmailAndPassword ( '[email protected] ' , 'password' )
1077
1079
. then ( function ( userCredential ) {
1078
1080
// getUid() should return the test user UID.
1079
1081
assertEquals ( accountInfo1 [ 'uid' ] , auth1 . getUid ( ) ) ;
1080
- assertEquals ( accountInfo1 [ 'uid' ] , app1 . INTERNAL . getUid ( ) ) ;
1082
+ assertEquals ( accountInfo1 [ 'uid' ] , authInternal1 . getUid ( ) ) ;
1081
1083
asyncTestCase . signal ( ) ;
1082
1084
} ) ;
1083
1085
} ) ;
@@ -1118,11 +1120,13 @@ function testNotifyAuthListeners() {
1118
1120
config1 [ 'apiKey' ] + ':' + appId1 ) ;
1119
1121
currentUserStorageManager . setCurrentUser ( user ) . then ( function ( ) {
1120
1122
app1 = firebase . initializeApp ( config1 , appId1 ) ;
1121
- app1 . INTERNAL . addAuthTokenListener ( app1AuthTokenListener ) ;
1122
1123
auth1 = app1 . auth ( ) ;
1124
+ var authInternal1 = app1 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
1125
+ authInternal1 . addAuthTokenListener ( app1AuthTokenListener ) ;
1123
1126
app2 = firebase . initializeApp ( config2 , appId2 ) ;
1124
- app2 . INTERNAL . addAuthTokenListener ( app2AuthTokenListener ) ;
1125
1127
auth2 = app2 . auth ( ) ;
1128
+ var authInternal2 = app2 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
1129
+ authInternal2 . addAuthTokenListener ( app2AuthTokenListener ) ;
1126
1130
// Confirm all listeners reset.
1127
1131
assertEquals ( 0 , listener1 . getCallCount ( ) ) ;
1128
1132
assertEquals ( 0 , listener2 . getCallCount ( ) ) ;
@@ -1134,6 +1138,7 @@ function testNotifyAuthListeners() {
1134
1138
auth2 . addAuthTokenListener ( listener3 ) ;
1135
1139
// Wait for state to be ready on auth1.
1136
1140
var unsubscribe = auth1 . onIdTokenChanged ( function ( currentUser ) {
1141
+ console . log ( 'auth1 llllllll' , currentUser ) ;
1137
1142
unsubscribe ( ) ;
1138
1143
// Listener 1 and 2 triggered.
1139
1144
assertEquals ( 1 , listener1 . getCallCount ( ) ) ;
@@ -1170,7 +1175,7 @@ function testNotifyAuthListeners() {
1170
1175
app1AuthTokenListener . reset ( ) ;
1171
1176
listener2 . reset ( ) ;
1172
1177
auth1 . removeAuthTokenListener ( listener2 ) ;
1173
- app1 . INTERNAL . removeAuthTokenListener ( app1AuthTokenListener ) ;
1178
+ authInternal1 . removeAuthTokenListener ( app1AuthTokenListener ) ;
1174
1179
// Force token change.
1175
1180
currentAccessToken = 'accessToken3' ;
1176
1181
auth1 [ 'currentUser' ] . getIdToken ( ) . then ( function ( token ) {
@@ -1185,6 +1190,7 @@ function testNotifyAuthListeners() {
1185
1190
} ) ;
1186
1191
// Wait for state to be ready on auth2.
1187
1192
auth2 . onIdTokenChanged ( function ( currentUser ) {
1193
+ console . log ( 'auth222222' , currentUser ) ;
1188
1194
// auth2 listener triggered on init with null state once.
1189
1195
assertEquals ( 1 , listener3 . getCallCount ( ) ) ;
1190
1196
assertEquals (
@@ -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
+ var authInternal = app1 . container . getProvider ( 'auth-internal' ) . getImmediate ( ) ;
10209
+ authInternal . 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
+ authInternal . 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
+ authInternal . 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