Bug 1456103 - Create tests for devtools.main.deactivate telemetry event r=yulia
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Thu, 26 Apr 2018 10:16:11 +0100
changeset 415861 029547eb5a875602cabe07deaca2fee28deec4dc
parent 415860 c9566c1573ab15809ab1b0482e543db443774d81
child 415862 bc5ab6e2db1039394ef16edc4333e08e8965da56
push id33911
push usercsabou@mozilla.com
push dateFri, 27 Apr 2018 10:01:39 +0000
treeherdermozilla-central@822936017145 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyulia
bugs1456103
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1456103 - Create tests for devtools.main.deactivate telemetry event r=yulia MozReview-Commit-ID: 5x6XHS11x1C
devtools/client/framework/test/browser_toolbox_telemetry_activate_splitconsole.js
devtools/client/responsive.html/test/browser/browser_telemetry_activate_rdm.js
--- 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