@@ -239,15 +239,16 @@ public void testDelayedAppStart() {
239239 }
240240
241241 @ Test
242- public void testStartFromBackground_within100ms () {
242+ public void testStartFromBackground_within50ms () {
243243 FakeScheduledExecutorService fakeExecutorService = new FakeScheduledExecutorService ();
244244 Timer fakeTimer = spy (new Timer (currentTime ));
245245 AppStartTrace trace =
246246 new AppStartTrace (transportManager , clock , configResolver , fakeExecutorService );
247247 trace .registerActivityLifecycleCallbacks (appContext );
248248 trace .setMainThreadRunnableTime (fakeTimer );
249249
250- when (fakeTimer .getDurationMicros ()).thenReturn (99L );
250+ // See AppStartTrace.MAX_BACKGROUND_RUNNABLE_DELAY.
251+ when (fakeTimer .getDurationMicros ()).thenReturn (TimeUnit .MILLISECONDS .toMicros (50 ) - 1 );
251252 trace .onActivityCreated (activity1 , bundle );
252253 Assert .assertNotNull (trace .getOnCreateTime ());
253254 ++currentTime ;
@@ -266,15 +267,16 @@ public void testStartFromBackground_within100ms() {
266267 }
267268
268269 @ Test
269- public void testStartFromBackground_moreThan100ms () {
270+ public void testStartFromBackground_moreThan50ms () {
270271 FakeScheduledExecutorService fakeExecutorService = new FakeScheduledExecutorService ();
271272 Timer fakeTimer = spy (new Timer (currentTime ));
272273 AppStartTrace trace =
273274 new AppStartTrace (transportManager , clock , configResolver , fakeExecutorService );
274275 trace .registerActivityLifecycleCallbacks (appContext );
275276 trace .setMainThreadRunnableTime (fakeTimer );
276277
277- when (fakeTimer .getDurationMicros ()).thenReturn (TimeUnit .MILLISECONDS .toMicros (100 ) + 1 );
278+ // See AppStartTrace.MAX_BACKGROUND_RUNNABLE_DELAY.
279+ when (fakeTimer .getDurationMicros ()).thenReturn (TimeUnit .MILLISECONDS .toMicros (50 ) + 1 );
278280 trace .onActivityCreated (activity1 , bundle );
279281 Assert .assertNull (trace .getOnCreateTime ());
280282 ++currentTime ;
0 commit comments