This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For #17969: add duration probes for App.onCreate and HomeActivity.onC…
…reate.
- Loading branch information
Showing
6 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
app/src/test/java/org/mozilla/fenix/FenixApplicationTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.fenix | ||
|
||
import androidx.test.core.app.ApplicationProvider | ||
import mozilla.components.service.glean.testing.GleanTestRule | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.mozilla.fenix.GleanMetrics.PerfStartup | ||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner | ||
|
||
@RunWith(FenixRobolectricTestRunner::class) | ||
class FenixApplicationTest { | ||
|
||
@get:Rule val gleanTestRule = GleanTestRule(ApplicationProvider.getApplicationContext()) | ||
|
||
private lateinit var application: FenixApplication | ||
|
||
@Before | ||
fun setUp() { | ||
application = ApplicationProvider.getApplicationContext() | ||
} | ||
|
||
@Test | ||
fun `GIVEN onCreate is called THEN the duration is measured`() { | ||
// application.onCreate is called before the test as part of test set up: | ||
// https://robolectric.blogspot.com/2013/04/the-test-lifecycle-in-20.html | ||
assertTrue(PerfStartup.applicationOnCreate.testHasValue()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters