Bug 1456103 - Create tests for devtools.main.deactivate telemetry event r?yulia
MozReview-Commit-ID: 5x6XHS11x1C
--- a/devtools/client/framework/test/browser_toolbox_telemetry_activate_splitconsole.js
+++ b/devtools/client/framework/test/browser_toolbox_telemetry_activate_splitconsole.js
@@ -15,23 +15,43 @@ const DATA = [
value: null,
extra: {
host: "bottom",
width: "1300"
}
}, {
timestamp: null,
category: "devtools.main",
+ method: "deactivate",
+ object: "split_console",
+ value: null,
+ extra: {
+ host: "bottom",
+ width: "1300"
+ }
+ }, {
+ timestamp: null,
+ category: "devtools.main",
method: "activate",
object: "split_console",
value: null,
extra: {
host: "bottom",
width: "1300"
}
+ }, {
+ timestamp: null,
+ category: "devtools.main",
+ method: "deactivate",
+ object: "split_console",
+ value: null,
+ extra: {
+ host: "bottom",
+ width: "1300"
+ }
}
];
add_task(async function() {
// Let's reset the counts.
Services.telemetry.clearEvents();
// Ensure no events have been logged
@@ -48,18 +68,18 @@ add_task(async function() {
await toolbox.closeSplitConsole();
await checkResults();
});
async function checkResults() {
const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
const events = snapshot.parent.filter(event => event[1] === "devtools.main" &&
- event[2] === "activate" &&
- event[4] === null
+ (event[2] === "activate" ||
+ event[2] === "deactivate")
);
for (let i in DATA) {
const [ timestamp, category, method, object, value, extra ] = events[i];
const expected = DATA[i];
// ignore timestamp
ok(timestamp > 0, "timestamp is greater than 0");
--- a/devtools/client/responsive.html/test/browser/browser_telemetry_activate_rdm.js
+++ b/devtools/client/responsive.html/test/browser/browser_telemetry_activate_rdm.js
@@ -14,23 +14,43 @@ const DATA = [
value: null,
extra: {
host: "none",
width: "1300"
}
}, {
timestamp: null,
category: "devtools.main",
+ method: "deactivate",
+ object: "responsive_design",
+ value: null,
+ extra: {
+ host: "bottom",
+ width: "1300"
+ }
+ }, {
+ timestamp: null,
+ category: "devtools.main",
method: "activate",
object: "responsive_design",
value: null,
extra: {
host: "bottom",
width: "1300"
}
+ }, {
+ timestamp: null,
+ category: "devtools.main",
+ method: "deactivate",
+ object: "responsive_design",
+ value: null,
+ extra: {
+ host: "bottom",
+ width: "1300"
+ }
}
];
add_task(async function() {
// Let's reset the counts.
Services.telemetry.clearEvents();
// Ensure no events have been logged
@@ -60,18 +80,18 @@ async function openCloseRDM(tab) {
is(ui.destroyed, true, "RDM closed synchronously");
await clientClosed;
}
async function checkResults() {
const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
const events = snapshot.parent.filter(event => event[1] === "devtools.main" &&
- event[2] === "activate" &&
- event[4] === null
+ (event[2] === "activate" ||
+ event[2] === "deactivate")
);
for (let i in events) {
const [ timestamp, category, method, object, value, extra ] = events[i];
const expected = DATA[i];
// ignore timestamp