27
27
import com .google .android .gms .tasks .TaskCompletionSource ;
28
28
import com .google .firebase .inject .Provider ;
29
29
import com .google .firebase .perf .FirebasePerformanceTestBase ;
30
+ import com .google .firebase .perf .provider .FirebasePerfProvider ;
30
31
import com .google .firebase .remoteconfig .FirebaseRemoteConfig ;
31
32
import com .google .firebase .remoteconfig .FirebaseRemoteConfigInfo ;
32
33
import com .google .firebase .remoteconfig .FirebaseRemoteConfigSettings ;
@@ -808,8 +809,10 @@ public void triggerRemoteConfigFetchIfNecessary_doesNotFetchBeforeAppStartRandom
808
809
appStartConfigFetchDelay ));
809
810
810
811
// Simulate time fast forward to some time before fetch time is up
812
+ long appStartTimeInMs =
813
+ TimeUnit .MICROSECONDS .toMillis (FirebasePerfProvider .getAppStartTime ().getMicros ());
811
814
when (remoteConfigManagerPartialMock .getCurrentSystemTimeMillis ())
812
- .thenReturn (System . currentTimeMillis () + appStartConfigFetchDelay - 2000 );
815
+ .thenReturn (appStartTimeInMs + appStartConfigFetchDelay - 2000 );
813
816
814
817
simulateFirebaseRemoteConfigLastFetchStatus (
815
818
FirebaseRemoteConfig .LAST_FETCH_STATUS_NO_FETCH_YET );
@@ -833,8 +836,10 @@ public void triggerRemoteConfigFetchIfNecessary_fetchesAfterAppStartRandomDelay(
833
836
appStartConfigFetchDelay ));
834
837
835
838
// Simulate time fast forward to 2s after fetch delay time is up
839
+ long appStartTimeInMs =
840
+ TimeUnit .MICROSECONDS .toMillis (FirebasePerfProvider .getAppStartTime ().getMicros ());
836
841
when (remoteConfigManagerPartialMock .getCurrentSystemTimeMillis ())
837
- .thenReturn (System . currentTimeMillis () + appStartConfigFetchDelay + 2000 );
842
+ .thenReturn (appStartTimeInMs + appStartConfigFetchDelay + 2000 );
838
843
839
844
simulateFirebaseRemoteConfigLastFetchStatus (
840
845
FirebaseRemoteConfig .LAST_FETCH_STATUS_NO_FETCH_YET );
0 commit comments