зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1756057 - Move FOG init instrumentation test to xpcshell. r=janerik
This instrumentation test has been disabled since bug 1763474 because delaying init to this test meant that the preinit queue would overflow. Because GoogleTest runs all at once and in its own decided order, we shouldn't write any test that depends on FOG init happening at a specific time unless we make it happen before the test suite even runs. ...and if we do that, the test resets that we perform in between will obliterate the value in the init instrumentation, meaning we can't test it anyway. Note also that we skip-OK this test near local 4AM in case a properly-but- inconveniently-timed "metrics" ping clears the value between FOG init and the test run. Now I thought we could put this in mochi, but it turns out that we reuse browsers between test files. This means previous files' init of FOG and wiping of all data causes the test to permafail when not run in isolation. So here we are in xpcshell where we control init ourselves. Differential Revision: https://phabricator.services.mozilla.com/D147448
This commit is contained in:
Родитель
fa71140041
Коммит
41067177bd
|
@ -42,12 +42,6 @@ TEST(FOG, FogInitDoesntCrash)
|
|||
ASSERT_EQ(NS_OK, fog_test_reset(&empty, &empty));
|
||||
}
|
||||
|
||||
extern "C" void Rust_MeasureInitializeTime();
|
||||
// Disabled because this depends on the preinit buffer not overflowing,
|
||||
// which currently can't be guaranteed. See bug 1756057 for how to fix it.
|
||||
TEST(FOG, DISABLED_TestMeasureInitializeTime)
|
||||
{ Rust_MeasureInitializeTime(); }
|
||||
|
||||
TEST(FOG, BuiltinPingsRegistered)
|
||||
{
|
||||
Preferences::SetInt("telemetry.fog.test.localhost_port", -1);
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
|
||||
add_setup(
|
||||
/* on Android FOG is set up through head.js */
|
||||
{ skip_if: () => AppConstants.platform == "android" },
|
||||
function test_setup() {
|
||||
// FOG needs a profile directory to put its data in.
|
||||
do_get_profile();
|
||||
|
||||
// We need to initialize it once, otherwise operations will be stuck in the pre-init queue.
|
||||
Services.fog.initializeFOG();
|
||||
}
|
||||
);
|
||||
|
||||
add_task(function test_fog_init_works() {
|
||||
if (new Date().getHours() >= 3 && new Date().getHours() <= 4) {
|
||||
// We skip this test if it's too close to 4AM, when we might send a
|
||||
// "metrics" ping between init and this test being run.
|
||||
Assert.ok(true, "Too close to 'metrics' ping send window. Skipping test.");
|
||||
return;
|
||||
}
|
||||
Assert.greater(
|
||||
Glean.fog.initialization.testGetValue(),
|
||||
0,
|
||||
"FOG init happened, and its time was measured."
|
||||
);
|
||||
});
|
|
@ -3,6 +3,8 @@
|
|||
firefox-appdir = browser
|
||||
head = head.js
|
||||
|
||||
[test_FOGInit.js]
|
||||
|
||||
[test_FOGIPCLimit.js]
|
||||
|
||||
[test_FOGPrefs.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче