зеркало из https://github.com/mozilla/glean.git
Add test coverage
This commit is contained in:
Родитель
2765139486
Коммит
9868c777eb
|
@ -156,6 +156,29 @@ class GleanTest {
|
|||
assertEquals("value", storedData.extra?.getValue("test_key"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test experiments recording before Glean inits`() {
|
||||
// This test relies on Glean not being initialized and task queuing to be on.
|
||||
Glean.testDestroyGleanHandle()
|
||||
Dispatchers.API.setTaskQueueing(true)
|
||||
|
||||
Glean.setExperimentActive(
|
||||
"experiment_set_preinit", "branch_a"
|
||||
)
|
||||
|
||||
Glean.setExperimentActive(
|
||||
"experiment_preinit_disabled", "branch_a"
|
||||
)
|
||||
|
||||
Glean.setExperimentInactive("experiment_preinit_disabled")
|
||||
|
||||
// This will init glean and flush the dispatcher's queue.
|
||||
resetGlean()
|
||||
|
||||
assertTrue(Glean.testIsExperimentActive("experiment_set_preinit"))
|
||||
assertFalse(Glean.testIsExperimentActive("experiment_preinit_disabled"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test sending of background pings`() {
|
||||
val server = getMockWebServer()
|
||||
|
|
|
@ -105,6 +105,23 @@ def test_experiments_recording():
|
|||
assert "value" == stored_data.extra["test_key"]
|
||||
|
||||
|
||||
def test_experiments_recording_before_glean_inits():
|
||||
# This test relies on Glean not being initialized and task
|
||||
# queuing to be on.
|
||||
Glean.reset()
|
||||
|
||||
Glean.set_experiment_active("experiment_set_preinit", "branch_a")
|
||||
Glean.set_experiment_active("experiment_preinit_disabled", "branch_a")
|
||||
|
||||
Glean.set_experiment_inactive("experiment_preinit_disabled")
|
||||
|
||||
# This will init Glean and flush the dispatcher's queue.
|
||||
Glean.initialize(GLEAN_APP_ID, glean_version)
|
||||
|
||||
assert Glean.test_is_experiment_active("experiment_set_preinit")
|
||||
assert not Glean.test_is_experiment_active("experiment_preinit_disabled")
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
def test_sending_of_background_pings():
|
||||
pass
|
||||
|
|
Загрузка…
Ссылка в новой задаче