Bug 1519538 - Disable idle-daily notifications in tests through user.js files. r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D19017

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Marco Bonardo 2019-02-08 14:10:08 +00:00
Родитель 7f392867b8
Коммит 65f6d086f4
8 изменённых файлов: 22 добавлений и 10 удалений

Просмотреть файл

@ -15,9 +15,8 @@ function* testSteps()
Services.perms.add(uri, "indexedDB", Ci.nsIPermissionManager.ALLOW_ACTION);
info("Setting idle preferences to prevent real 'idle-daily' notification");
Services.prefs.setIntPref("idle.lastDailyNotification", (Date.now() / 1000) - 10);
// The idle-daily notification is disabled in xpchsell tests, so we don't
// need to do anything special to disable it for this test.
info("Activating real idle service");

Просмотреть файл

@ -1879,7 +1879,6 @@ toolbar#nav-bar {
prefs = {
"browser.tabs.remote.autostart": options.e10s,
"dom.ipc.tabs.nested.enabled": options.nested_oop,
"idle.lastDailyNotification": int(time.time()),
# Enable tracing output for detailed failures in case of
# failing connection attempts, and hangs (bug 1397201)
"marionette.log.level": "Trace",

Просмотреть файл

@ -63,6 +63,9 @@ user_pref("extensions.update.url", "http://127.0.0.1/extensions-dummy/updateURL"
user_pref("extensions.webservice.discoverURL", "http://127.0.0.1/extensions-dummy/discoveryURL");
user_pref("identity.fxaccounts.auth.uri", "https://127.0.0.1/fxa-dummy/");
user_pref("identity.fxaccounts.migrateToDevEdition", false);
// Avoid idle-daily notifications, to avoid expensive operations that may
// cause unexpected test timeouts.
user_pref("idle.lastDailyNotification", -1);
// Make tests run consistently on DevEdition (which has a lightweight theme
// selected by default).
user_pref("lightweightThemes.selectedThemeID", "");

Просмотреть файл

@ -153,6 +153,9 @@ user_pref("gfx.logging.level", 1);
user_pref("identity.fxaccounts.auth.uri", "https://{server}/fxa-dummy/");
// Ditto for all the FxA content root URI.
user_pref("identity.fxaccounts.remote.root", "https://{server}/");
// Avoid idle-daily notifications, to avoid expensive operations that may
// cause unexpected test timeouts.
user_pref("idle.lastDailyNotification", -1);
user_pref("javascript.options.showInConsole", true);
user_pref("layout.accessiblecaret.enabled_on_touch", false);
// Make sure CSS error reporting is enabled for tests

Просмотреть файл

@ -16,3 +16,6 @@ user_pref("toolkit.telemetry.server", "https://%(server)s/telemetry-dummy");
// all processes would run at low priority, which is not desirable, so we
// disable the process priority manager entirely here.
user_pref("dom.ipc.processPriorityManager.enabled", false);
// Avoid idle-daily notifications, to avoid expensive operations that may
// cause unexpected test timeouts.
user_pref("idle.lastDailyNotification", -1);

Просмотреть файл

@ -142,11 +142,6 @@ def set_webserver(config):
@validator
def update_prefs(config):
config.setdefault('preferences', {}).update({
# Bug 1383896 - reduces noise in tests
'idle.lastDailyNotification': int(time.time()),
})
# update prefs from command line
prefs = config.pop('extraPrefs')
if prefs:

Просмотреть файл

@ -56,6 +56,7 @@ const PREFS_WHITELIST = [
"general.useragent.",
"gfx.",
"html5.",
"idle.",
"image.",
"javascript.",
"keyword.",

Просмотреть файл

@ -156,8 +156,17 @@ void nsIdleServiceDaily::Init() {
// get ready to send an idle-daily event. Otherwise set a timer targeted
// at 24 hours past the last idle-daily we sent.
int32_t nowSec = static_cast<int32_t>(PR_Now() / PR_USEC_PER_SEC);
int32_t lastDaily = Preferences::GetInt(PREF_LAST_DAILY, 0);
// Setting the pref to -1 allows to disable idle-daily, and it's particularly
// useful in tests. Normally there should be no need for the user to set
// this value.
if (lastDaily == -1) {
MOZ_LOG(sLog, LogLevel::Debug,
("nsIdleServiceDaily: Init: disabled idle-daily"));
return;
}
int32_t nowSec = static_cast<int32_t>(PR_Now() / PR_USEC_PER_SEC);
if (lastDaily < 0 || lastDaily > nowSec) {
// The time is bogus, use default.
lastDaily = 0;