зеркало из https://github.com/mozilla/gecko-dev.git
bug 1406391 - Remove toolkit.telemetry.enabled manipulation from tests r=Dexter
Minor note: reftests should've turned off uploadEnabled in the first place. MozReview-Commit-ID: 9spzuUAXwwP
This commit is contained in:
Родитель
be62507aa8
Коммит
8e6dd31d55
|
@ -3,7 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
add_task(async function test() {
|
||||
await SpecialPowers.pushPrefEnv({set: [["toolkit.telemetry.enabled", true]]});
|
||||
let engine = await promiseNewEngine("testEngine.xml");
|
||||
let histogramKey = "other-" + engine.name + ".contextmenu";
|
||||
let numSearchesBefore = 0;
|
||||
|
|
|
@ -76,7 +76,6 @@ function test() {
|
|||
|
||||
Services.obs.addObserver(observer, "browser-search-engine-modified");
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
["toolkit.telemetry.enabled", true],
|
||||
["browser.search.widget.inNavBar", true],
|
||||
]}).then(function() {
|
||||
Services.search.addEngine("http://mochi.test:8888/browser/browser/components/search/test/testEngine.xml",
|
||||
|
|
|
@ -153,7 +153,6 @@ add_task(async function setup() {
|
|||
};
|
||||
|
||||
const prefs = [
|
||||
"toolkit.telemetry.enabled",
|
||||
"browser.translation.detectLanguage",
|
||||
"browser.translation.ui.show"
|
||||
];
|
||||
|
|
|
@ -26,7 +26,6 @@ const PREF_LOGGING_LEVEL = "experiments.logging.level";
|
|||
const PREF_LOGGING_DUMP = "experiments.logging.dump";
|
||||
const PREF_MANIFEST_URI = "experiments.manifest.uri";
|
||||
const PREF_FETCHINTERVAL = "experiments.manifest.fetchIntervalSeconds";
|
||||
const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
|
||||
|
||||
function getExperimentPath(base) {
|
||||
let p = do_get_cwd();
|
||||
|
@ -193,6 +192,4 @@ function replaceExperiments(experiment, list) {
|
|||
});
|
||||
}
|
||||
|
||||
// Experiments require Telemetry to be enabled, and that's not true for debug
|
||||
// builds. Let's just enable it here instead of going through each test.
|
||||
Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, true);
|
||||
Services.telemetry.canRecordExtended = true;
|
||||
|
|
|
@ -10,19 +10,11 @@ add_test(function test_experiments_activation() {
|
|||
loadAddonManager();
|
||||
|
||||
Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
|
||||
Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, false);
|
||||
Services.telemetry.canRecordExtended = false;
|
||||
|
||||
let experiments = Experiments.instance();
|
||||
|
||||
Assert.ok(!experiments.enabled, "Experiments must be disabled if Telemetry is disabled.");
|
||||
|
||||
// Patch updateManifest to not do anything when the pref is switched back to true,
|
||||
// otherwise it attempts to connect to the server.
|
||||
experiments.updateManifest = () => Promise.resolve();
|
||||
|
||||
Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, true);
|
||||
|
||||
Assert.ok(experiments.enabled, "Experiments must be re-enabled if Telemetry is re-enabled");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
|
|
@ -25,7 +25,6 @@ add_task(async function setup() {
|
|||
|
||||
await SpecialPowers.pushPrefEnv({"set": [
|
||||
["dom.select_events.enabled", true], // We want select events to be fired.
|
||||
["toolkit.telemetry.enabled", true] // And Extended Telemetry to be enabled.
|
||||
]});
|
||||
|
||||
// Enable event recording for the events tested here.
|
||||
|
|
|
@ -27,9 +27,6 @@ add_task(async function setup() {
|
|||
let engineOneOff = Services.search.getEngineByName("MozSearch2");
|
||||
Services.search.moveEngine(engineOneOff, 0);
|
||||
|
||||
// Enable Extended Telemetry.
|
||||
await SpecialPowers.pushPrefEnv({"set": [["toolkit.telemetry.enabled", true]]});
|
||||
|
||||
// Enable event recording for the events tested here.
|
||||
Services.telemetry.setEventRecordingEnabled("navigation", true);
|
||||
|
||||
|
|
|
@ -90,9 +90,6 @@ add_task(async function setup() {
|
|||
let oldCanRecord = Services.telemetry.canRecordExtended;
|
||||
Services.telemetry.canRecordExtended = true;
|
||||
|
||||
// Enable Extended Telemetry.
|
||||
await SpecialPowers.pushPrefEnv({"set": [["toolkit.telemetry.enabled", true]]});
|
||||
|
||||
// Enable event recording for the events tested here.
|
||||
Services.telemetry.setEventRecordingEnabled("navigation", true);
|
||||
|
||||
|
|
|
@ -89,9 +89,6 @@ add_task(async function setup() {
|
|||
// Enable the urlbar one-off buttons.
|
||||
Services.prefs.setBoolPref(ONEOFF_URLBAR_PREF, true);
|
||||
|
||||
// Enable Extended Telemetry.
|
||||
await SpecialPowers.pushPrefEnv({"set": [["toolkit.telemetry.enabled", true]]});
|
||||
|
||||
// Enable local telemetry recording for the duration of the tests.
|
||||
let oldCanRecord = Services.telemetry.canRecordExtended;
|
||||
Services.telemetry.canRecordExtended = true;
|
||||
|
|
|
@ -26,7 +26,6 @@ add_task(async function test_memory_distribution() {
|
|||
return;
|
||||
}
|
||||
|
||||
await SpecialPowers.pushPrefEnv({set: [["toolkit.telemetry.enabled", true]]});
|
||||
Services.telemetry.canRecordExtended = true;
|
||||
|
||||
let histogram = Services.telemetry.getKeyedHistogramById("MEMORY_DISTRIBUTION_AMONG_CONTENT");
|
||||
|
|
|
@ -8,7 +8,6 @@ add_task(async function test_memory_distribution() {
|
|||
return;
|
||||
}
|
||||
|
||||
await SpecialPowers.pushPrefEnv({set: [["toolkit.telemetry.enabled", true]]});
|
||||
let canRecordExtended = Services.telemetry.canRecordExtended;
|
||||
Services.telemetry.canRecordExtended = true;
|
||||
registerCleanupFunction(() => Services.telemetry.canRecordExtended = canRecordExtended);
|
||||
|
|
|
@ -408,7 +408,6 @@ function SetupPrefTestEnvironment(which, additional_prefs) {
|
|||
settings.use_hsts],
|
||||
["security.mixed_content.send_hsts_priming",
|
||||
settings.send_hsts_priming],
|
||||
["toolkit.telemetry.enabled", true],
|
||||
];
|
||||
|
||||
if (additional_prefs) {
|
||||
|
|
|
@ -22,7 +22,7 @@ user_pref("javascript.options.strict", false);
|
|||
user_pref("javascript.options.werror", false);
|
||||
user_pref("toolkit.startup.max_resumed_crashes", -1);
|
||||
user_pref("security.turn_off_all_security_so_that_viruses_can_take_over_this_computer", true);
|
||||
user_pref("toolkit.telemetry.enabled", false);
|
||||
user_pref("datareporting.healthreport.uploadEnabled", false);
|
||||
user_pref("browser.safebrowsing.phishing.enabled", false);
|
||||
user_pref("browser.safebrowsing.malware.enabled", false);
|
||||
user_pref("browser.safebrowsing.blockedURIs.enabled", false);
|
||||
|
|
|
@ -87,6 +87,8 @@ user_pref("datareporting.policy.dataSubmissionPolicyBypassNotification", true);
|
|||
// server in the middle of the tests.
|
||||
user_pref("toolkit.telemetry.enabled", false);
|
||||
user_pref("toolkit.telemetry.unified", false);
|
||||
user_pref("datareporting.healthreport.uploadEnabled", false);
|
||||
user_pref("experiments.enabled", false);
|
||||
// Likewise for safebrowsing.
|
||||
user_pref("browser.safebrowsing.phishing.enabled", false);
|
||||
user_pref("browser.safebrowsing.malware.enabled", false);
|
||||
|
|
|
@ -403,8 +403,6 @@ class FirefoxProfile(Profile):
|
|||
'security.notification_enable_delay': 0,
|
||||
# Suppress automatic safe mode after crashes
|
||||
'toolkit.startup.max_resumed_crashes': -1,
|
||||
# Don't report telemetry information
|
||||
'toolkit.telemetry.enabled': False,
|
||||
# Don't send Telemetry reports to the production server. This is
|
||||
# needed as Telemetry sends pings also if FHR upload is enabled.
|
||||
'toolkit.telemetry.server': 'http://%(server)s/telemetry-dummy/',
|
||||
|
|
|
@ -17,12 +17,6 @@ const HISTOGRAM = "WEBEXT_CONTENT_SCRIPT_INJECTION_MS";
|
|||
|
||||
add_task(async function test_contentscript_telemetry() {
|
||||
// Turn on telemetry and reset it to the previous state once the test is completed.
|
||||
// NOTE: This is only needed on Android (which does not properly support unified telemetry,
|
||||
// while we're always recording opt-out telemetry on desktop).
|
||||
// Switching the "toolkit.telemetry.enabled" preference
|
||||
// (e.g. using SpecialPowers.pushPrefEnv) is unfortunately not enough,
|
||||
// because the TelemetryController has been already initialized when this
|
||||
// code is going to be executed.
|
||||
const telemetryCanRecordBase = SpecialPowers.Services.telemetry.canRecordBase;
|
||||
SpecialPowers.Services.telemetry.canRecordBase = true;
|
||||
SimpleTest.registerCleanupFunction(() => {
|
||||
|
|
|
@ -555,10 +555,14 @@ add_task(async function test_pref_observer() {
|
|||
|
||||
await TelemetrySend.setup(true);
|
||||
|
||||
const IS_UNIFIED_TELEMETRY = Services.prefs.getBoolPref(TelemetryUtils.Preferences.Unified, false);
|
||||
|
||||
let origTelemetryEnabled = Services.prefs.getBoolPref(TelemetryUtils.Preferences.TelemetryEnabled);
|
||||
let origFhrUploadEnabled = Services.prefs.getBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled);
|
||||
|
||||
Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
|
||||
if (!IS_UNIFIED_TELEMETRY) {
|
||||
Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true);
|
||||
}
|
||||
Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, true);
|
||||
|
||||
function waitAnnotateCrashReport(expectedValue, trigger) {
|
||||
|
@ -601,17 +605,13 @@ add_task(async function test_pref_observer() {
|
|||
});
|
||||
}
|
||||
|
||||
const IS_UNIFIED_TELEMETRY = Services.prefs.getBoolPref(TelemetryUtils.Preferences.Unified, false);
|
||||
|
||||
await waitAnnotateCrashReport(IS_UNIFIED_TELEMETRY, () => Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, false));
|
||||
|
||||
await waitAnnotateCrashReport(true, () => Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, true));
|
||||
|
||||
await waitAnnotateCrashReport(!IS_UNIFIED_TELEMETRY, () => Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, false));
|
||||
|
||||
await waitAnnotateCrashReport(true, () => Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, true));
|
||||
|
||||
Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, origTelemetryEnabled);
|
||||
if (!IS_UNIFIED_TELEMETRY) {
|
||||
Services.prefs.setBoolPref(TelemetryUtils.Preferences.TelemetryEnabled, origTelemetryEnabled);
|
||||
}
|
||||
Services.prefs.setBoolPref(TelemetryUtils.Preferences.FhrUploadEnabled, origFhrUploadEnabled);
|
||||
});
|
||||
|
||||
|
|
|
@ -82,7 +82,6 @@ add_task(async function initializeState() {
|
|||
|
||||
registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("experiments.enabled");
|
||||
Services.prefs.clearUserPref("toolkit.telemetry.enabled");
|
||||
if (gHttpServer) {
|
||||
gHttpServer.stop(() => {});
|
||||
if (gSavedManifestURI !== undefined) {
|
||||
|
@ -266,7 +265,7 @@ add_task(async function testActivateExperiment() {
|
|||
// We need to remove the cache file to help ensure consistent state.
|
||||
await OS.File.remove(gExperiments._cacheFilePath);
|
||||
|
||||
Services.prefs.setBoolPref("toolkit.telemetry.enabled", true);
|
||||
Services.telemetry.canRecordExtended = true;
|
||||
Services.prefs.setBoolPref("experiments.enabled", true);
|
||||
|
||||
info("Initializing experiments service.");
|
||||
|
@ -608,8 +607,6 @@ add_task(async function testCleanup() {
|
|||
await OS.File.remove(gExperiments._cacheFilePath);
|
||||
await gExperiments.uninit();
|
||||
await gExperiments.init();
|
||||
|
||||
Services.prefs.clearUserPref("toolkit.telemetry.enabled");
|
||||
}
|
||||
|
||||
// Check post-conditions.
|
||||
|
|
|
@ -33,7 +33,6 @@ const PREF_APP_UPDATE_URL_MANUAL = "app.update.url.manual";
|
|||
const PREFBRANCH_APP_PARTNER = "app.partner.";
|
||||
const PREF_DISTRIBUTION_ID = "distribution.id";
|
||||
const PREF_DISTRIBUTION_VERSION = "distribution.version";
|
||||
const PREF_TOOLKIT_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
|
||||
|
||||
const NS_APP_PROFILE_DIR_STARTUP = "ProfDS";
|
||||
const NS_APP_USER_PROFILE_50_DIR = "ProfD";
|
||||
|
|
|
@ -1037,8 +1037,6 @@ function setDefaultPrefs() {
|
|||
// Some apps set this preference to true by default
|
||||
Services.prefs.setBoolPref(PREF_APP_UPDATE_LOG, false);
|
||||
}
|
||||
// In case telemetry is enabled for xpcshell tests.
|
||||
Services.prefs.setBoolPref(PREF_TOOLKIT_TELEMETRY_ENABLED, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче