Bug 1098374 - Telemetry: Stop all monkey patching in devtools telemetry tests r=harth

This commit is contained in:
Michael Ratcliffe 2015-02-17 16:02:32 +00:00
parent 2e43ba9759
commit 38961c9394
30 changed files with 589 additions and 419 deletions

View File

@ -15,8 +15,6 @@ const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
const EventEmitter = require("devtools/toolkit/event-emitter");
const { CallWatcherFront } = require("devtools/server/actors/call-watcher");
const { CanvasFront } = require("devtools/server/actors/canvas");
const Telemetry = require("devtools/shared/telemetry");
const telemetry = new Telemetry();
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
@ -122,7 +120,6 @@ let EventsHandler = {
* Listen for events emitted by the current tab target.
*/
initialize: function() {
telemetry.toolOpened("canvasdebugger");
this._onTabNavigated = this._onTabNavigated.bind(this);
gTarget.on("will-navigate", this._onTabNavigated);
gTarget.on("navigate", this._onTabNavigated);
@ -132,7 +129,6 @@ let EventsHandler = {
* Remove events emitted by the current tab target.
*/
destroy: function() {
telemetry.toolClosed("canvasdebugger");
gTarget.off("will-navigate", this._onTabNavigated);
gTarget.off("navigate", this._onTabNavigated);
},

View File

@ -16,8 +16,6 @@ const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
const EventEmitter = require("devtools/toolkit/event-emitter");
const {Tooltip} = require("devtools/shared/widgets/Tooltip");
const Editor = require("devtools/sourceeditor/editor");
const Telemetry = require("devtools/shared/telemetry");
const telemetry = new Telemetry();
// The panel's window global is an EventEmitter firing the following events:
const EVENTS = {
@ -85,7 +83,6 @@ let EventsHandler = {
* Listen for events emitted by the current tab target.
*/
initialize: function() {
telemetry.toolOpened("shadereditor");
this._onHostChanged = this._onHostChanged.bind(this);
this._onTabNavigated = this._onTabNavigated.bind(this);
this._onProgramLinked = this._onProgramLinked.bind(this);
@ -101,7 +98,6 @@ let EventsHandler = {
* Remove events emitted by the current tab target.
*/
destroy: function() {
telemetry.toolClosed("shadereditor");
gToolbox.off("host-changed", this._onHostChanged);
gTarget.off("will-navigate", this._onTabNavigated);
gTarget.off("navigate", this._onTabNavigated);

View File

@ -19,17 +19,8 @@
* timerHistogram: "DEVTOOLS_MYTOOLNAME_TIME_ACTIVE_SECONDS"
* },
*
* 3. Include this module at the top of your tool. Use:
* let Telemetry = require("devtools/shared/telemetry")
*
* 4. Create a telemetry instance in your tool's constructor:
* this._telemetry = new Telemetry();
*
* 5. When your tool is opened call:
* this._telemetry.toolOpened("mytoolname");
*
* 6. When your tool is closed call:
* this._telemetry.toolClosed("mytoolname");
* 3. toolbox.js will automatically ping telemetry with your tools opening and
* timing information.
*
* Note:
* You can view telemetry stats for your local Firefox instance via
@ -303,6 +294,10 @@ Telemetry.prototype = {
}
},
clearToolsOpenedPref: function() {
Services.prefs.clearUserPref(TOOLS_OPENED_PREF);
},
destroy: function() {
for (let histogramId of this._timers.keys()) {
this.stopTimer(histogramId);

View File

@ -2,9 +2,7 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let tmp = {};
Cu.import("resource://gre/modules/devtools/Loader.jsm", tmp);
let ObservableObject = tmp.devtools.require("devtools/shared/observable-object");
let ObservableObject = devtools.require("devtools/shared/observable-object");
let rawObject = {};
let oe = new ObservableObject(rawObject);

View File

@ -4,7 +4,6 @@
// Tests that options-view OptionsView responds to events correctly.
const {OptionsView} = devtools.require("devtools/shared/options-view");
const {Services} = devtools.require("resource://gre/modules/Services.jsm");
const BRANCH = "devtools.debugger.";
const BLACK_BOX_PREF = "auto-black-box";

View File

@ -1,8 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
let {Loader} = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {});
let {OutputParser} = devtools.require("devtools/output-parser");
add_task(function*() {

View File

@ -8,50 +8,41 @@ let {EyedropperManager} = require("devtools/eyedropper/eyedropper");
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = yield gDevTools.showToolbox(target, "inspector");
info("inspector opened");
info("testing the eyedropper button");
testButton(toolbox, Telemetry);
testButton(toolbox);
stopRecordingTelemetryLogs(Telemetry);
yield gDevTools.closeToolbox(target);
gBrowser.removeCurrentTab();
});
function testButton(toolbox, Telemetry) {
function testButton(toolbox) {
let button = toolbox.doc.querySelector("#command-button-eyedropper");
ok(button, "Captain, we have the eyedropper button");
info("clicking the button to open the eyedropper");
button.click();
checkResults("_EYEDROPPER_", Telemetry);
checkResults();
}
function checkResults(histIdFocus, Telemetry) {
let result = Telemetry.prototype.telemetryInfo;
for (let [histId, value] of Iterator(result)) {
if (histId.startsWith("DEVTOOLS_INSPECTOR_") ||
!histId.contains(histIdFocus)) {
// Inspector stats are tested in
// browser_telemetry_toolboxtabs_{toolname}.js so we skip them here
// because we only open the inspector once for this test.
continue;
}
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
ok(value.length === 1 && value[0] === true,
"Per user value " + histId + " has a single value of true");
} else if (histId.endsWith("OPENED_BOOLEAN")) {
is(value.length, 1, histId + " has one entry");
let okay = value.every(element => element === true);
ok(okay, "All " + histId + " entries are === true");
}
}
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_EYEDROPPER_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_EYEDROPPER_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
}

View File

@ -10,28 +10,28 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = yield gDevTools.showToolbox(target, "inspector");
info("inspector opened");
info("testing the paintflashing button");
yield testButton(toolbox, Telemetry);
yield testButton(toolbox);
stopRecordingTelemetryLogs(Telemetry);
yield gDevTools.closeToolbox(target);
gBrowser.removeCurrentTab();
});
function* testButton(toolbox, Telemetry) {
function* testButton(toolbox) {
info("Testing command-button-paintflashing");
let button = toolbox.doc.querySelector("#command-button-paintflashing");
ok(button, "Captain, we have the button");
yield delayedClicks(button, 4);
checkResults("_PAINTFLASHING_", Telemetry);
checkResults();
}
function delayedClicks(node, clicks) {
@ -53,37 +53,19 @@ function delayedClicks(node, clicks) {
});
}
function checkResults(histIdFocus, Telemetry) {
let result = Telemetry.prototype.telemetryInfo;
for (let [histId, value] of Iterator(result)) {
if (histId.startsWith("DEVTOOLS_INSPECTOR_") ||
!histId.contains(histIdFocus)) {
// Inspector stats are tested in
// browser_telemetry_toolboxtabs_{toolname}.js so we skip them here
// because we only open the inspector once for this test.
continue;
}
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
ok(value.length === 1 && value[0] === true,
"Per user value " + histId + " has a single value of true");
} else if (histId.endsWith("OPENED_BOOLEAN")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element === true;
});
ok(okay, "All " + histId + " entries are === true");
} else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element > 0;
});
ok(okay, "All " + histId + " entries have time > 0");
}
}
function checkResults(histIdFocus) {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_PROTOCOLDESCRIPTION_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_PAINTFLASHING_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_PAINTFLASHING_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_PAINTFLASHING_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
}

View File

@ -10,28 +10,28 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = yield gDevTools.showToolbox(target, "inspector");
info("inspector opened");
info("testing the responsivedesign button");
yield testButton(toolbox, Telemetry);
yield testButton(toolbox);
stopRecordingTelemetryLogs(Telemetry);
yield gDevTools.closeToolbox(target);
gBrowser.removeCurrentTab();
});
function* testButton(toolbox, Telemetry) {
function* testButton(toolbox) {
info("Testing command-button-responsive");
let button = toolbox.doc.querySelector("#command-button-responsive");
ok(button, "Captain, we have the button");
yield delayedClicks(button, 4);
checkResults("_RESPONSIVE_", Telemetry);
checkResults();
}
function delayedClicks(node, clicks) {
@ -53,37 +53,19 @@ function delayedClicks(node, clicks) {
});
}
function checkResults(histIdFocus, Telemetry) {
let result = Telemetry.prototype.telemetryInfo;
for (let [histId, value] of Iterator(result)) {
if (histId.startsWith("DEVTOOLS_INSPECTOR_") ||
!histId.contains(histIdFocus)) {
// Inspector stats are tested in
// browser_telemetry_toolboxtabs_{toolname}.js so we skip them here
// because we only open the inspector once for this test.
continue;
}
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
ok(value.length === 1 && value[0] === true,
"Per user value " + histId + " has a single value of true");
} else if (histId.endsWith("OPENED_BOOLEAN")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element === true;
});
ok(okay, "All " + histId + " entries are === true");
} else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element > 0;
});
ok(okay, "All " + histId + " entries have time > 0");
}
}
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_PROTOCOLDESCRIPTION_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_RESPONSIVE_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_RESPONSIVE_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_RESPONSIVE_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
}

View File

@ -10,7 +10,8 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = yield gDevTools.showToolbox(target, "inspector");
@ -19,12 +20,11 @@ add_task(function*() {
let onAllWindowsOpened = trackScratchpadWindows();
info("testing the scratchpad button");
yield testButton(toolbox, Telemetry);
yield testButton(toolbox);
yield onAllWindowsOpened;
checkResults("_SCRATCHPAD_", Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
yield gDevTools.closeToolbox(target);
gBrowser.removeCurrentTab();
});
@ -64,7 +64,7 @@ function trackScratchpadWindows() {
});
}
function* testButton(toolbox, Telemetry) {
function* testButton(toolbox) {
info("Testing command-button-scratchpad");
let button = toolbox.doc.querySelector("#command-button-scratchpad");
ok(button, "Captain, we have the button");
@ -91,37 +91,18 @@ function delayedClicks(node, clicks) {
});
}
function checkResults(histIdFocus, Telemetry) {
let result = Telemetry.prototype.telemetryInfo;
for (let [histId, value] of Iterator(result)) {
if (histId.startsWith("DEVTOOLS_INSPECTOR_") ||
!histId.contains(histIdFocus)) {
// Inspector stats are tested in
// browser_telemetry_toolboxtabs_{toolname}.js so we skip them here
// because we only open the inspector once for this test.
continue;
}
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
ok(value.length === 1 && value[0] === true,
"Per user value " + histId + " has a single value of true");
} else if (histId.endsWith("OPENED_BOOLEAN")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element === true;
});
ok(okay, "All " + histId + " entries are === true");
} else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element > 0;
});
ok(okay, "All " + histId + " entries have time > 0");
}
}
function checkResults(histIdFocus) {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_PROTOCOLDESCRIPTION_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_SCRATCHPAD_OPENED_BOOLEAN", [0,4,0]);
checkTelemetry("DEVTOOLS_SCRATCHPAD_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
}

View File

@ -10,28 +10,28 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = yield gDevTools.showToolbox(target, "inspector");
info("inspector opened");
info("testing the tilt button");
yield testButton(toolbox, Telemetry);
yield testButton(toolbox);
stopRecordingTelemetryLogs(Telemetry);
yield gDevTools.closeToolbox(target);
gBrowser.removeCurrentTab();
});
function* testButton(toolbox, Telemetry) {
function* testButton(toolbox) {
info("Testing command-button-tilt");
let button = toolbox.doc.querySelector("#command-button-tilt");
ok(button, "Captain, we have the button");
yield delayedClicks(button, 4)
checkResults("_TILT_", Telemetry);
yield delayedClicks(button, 4);
checkResults();
}
function delayedClicks(node, clicks) {
@ -53,37 +53,19 @@ function delayedClicks(node, clicks) {
});
}
function checkResults(histIdFocus, Telemetry) {
let result = Telemetry.prototype.telemetryInfo;
for (let [histId, value] of Iterator(result)) {
if (histId.startsWith("DEVTOOLS_INSPECTOR_") ||
!histId.contains(histIdFocus)) {
// Inspector stats are tested in
// browser_telemetry_toolboxtabs_{toolname}.js so we skip them here
// because we only open the inspector once for this test.
continue;
}
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
ok(value.length === 1 && value[0] === true,
"Per user value " + histId + " has a single value of true");
} else if (histId.endsWith("OPENED_BOOLEAN")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element === true;
});
ok(okay, "All " + histId + " entries are === true");
} else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element > 0;
});
ok(okay, "All " + histId + " entries have time > 0");
}
}
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_PROTOCOLDESCRIPTION_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TILT_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TILT_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TILT_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
}

View File

@ -9,16 +9,16 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = yield gDevTools.showToolbox(target, "inspector");
info("inspector opened");
yield testSidebar(toolbox);
checkResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
yield gDevTools.closeToolbox(target);
gBrowser.removeCurrentTab();
});
@ -49,37 +49,29 @@ function* testSidebar(toolbox) {
});
}
function checkResults(Telemetry) {
let result = Telemetry.prototype.telemetryInfo;
for (let [histId, value] of Iterator(result)) {
if (histId.startsWith("DEVTOOLS_INSPECTOR_")) {
// Inspector stats are tested in browser_telemetry_toolboxtabs.js so we
// skip them here because we only open the inspector once for this test.
continue;
}
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
ok(value.length === 1 && value[0] === true,
"Per user value " + histId + " has a single value of true");
} else if (histId === "DEVTOOLS_TOOLBOX_OPENED_BOOLEAN") {
is(value.length, 1, histId + " has only one entry");
} else if (histId.endsWith("OPENED_BOOLEAN")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element === true;
});
ok(okay, "All " + histId + " entries are === true");
} else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element > 0;
});
ok(okay, "All " + histId + " entries have time > 0");
}
}
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_ANIMATIONINSPECTOR_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_ANIMATIONINSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_ANIMATIONINSPECTOR_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_COMPUTEDVIEW_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_COMPUTEDVIEW_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_COMPUTEDVIEW_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_PROTOCOLDESCRIPTION_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_FONTINSPECTOR_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_FONTINSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_FONTINSPECTOR_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_LAYOUTVIEW_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_LAYOUTVIEW_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_LAYOUTVIEW_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,3,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
}

View File

@ -10,11 +10,28 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(3, TOOL_DELAY, "inspector");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,3,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,3,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,3,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -14,14 +14,28 @@ add_task(function*() {
Services.prefs.setBoolPref("devtools.canvasdebugger.enabled", true);
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "canvasdebugger");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
info("De-activate the canvasdebugger");
Services.prefs.setBoolPref("devtools.canvasdebugger.enabled", originalPref);
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_CANVASDEBUGGER_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_CANVASDEBUGGER_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_CANVASDEBUGGER_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -10,11 +10,28 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "inspector");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_INSPECTOR_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_RULEVIEW_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -10,11 +10,29 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "jsdebugger");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETHREAD_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RESUME_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_SOURCES_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_THREADDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_JSDEBUGGER_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_JSDEBUGGER_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_JSDEBUGGER_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -9,11 +9,25 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "jsprofiler");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_JSPROFILER_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_JSPROFILER_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_JSPROFILER_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -9,12 +9,25 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "netmonitor");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_NETMONITOR_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_NETMONITOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_NETMONITOR_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -9,11 +9,25 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "options");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_OPTIONS_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_OPTIONS_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_OPTIONS_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -20,14 +20,28 @@ add_task(function*() {
Services.prefs.setBoolPref("devtools.shadereditor.enabled", true);
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "shadereditor");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
info("De-activate the sharer editor");
Services.prefs.setBoolPref("devtools.shadereditor.enabled", originalPref);
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_SHADEREDITOR_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_SHADEREDITOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_SHADEREDITOR_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -12,14 +12,28 @@ add_task(function*() {
Services.prefs.setBoolPref("devtools.storage.enabled", true);
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "storage");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
info("De-activating the storage inspector");
Services.prefs.clearUserPref("devtools.storage.enabled");
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_STORAGE_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_STORAGE_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_STORAGE_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -9,12 +9,25 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "styleeditor");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_STYLEEDITOR_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_STYLEEDITOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_STYLEEDITOR_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -13,14 +13,28 @@ add_task(function*() {
Services.prefs.setBoolPref("devtools.webaudioeditor.enabled", true);
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "webaudioeditor");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
info("De-activating the webaudioeditor");
Services.prefs.setBoolPref("devtools.webaudioeditor.enabled", originalPref);
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_WEBAUDIOEDITOR_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_WEBAUDIOEDITOR_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_WEBAUDIOEDITOR_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -9,11 +9,25 @@ const TOOL_DELAY = 200;
add_task(function*() {
yield promiseTab(TEST_URI);
let Telemetry = loadTelemetryAndRecordLogs();
startTelemetry();
yield openAndCloseToolbox(2, TOOL_DELAY, "webconsole");
checkTelemetryResults(Telemetry);
checkResults();
stopRecordingTelemetryLogs(Telemetry);
gBrowser.removeCurrentTab();
});
function checkResults() {
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_WEBCONSOLE_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_WEBCONSOLE_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_WEBCONSOLE_TIME_ACTIVE_SECONDS", null, "hasentries");
}

View File

@ -6,11 +6,15 @@ let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
let {TargetFactory, require} = devtools;
let {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {});
let {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
const {DOMHelpers} = Cu.import("resource:///modules/devtools/DOMHelpers.jsm", {});
const {Hosts} = require("devtools/framework/toolbox-hosts");
let oldCanRecord = Services.telemetry.canRecord;
gDevTools.testing = true;
SimpleTest.registerCleanupFunction(() => {
registerCleanupFunction(() => {
_stopTelemetry();
gDevTools.testing = false;
});
@ -150,75 +154,126 @@ let createHost = Task.async(function*(type = "bottom", src = "data:text/html;cha
return [host, iframe.contentWindow, iframe.contentDocument];
});
/**
* Load the Telemetry utils, then stub Telemetry.prototype.log in order to
* record everything that's logged in it.
* Store all recordings on Telemetry.telemetryInfo.
* @return {Telemetry}
*/
function loadTelemetryAndRecordLogs() {
info("Mock the Telemetry log function to record logged information");
function reportError(error) {
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: ");
let Telemetry = require("devtools/shared/telemetry");
Telemetry.prototype.telemetryInfo = {};
Telemetry.prototype._oldlog = Telemetry.prototype.log;
Telemetry.prototype.log = function(histogramId, value) {
if (!this.telemetryInfo) {
// Can be removed when Bug 992911 lands (see Bug 1011652 Comment 10)
return;
}
if (histogramId) {
if (!this.telemetryInfo[histogramId]) {
this.telemetryInfo[histogramId] = [];
}
ok(false, "ERROR: " + error + " at " + error.fileName + ":" +
error.lineNumber + "\n\nStack trace:" + stack);
this.telemetryInfo[histogramId].push(value);
}
};
if (finishUp) {
finishUp();
}
}
return Telemetry;
function startTelemetry() {
Services.telemetry.canRecord = true;
}
/**
* Stop recording the Telemetry logs and put back the utils as it was before.
* This method is automatically called on teardown.
*/
function stopRecordingTelemetryLogs(Telemetry) {
Telemetry.prototype.log = Telemetry.prototype._oldlog;
delete Telemetry.prototype._oldlog;
delete Telemetry.prototype.telemetryInfo;
}
function _stopTelemetry() {
let Telemetry = devtools.require("devtools/shared/telemetry");
let telemetry = new Telemetry();
/**
* Check the correctness of the data recorded in Telemetry after
* loadTelemetryAndRecordLogs was called.
*/
function checkTelemetryResults(Telemetry) {
let result = Telemetry.prototype.telemetryInfo;
telemetry.clearToolsOpenedPref();
for (let [histId, value] of Iterator(result)) {
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
ok(value.length === 1 && value[0] === true,
"Per user value " + histId + " has a single value of true");
} else if (histId.endsWith("OPENED_BOOLEAN")) {
ok(value.length > 1, histId + " has more than one entry");
Services.telemetry.canRecord = oldCanRecord;
let okay = value.every(function(element) {
return element === true;
});
ok(okay, "All " + histId + " entries are === true");
} else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element > 0;
});
ok(okay, "All " + histId + " entries have time > 0");
// Clean up telemetry histogram changes
for (let histId in Services.telemetry.histogramSnapshots) {
try {
let histogram = Services.telemetry.getHistogramById(histId);
histogram.clear();
} catch(e) {
// Histograms is not listed in histograms.json, do nothing.
}
}
}
/**
* Check the value of a given telemetry histogram.
*
* @param {String} histId
* Histogram id
* @param {Array|Number} expected
* Expected value
* @param {String} checkType
* "array" (default) - Check that an array matches the histogram data.
* "hasentries" - For non-enumerated linear and exponential
* histograms. This checks for at least one entry.
*/
function checkTelemetry(histId, expected, checkType="array") {
let actual = Services.telemetry.getHistogramById(histId).snapshot().counts;
switch (checkType) {
case "array":
is(JSON.stringify(actual), JSON.stringify(expected), histId + " correct.");
break;
case "hasentries":
let hasEntry = actual.some(num => num > 0);
ok(hasEntry, histId + " has at least one entry.");
break;
}
}
/**
* Generate telemetry tests. You should call generateTelemetryTests("DEVTOOLS_")
* from your result checking code in telemetry tests. It logs checkTelemetry
* calls for all changed telemetry values.
*
* @param {String} prefix
* Optionally limits results to histogram ids starting with prefix.
*/
function generateTelemetryTests(prefix="") {
dump("=".repeat(80) + "\n");
for (let histId in Services.telemetry.histogramSnapshots) {
if (!histId.startsWith(prefix)) {
continue;
}
let snapshot = Services.telemetry.histogramSnapshots[histId];
let actual = snapshot.counts;
switch (snapshot.histogram_type) {
case Services.telemetry.HISTOGRAM_EXPONENTIAL:
case Services.telemetry.HISTOGRAM_LINEAR:
let total = 0;
for (let val of actual) {
total += val;
}
if (histId.endsWith("_ENUMERATED")) {
if (total > 0) {
dump("checkTelemetry(\"" + histId + "\", " + JSON.stringify(actual) + ");\n");
}
continue;
}
dump("checkTelemetry(\"" + histId + "\", null, \"hasentries\");\n");
break;
case Services.telemetry.HISTOGRAM_BOOLEAN:
actual = JSON.stringify(actual);
if (actual !== "[0,0,0]") {
dump("checkTelemetry(\"" + histId + "\", " + actual + ");\n");
}
break;
case Services.telemetry.HISTOGRAM_FLAG:
actual = JSON.stringify(actual);
if (actual !== "[1,0,0]") {
dump("checkTelemetry(\"" + histId + "\", " + actual + ");\n");
}
break;
case Services.telemetry.HISTOGRAM_COUNT:
dump("checkTelemetry(\"" + histId + "\", " + actual + ");\n");
break;
}
}
dump("=".repeat(80) + "\n");
}
/**
* Open and close the toolbox in the current browser tab, several times, waiting
* some amount of time in between.
@ -230,7 +285,7 @@ function* openAndCloseToolbox(nbOfTimes, usageTime, toolId) {
for (let i = 0; i < nbOfTimes; i ++) {
info("Opening toolbox " + (i + 1));
let target = TargetFactory.forTab(gBrowser.selectedTab);
yield gDevTools.showToolbox(target, toolId)
yield gDevTools.showToolbox(target, toolId);
// We use a timeout to check the toolbox's active time
yield new Promise(resolve => setTimeout(resolve, usageTime));

View File

@ -21,8 +21,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "ViewHelpers",
XPCOMUtils.defineLazyModuleGetter(this, "VariablesView",
"resource:///modules/devtools/VariablesView.jsm");
let Telemetry = require("devtools/shared/telemetry");
/**
* Localization convenience methods.
*/
@ -87,9 +85,6 @@ this.StorageUI = function StorageUI(front, target, panelWin) {
this.handleKeypress = this.handleKeypress.bind(this);
this._panelDoc.addEventListener("keypress", this.handleKeypress);
this._telemetry = new Telemetry();
this._telemetry.toolOpened("storage");
}
exports.StorageUI = StorageUI;
@ -102,7 +97,6 @@ StorageUI.prototype = {
destroy: function() {
this.front.off("stores-update", this.onUpdate);
this._panelDoc.removeEventListener("keypress", this.handleKeypress);
this._telemetry.toolClosed("storage");
},
/**

View File

@ -42,7 +42,6 @@ let WebAudioEditorController = {
* Listen for events emitted by the current tab target.
*/
initialize: Task.async(function* () {
telemetry.toolOpened("webaudioeditor");
this._onTabNavigated = this._onTabNavigated.bind(this);
this._onThemeChange = this._onThemeChange.bind(this);
@ -69,7 +68,6 @@ let WebAudioEditorController = {
* Remove events emitted by the current tab target.
*/
destroy: function() {
telemetry.toolClosed("webaudioeditor");
gTarget.off("will-navigate", this._onTabNavigated);
gTarget.off("navigate", this._onTabNavigated);
gFront.off("start-context", this._onStartContext);

View File

@ -19,10 +19,9 @@ let { EventTarget } = require("sdk/event/target");
const { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
const { Class } = require("sdk/core/heritage");
const EventEmitter = require("devtools/toolkit/event-emitter");
const STRINGS_URI = "chrome://browser/locale/devtools/webaudioeditor.properties"
const STRINGS_URI = "chrome://browser/locale/devtools/webaudioeditor.properties";
const L10N = new ViewHelpers.L10N(STRINGS_URI);
const Telemetry = require("devtools/shared/telemetry");
const telemetry = new Telemetry();
devtools.lazyImporter(this, "LineGraphWidget",
"resource:///modules/devtools/Graphs.jsm");

View File

@ -14,6 +14,8 @@ const {require} = devtools;
const promise = require("promise");
const {AppProjects} = require("devtools/app-manager/app-projects");
let oldCanRecord = Services.telemetry.canRecord;
let TEST_BASE;
if (window.location === "chrome://browser/content/browser.xul") {
TEST_BASE = "chrome://mochitests/content/browser/browser/devtools/webide/test/";
@ -32,6 +34,8 @@ Services.prefs.setCharPref("devtools.webide.templatesURL", TEST_BASE + "template
SimpleTest.registerCleanupFunction(() => {
_stopTelemetry();
Services.prefs.clearUserPref("devtools.webide.enabled");
Services.prefs.clearUserPref("devtools.webide.enableLocalRuntime");
Services.prefs.clearUserPref("devtools.webide.autoinstallADBHelper");
@ -207,3 +211,112 @@ function handleError(aError) {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
finish();
}
function startTelemetry() {
Services.telemetry.canRecord = true;
}
/**
* This method is automatically called on teardown.
*/
function _stopTelemetry() {
let Telemetry = devtools.require("devtools/shared/telemetry");
let telemetry = new Telemetry();
telemetry.clearToolsOpenedPref();
Services.telemetry.canRecord = oldCanRecord;
// Clean up telemetry histogram changes
for (let histId in Services.telemetry.histogramSnapshots) {
try {
let histogram = Services.telemetry.getHistogramById(histId);
histogram.clear();
} catch(e) {
// Histograms is not listed in histograms.json, do nothing.
}
}
}
/**
* Check the value of a given telemetry histogram.
*
* @param {String} histId
* Histogram id
* @param {Array|Number} expected
* Expected value
* @param {String} checkType
* "array" (default) - Check that an array matches the histogram data.
* "hasentries" - For non-enumerated linear and exponential
* histograms. This checks for at least one entry.
*/
function checkTelemetry(histId, expected, checkType="array") {
let actual = Services.telemetry.getHistogramById(histId).snapshot().counts;
switch (checkType) {
case "array":
is(JSON.stringify(actual), JSON.stringify(expected), histId + " correct.");
break;
case "hasentries":
let hasEntry = actual.some(num => num > 0);
ok(hasEntry, histId + " has at least one entry.");
break;
}
}
/**
* Generate telemetry tests. You should call generateTelemetryTests("DEVTOOLS_")
* from your result checking code in telemetry tests. It logs checkTelemetry
* calls for all changed telemetry values.
*
* @param {String} prefix
* Optionally limits results to histogram ids starting with prefix.
*/
function generateTelemetryTests(prefix="") {
dump("=".repeat(80) + "\n");
for (let histId in Services.telemetry.histogramSnapshots) {
if (!histId.startsWith(prefix)) {
continue;
}
let snapshot = Services.telemetry.histogramSnapshots[histId];
let actual = snapshot.counts;
switch (snapshot.histogram_type) {
case Services.telemetry.HISTOGRAM_EXPONENTIAL:
case Services.telemetry.HISTOGRAM_LINEAR:
let total = 0;
for (let val of actual) {
total += val;
}
if (histId.endsWith("_ENUMERATED")) {
if (total > 0) {
dump("checkTelemetry(\"" + histId + "\", " + JSON.stringify(actual) + ");\n");
}
continue;
}
dump("checkTelemetry(\"" + histId + "\", null, \"hasentries\");\n");
break;
case Services.telemetry.HISTOGRAM_BOOLEAN:
actual = JSON.stringify(actual);
if (actual !== "[0,0,0]") {
dump("checkTelemetry(\"" + histId + "\", " + actual + ");\n");
}
break;
case Services.telemetry.HISTOGRAM_FLAG:
actual = JSON.stringify(actual);
if (actual !== "[1,0,0]") {
dump("checkTelemetry(\"" + histId + "\", " + actual + ");\n");
}
break;
case Services.telemetry.HISTOGRAM_COUNT:
dump("checkTelemetry(\"" + histId + "\", " + actual + ");\n");
break;
}
}
dump("=".repeat(80) + "\n");
}

View File

@ -15,7 +15,6 @@
<body>
<script type="application/javascript;version=1.8">
const Telemetry = require("devtools/shared/telemetry");
const { _DeprecatedUSBRuntime, _WiFiRuntime, _SimulatorRuntime,
_gRemoteRuntime, _gLocalRuntime, RuntimeTypes }
= require("devtools/webide/runtimes");
@ -24,25 +23,6 @@
// been opened we make use of setTimeout() to create tool active times.
const TOOL_DELAY = 200;
function patchTelemetry() {
Telemetry.prototype.telemetryInfo = {};
Telemetry.prototype._oldlog = Telemetry.prototype.log;
Telemetry.prototype.log = function(histogramId, value) {
if (histogramId) {
if (!this.telemetryInfo[histogramId]) {
this.telemetryInfo[histogramId] = [];
}
this.telemetryInfo[histogramId].push(value);
}
}
}
function resetTelemetry() {
Telemetry.prototype.log = Telemetry.prototype._oldlog;
delete Telemetry.prototype._oldlog;
delete Telemetry.prototype.telemetryInfo;
}
function cycleWebIDE() {
return Task.spawn(function*() {
let win = yield openWebIDE();
@ -149,58 +129,22 @@
}
function checkResults() {
let result = Telemetry.prototype.telemetryInfo;
for (let [histId, value] of Iterator(result)) {
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
ok(value.length === 1 && !!value[0],
"Per user value " + histId + " has a single value of true");
} else if (histId.endsWith("OPENED_BOOLEAN")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return !!element;
});
ok(okay, "All " + histId + " entries are true");
} else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
ok(value.length > 1, histId + " has more than one entry");
let okay = value.every(function(element) {
return element > 0;
});
ok(okay, "All " + histId + " entries have time > 0");
} else if (histId === "DEVTOOLS_WEBIDE_CONNECTION_RESULT") {
ok(value.length === 6, histId + " has 6 connection results");
let okay = value.every(function(element) {
return !!element;
});
ok(okay, "All " + histId + " connections succeeded");
} else if (histId.endsWith("CONNECTION_RESULT")) {
ok(value.length === 1 && !!value[0],
histId + " has 1 successful connection");
} else if (histId === "DEVTOOLS_WEBIDE_CONNECTION_TIME_SECONDS") {
ok(value.length === 6, histId + " has 6 connection results");
let okay = value.every(function(element) {
return element > 0;
});
ok(okay, "All " + histId + " connections have time > 0");
} else if (histId.endsWith("USED")) {
ok(value.length === 6, histId + " has 6 connection actions");
let okay = value.every(function(element) {
return !element;
});
ok(okay, "All " + histId + " actions were skipped");
} else {
ok(false, "Unexpected " + histId + " was logged");
}
}
// For help generating these tests use generateTelemetryTests("DEVTOOLS_")
// here.
checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", null, "hasentries");
checkTelemetry("DEVTOOLS_WEBIDE_CONNECTION_DEBUG_USED", [6,0,0]);
checkTelemetry("DEVTOOLS_WEBIDE_CONNECTION_PLAY_USED", [6,0,0]);
checkTelemetry("DEVTOOLS_WEBIDE_CONNECTION_RESULT", [0,6,0]);
checkTelemetry("DEVTOOLS_WEBIDE_CONNECTION_TIME_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_WEBIDE_LOCAL_CONNECTION_RESULT", [0,1,0]);
checkTelemetry("DEVTOOLS_WEBIDE_OPENED_BOOLEAN", [0,2,0]);
checkTelemetry("DEVTOOLS_WEBIDE_OPENED_PER_USER_FLAG", [0,1,0]);
checkTelemetry("DEVTOOLS_WEBIDE_OTHER_CONNECTION_RESULT", [0,1,0]);
checkTelemetry("DEVTOOLS_WEBIDE_REMOTE_CONNECTION_RESULT", [0,1,0]);
checkTelemetry("DEVTOOLS_WEBIDE_SIMULATOR_CONNECTION_RESULT", [0,1,0]);
checkTelemetry("DEVTOOLS_WEBIDE_TIME_ACTIVE_SECONDS", null, "hasentries");
checkTelemetry("DEVTOOLS_WEBIDE_USB_CONNECTION_RESULT", [0,1,0]);
checkTelemetry("DEVTOOLS_WEBIDE_WIFI_CONNECTION_RESULT", [0,1,0]);
}
window.onload = function() {
@ -215,7 +159,6 @@
}
DebuggerServer.destroy();
yield removeAllProjects();
resetTelemetry();
});
});
@ -227,7 +170,7 @@
DebuggerServer.addBrowserActors();
}
patchTelemetry();
startTelemetry();
// Cycle once, so we can test for multiple opens
yield cycleWebIDE();