Bug 1320052 - Update external snapshot callers to not deal with subsessions. r=chutten
MozReview-Commit-ID: DGTer5oMnwd
--- a/dom/base/test/browser_use_counters.js
+++ b/dom/base/test/browser_use_counters.js
@@ -106,19 +106,19 @@ function waitForPageLoad(browser) {
});
}
function grabHistogramsFromContent(use_counter_middlefix, page_before = null) {
let telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
let gather = () => {
let snapshots;
if (Services.appinfo.browserTabsRemoteAutostart) {
- snapshots = telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false, false).content;
+ snapshots = telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false).content;
} else {
- snapshots = telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false, false).parent;
+ snapshots = telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false).parent;
}
let checkGet = (probe) => {
return snapshots[probe] ? snapshots[probe].sum : 0;
};
return [
checkGet("USE_COUNTER2_" + use_counter_middlefix + "_PAGE"),
checkGet("USE_COUNTER2_" + use_counter_middlefix + "_DOCUMENT"),
checkGet("CONTENT_DOCUMENTS_DESTROYED"),
--- a/toolkit/components/extensions/test/xpcshell/head_telemetry.js
+++ b/toolkit/components/extensions/test/xpcshell/head_telemetry.js
@@ -10,30 +10,27 @@ ChromeUtils.defineModuleGetter(this, "Co
const IS_OOP = Services.prefs.getBoolPref("extensions.webextensions.remote");
function arraySum(arr) {
return arr.reduce((a, b) => a + b, 0);
}
function clearHistograms() {
Services.telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN,
- true /* subsession */,
true /* clear */);
}
function getSnapshots(process) {
return Services.telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN,
- true /* subsession */,
false /* clear */)[process];
}
// TODO Bug 1357509: There is no good way to make sure that the parent received
// the histogram entries from the extension and content processes. Let's stick
// to the ugly, spinning the event loop until we have a good approach.
function promiseTelemetryRecorded(id, process, expectedCount) {
let condition = () => {
let snapshot = Services.telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN,
- true /* subsession */,
false /* clear */)[process][id];
return snapshot && arraySum(snapshot.counts) >= expectedCount;
};
return ContentTaskUtils.waitForCondition(condition);
}
--- a/toolkit/components/osfile/tests/xpcshell/test_telemetry.js
+++ b/toolkit/components/osfile/tests/xpcshell/test_telemetry.js
@@ -23,45 +23,41 @@ function getCount(histogram) {
// Ensure that launching the OS.File worker adds data to the relevant
// histograms
add_task(async function test_startup() {
let LAUNCH = "OSFILE_WORKER_LAUNCH_MS";
let READY = "OSFILE_WORKER_READY_MS";
let before = Services.telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN,
- false,
false).parent;
// Launch the OS.File worker
await File.getCurrentDirectory();
let after = Services.telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN,
- false,
false).parent;
info("Ensuring that we have recorded measures for histograms");
Assert.equal(getCount(after[LAUNCH]), getCount(before[LAUNCH]) + 1);
Assert.equal(getCount(after[READY]), getCount(before[READY]) + 1);
info("Ensuring that launh <= ready");
Assert.ok(after[LAUNCH].sum <= after[READY].sum);
});
// Ensure that calling writeAtomic adds data to the relevant histograms
add_task(async function test_writeAtomic() {
let LABEL = "OSFILE_WRITEATOMIC_JANK_MS";
let before = Services.telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN,
- false,
false).parent;
// Perform a write.
let path = Path.join(Constants.Path.profileDir, "test_osfile_telemetry.tmp");
await File.writeAtomic(path, LABEL, { tmpPath: path + ".tmp" } );
let after = Services.telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN,
- false,
false).parent;
Assert.equal(getCount(after[LABEL]), getCount(before[LABEL]) + 1);
});
--- a/toolkit/components/terminator/tests/xpcshell/test_terminator_reload.js
+++ b/toolkit/components/terminator/tests/xpcshell/test_terminator_reload.js
@@ -25,17 +25,16 @@ add_task(async function init() {
do_get_profile();
PATH = Path.join(Constants.Path.localProfileDir, "ShutdownDuration.json");
});
add_task(async function test_reload() {
info("Forging data");
let data = {};
let telemetrySnapshots = Services.telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN,
- false /* subsession */,
false /* clear */).parent;
let i = 0;
for (let k of Object.keys(HISTOGRAMS)) {
let id = HISTOGRAMS[k];
data[k] = i++;
Assert.equal(telemetrySnapshots[id] || undefined, undefined, "Histogram " + id + " is empty");
}
@@ -58,17 +57,16 @@ add_task(async function test_reload() {
createInstance(Ci.nsIObserver);
tt.observe(null, "profile-after-change", "");
info("Waiting until telemetry is updated");
// Now wait until Telemetry is updated
await wait;
telemetrySnapshots = Services.telemetry.snapshotHistograms(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN,
- false /* subsession */,
false /* clear */).parent;
for (let k of Object.keys(HISTOGRAMS)) {
let id = HISTOGRAMS[k];
info("Testing histogram " + id);
let snapshot = telemetrySnapshots[id];
let count = 0;
for (let x of snapshot.counts) {
count += x;