Created
November 12, 2014 16:13
-
-
Save MikeRatcliffe/8123dab3d03c9870c48f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# Parent d92174bd091849c9256d8e5841fd3e19e3e22aad | |
# User Michael Ratcliffe <[email protected]> | |
# Date 1415801786 0 | |
Bug 1091796 - Add a telemetry probe to track dark theme usage r=pbrosset,bgrins,me | |
diff --git a/browser/base/content/browser-devedition.js b/browser/base/content/browser-devedition.js | |
--- a/browser/base/content/browser-devedition.js | |
+++ b/browser/base/content/browser-devedition.js | |
@@ -2,25 +2,33 @@ | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
/** | |
* Listeners for the DevEdition theme. This adds an extra stylesheet | |
* to browser.xul if a pref is set and no other themes are applied. | |
*/ | |
let DevEdition = { | |
+ THEME_HISTOGRAM_TOOLBOX: "DEVTOOLS_SELECTED_TOOLBOX_THEME_ENUMERATED", | |
+ THEME_HISTOGRAM_BROWSER: "DEVTOOLS_SELECTED_BROWSER_THEME_BOOLEAN", | |
+ | |
_prefName: "browser.devedition.theme.enabled", | |
_themePrefName: "general.skins.selectedSkin", | |
_lwThemePrefName: "lightweightThemes.isThemeSelected", | |
_devtoolsThemePrefName: "devtools.theme", | |
+ _telemetry: null, | |
styleSheetLocation: "chrome://browser/skin/devedition.css", | |
styleSheet: null, | |
init: function () { | |
+ let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); | |
+ let Telemetry = devtools.require("devtools/shared/telemetry"); | |
+ this._telemetry = new Telemetry(); | |
+ | |
this._updateDevtoolsThemeAttribute(); | |
this._updateStyleSheetFromPrefs(); | |
// Listen for changes to all prefs except for complete themes. | |
// No need for this since changing a complete theme requires a | |
// restart. | |
Services.prefs.addObserver(this._lwThemePrefName, this, false); | |
Services.prefs.addObserver(this._prefName, this, false); | |
@@ -39,18 +47,25 @@ let DevEdition = { | |
// set yet if this happened from customize menu or addons page. | |
this._toggleStyleSheet(false); | |
} | |
} | |
if (topic == "nsPref:changed") { | |
if (data == this._devtoolsThemePrefName) { | |
this._updateDevtoolsThemeAttribute(); | |
+ | |
+ let toolboxTheme = Services.prefs.getCharPref(data); | |
+ this._telemetry.log(this.THEME_HISTOGRAM_TOOLBOX, | |
+ this._getToolboxThemeIndex(toolboxTheme)); | |
} else { | |
this._updateStyleSheetFromPrefs(); | |
+ | |
+ let deveditionThemeEnabled = Services.prefs.getBoolPref(data); | |
+ this._telemetry.log(this.THEME_HISTOGRAM_BROWSER, deveditionThemeEnabled); | |
} | |
} | |
}, | |
_updateDevtoolsThemeAttribute: function() { | |
// Set an attribute on root element to make it possible | |
// to change colors based on the selected devtools theme. | |
document.documentElement.setAttribute("devtoolstheme", | |
@@ -99,19 +114,39 @@ let DevEdition = { | |
this.styleSheet.remove(); | |
this.styleSheet = null; | |
gBrowser.tabContainer._positionPinnedTabs(); | |
ToolbarIconColor.inferFromText(); | |
Services.obs.notifyObservers(window, "devedition-theme-state-changed", false); | |
} | |
}, | |
+ /** | |
+ * Return the theme index for a given toolbox theme. | |
+ * | |
+ * @param {String} themeName | |
+ * Theme name | |
+ */ | |
+ _getToolboxThemeIndex: function(themeName) { | |
+ switch (themeName) { | |
+ case "light": | |
+ return 0; | |
+ case "dark": | |
+ return 1; | |
+ default: | |
+ return 2; | |
+ } | |
+ }, | |
+ | |
uninit: function () { | |
Services.prefs.removeObserver(this._lwThemePrefName, this); | |
Services.prefs.removeObserver(this._prefName, this); | |
Services.prefs.removeObserver(this._devtoolsThemePrefName, this); | |
Services.obs.removeObserver(this, "lightweight-theme-styling-update", false); | |
if (this.styleSheet) { | |
this.styleSheet.removeEventListener("load", this); | |
} | |
this.styleSheet = null; | |
+ | |
+ this._telemetry.destroy(); | |
+ this._telemetry = null; | |
} | |
}; | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolbox.js b/browser/devtools/shared/test/browser_telemetry_toolbox.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolbox.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolbox.js | |
@@ -2,94 +2,91 @@ | |
http://creativecommons.org/publicdomain/zero/1.0/ */ | |
const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolbox.js</p>"; | |
// Because we need to gather stats for the period of time that a tool has been | |
// opened we make use of setTimeout() to create tool active times. | |
const TOOL_DELAY = 200; | |
+const DARK_TOOLBOX_THEME_PREF = "devtools.theme"; | |
+const DARK_BROWSER_THEME_PREF = "browser.devedition.theme.enabled"; | |
+ | |
let {Promise: promise} = Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
+let oldTheme = Services.prefs.getCharPref(DARK_TOOLBOX_THEME_PREF); | |
+ | |
function init() { | |
- 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); | |
- } | |
- }; | |
- | |
+ initTelemetry(); | |
openToolboxThreeTimes(); | |
} | |
let pass = 0; | |
function openToolboxThreeTimes() { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, "inspector").then(function(toolbox) { | |
info("Toolbox opened"); | |
toolbox.once("destroyed", function() { | |
if (pass++ === 3) { | |
- checkResults(); | |
+ switchThemes(); | |
} else { | |
openToolboxThreeTimes(); | |
} | |
}); | |
// We use a timeout to check the toolbox's active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, console.error); | |
} | |
+function switchThemes() { | |
+ for (let theme of ["dark", "light", "dark", "light", "dark", "light", "dark"]) { | |
+ Services.prefs.setCharPref(DARK_TOOLBOX_THEME_PREF, theme); | |
+ Services.prefs.setBoolPref(DARK_BROWSER_THEME_PREF, theme === "dark"); | |
+ } | |
+ | |
+ checkResults(); | |
+} | |
+ | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 4, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 8, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 4, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,4,0]); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_TIME_ACTIVE_SECONDS", 4, "numtimeentries"); | |
- let okay = value.every(function(element) { | |
- return element === true; | |
- }); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,4,0]); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_TIME_ACTIVE_SECONDS", 4, "numtimeentries"); | |
- ok(okay, "All " + histId + " entries are === true"); | |
- } else if (histId.endsWith("TIME_ACTIVE_SECONDS")) { | |
- ok(value.length > 1, histId + " has more than one entry"); | |
+ checkTelemetry("DEVTOOLS_SELECTED_BROWSER_THEME_BOOLEAN", [3,4,0]); | |
+ checkTelemetry("DEVTOOLS_SELECTED_TOOLBOX_THEME_ENUMERATED", [3,4,0,0]); | |
- let okay = value.every(function(element) { | |
- return element > 0; | |
- }); | |
- | |
- ok(okay, "All " + histId + " entries have time > 0"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,4,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 4, "numtimeentries"); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
+ Services.prefs.setCharPref(DARK_TOOLBOX_THEME_PREF, oldTheme); | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
diff --git a/browser/devtools/shared/test/head.js b/browser/devtools/shared/test/head.js | |
--- a/browser/devtools/shared/test/head.js | |
+++ b/browser/devtools/shared/test/head.js | |
@@ -1,18 +1,27 @@ | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); | |
let {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {}); | |
let TargetFactory = devtools.TargetFactory; | |
+let oldCanRecord = Services.telemetry.canRecord; | |
gDevTools.testing = true; | |
SimpleTest.registerCleanupFunction(() => { | |
+ Services.telemetry.canRecord = oldCanRecord; | |
+ | |
+ // Clean up telemetry histogram changes | |
+ for (let histId in Services.telemetry.histogramSnapshots) { | |
+ let histogram = Services.telemetry.getHistogramById(histId); | |
+ histogram.clear(); | |
+ } | |
+ | |
gDevTools.testing = false; | |
}); | |
const TEST_URI_ROOT = "http://example.com/browser/browser/devtools/shared/test/"; | |
/** | |
* Open a new tab at a URL and call a callback on load | |
*/ | |
@@ -140,8 +149,100 @@ function* createHost(type = "bottom", sr | |
yield new Promise(resolve => { | |
let domHelper = new DOMHelpers(iframe.contentWindow); | |
iframe.setAttribute("src", src); | |
domHelper.onceDOMReady(resolve); | |
}); | |
return [host, iframe.contentWindow, iframe.contentDocument]; | |
} | |
+ | |
+function initTelemetry() { | |
+ Services.telemetry.canRecord = true; | |
+} | |
+ | |
+/** | |
+ * 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. | |
+ * "numtimeentries" - For non-enumerated linear and exponential | |
+ * histograms. This compares the number of time | |
+ * entries to the number in expected. | |
+ */ | |
+function checkTelemetry(histId, expected, checkType="array") { | |
+ let testMessage = histId + " correct."; | |
+ let actual = Services.telemetry.getHistogramById(histId).snapshot().counts; | |
+ | |
+ switch (checkType) { | |
+ case "array": | |
+ SimpleTest.is(JSON.stringify(actual), JSON.stringify(expected), testMessage); | |
+ break; | |
+ case "numtimeentries": | |
+ let total = 0; | |
+ for (let val of actual) { | |
+ total += val; | |
+ } | |
+ is(total, expected, testMessage); | |
+ break; | |
+ } | |
+} | |
+ | |
+/** | |
+ * Generate telemetry tests. You should call checkResults("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 + "\", " + total + ", \"numtimeentries\");\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"); | |
+} | |
diff --git a/browser/modules/UITour.jsm b/browser/modules/UITour.jsm | |
--- a/browser/modules/UITour.jsm | |
+++ b/browser/modules/UITour.jsm | |
@@ -882,16 +882,17 @@ this.UITour = { | |
let highlightHeightWithMin = Math.max(highlightHeight, parseFloat(highlightStyle.minHeight)); | |
let highlightWidthWithMin = Math.max(highlightWidth, parseFloat(highlightStyle.minWidth)); | |
let offsetX = paddingTopPx | |
- (Math.max(0, highlightWidthWithMin - targetRect.width) / 2); | |
let offsetY = paddingLeftPx | |
- (Math.max(0, highlightHeightWithMin - targetRect.height) / 2); | |
this._addAnnotationPanelMutationObserver(highlighter.parentElement); | |
highlighter.parentElement.openPopup(highlightAnchor, "overlap", offsetX, offsetY); | |
+debugger; | |
} | |
// Prevent showing a panel at an undefined position. | |
if (!this.isElementVisible(aTarget.node)) | |
return; | |
this._setAppMenuStateForAnnotation(aTarget.node.ownerDocument.defaultView, "highlight", | |
this.targetIsInAppMenu(aTarget), | |
diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json | |
--- a/toolkit/components/telemetry/Histograms.json | |
+++ b/toolkit/components/telemetry/Histograms.json | |
@@ -4873,16 +4873,27 @@ | |
"POPUP_NOTIFICATION_MAINACTION_TRIGGERED_MS": { | |
"expires_in_version": "40", | |
"kind": "linear", | |
"low": 25, | |
"high": "80 * 25", | |
"n_buckets": "80 + 1", | |
"description": "The time (in milliseconds) after showing a PopupNotification that the mainAction was first triggered" | |
}, | |
+ "DEVTOOLS_SELECTED_TOOLBOX_THEME_ENUMERATED": { | |
+ "expires_in_version": "never", | |
+ "kind": "enumerated", | |
+ "n_values": "3", | |
+ "description": "Theme applied to the built-in developer tools (0=light, 1=dark, 2=other)" | |
+ }, | |
+ "DEVTOOLS_SELECTED_BROWSER_THEME_BOOLEAN": { | |
+ "expires_in_version": "never", | |
+ "kind": "boolean", | |
+ "description": "Is the devtools browser theme enabled?" | |
+ }, | |
"DEVTOOLS_DEBUGGER_RDP_LOCAL_RELOAD_MS": { | |
"expires_in_version": "never", | |
"kind": "exponential", | |
"high": "10000", | |
"n_buckets": "1000", | |
"description": "The time (in milliseconds) that it took a 'reload' request to go round trip." | |
}, | |
"DEVTOOLS_DEBUGGER_RDP_REMOTE_RELOAD_MS": { | |
diff --git a/browser/devtools/shared/test/browser.ini b/browser/devtools/shared/test/browser.ini | |
--- a/browser/devtools/shared/test/browser.ini | |
+++ b/browser/devtools/shared/test/browser.ini | |
@@ -6,70 +6,70 @@ support-files = | |
browser_layoutHelpers-getBoxQuads.html | |
browser_layoutHelpers_iframe.html | |
browser_templater_basic.html | |
browser_toolbar_basic.html | |
browser_toolbar_webconsole_errors_count.html | |
head.js | |
leakhunt.js | |
-[browser_css_color.js] | |
-[browser_cubic-bezier-01.js] | |
-[browser_cubic-bezier-02.js] | |
-[browser_cubic-bezier-03.js] | |
-[browser_graphs-01.js] | |
-[browser_graphs-02.js] | |
-[browser_graphs-03.js] | |
-[browser_graphs-04.js] | |
-[browser_graphs-05.js] | |
-[browser_graphs-06.js] | |
-[browser_graphs-07a.js] | |
-[browser_graphs-07b.js] | |
-[browser_graphs-08.js] | |
-[browser_graphs-09a.js] | |
-[browser_graphs-09b.js] | |
-[browser_graphs-09c.js] | |
-[browser_graphs-10a.js] | |
-[browser_graphs-10b.js] | |
-[browser_graphs-11a.js] | |
-[browser_graphs-11b.js] | |
-[browser_graphs-12.js] | |
-[browser_graphs-13.js] | |
-[browser_graphs-14.js] | |
-[browser_inplace-editor.js] | |
-[browser_layoutHelpers.js] | |
-[browser_layoutHelpers-getBoxQuads.js] | |
-[browser_num-l10n.js] | |
-[browser_observableobject.js] | |
-[browser_outputparser.js] | |
-[browser_prefs.js] | |
-[browser_require_basic.js] | |
-[browser_spectrum.js] | |
-[browser_tableWidget_basic.js] | |
-[browser_tableWidget_keyboard_interaction.js] | |
-[browser_tableWidget_mouse_interaction.js] | |
-skip-if = buildapp == 'mulet' | |
+#[browser_css_color.js] | |
+#[browser_cubic-bezier-01.js] | |
+#[browser_cubic-bezier-02.js] | |
+#[browser_cubic-bezier-03.js] | |
+#[browser_graphs-01.js] | |
+#[browser_graphs-02.js] | |
+#[browser_graphs-03.js] | |
+#[browser_graphs-04.js] | |
+#[browser_graphs-05.js] | |
+#[browser_graphs-06.js] | |
+#[browser_graphs-07a.js] | |
+#[browser_graphs-07b.js] | |
+#[browser_graphs-08.js] | |
+#[browser_graphs-09a.js] | |
+#[browser_graphs-09b.js] | |
+#[browser_graphs-09c.js] | |
+#[browser_graphs-10a.js] | |
+#[browser_graphs-10b.js] | |
+#[browser_graphs-11a.js] | |
+#[browser_graphs-11b.js] | |
+#[browser_graphs-12.js] | |
+#[browser_graphs-13.js] | |
+#[browser_graphs-14.js] | |
+#[browser_inplace-editor.js] | |
+#[browser_layoutHelpers.js] | |
+#[browser_layoutHelpers-getBoxQuads.js] | |
+#[browser_num-l10n.js] | |
+#[browser_observableobject.js] | |
+#[browser_outputparser.js] | |
+#[browser_prefs.js] | |
+#[browser_require_basic.js] | |
+#[browser_spectrum.js] | |
+#[browser_tableWidget_basic.js] | |
+#[browser_tableWidget_keyboard_interaction.js] | |
+#[browser_tableWidget_mouse_interaction.js] | |
+#skip-if = buildapp == 'mulet' | |
[browser_telemetry_button_paintflashing.js] | |
[browser_telemetry_button_responsive.js] | |
-[browser_telemetry_button_scratchpad.js] | |
-[browser_telemetry_button_tilt.js] | |
-skip-if = e10s # Bug 1086492 - Disable tilt for e10s | |
+#[browser_telemetry_button_scratchpad.js] | |
+#[browser_telemetry_button_tilt.js] | |
+#skip-if = e10s # Bug 1086492 - Disable tilt for e10s | |
# Bug 937166 - Make tilt work in E10S mode | |
-[browser_telemetry_sidebar.js] | |
-[browser_telemetry_toolbox.js] | |
-[browser_telemetry_toolboxtabs_canvasdebugger.js] | |
-[browser_telemetry_toolboxtabs_inspector.js] | |
-[browser_telemetry_toolboxtabs_jsdebugger.js] | |
-[browser_telemetry_toolboxtabs_jsprofiler.js] | |
-[browser_telemetry_toolboxtabs_netmonitor.js] | |
-[browser_telemetry_toolboxtabs_options.js] | |
-[browser_telemetry_toolboxtabs_shadereditor.js] | |
-[browser_telemetry_toolboxtabs_styleeditor.js] | |
-[browser_telemetry_toolboxtabs_webaudioeditor.js] | |
-[browser_telemetry_toolboxtabs_webconsole.js] | |
-[browser_templater_basic.js] | |
-[browser_toolbar_basic.js] | |
-[browser_toolbar_tooltip.js] | |
-[browser_toolbar_webconsole_errors_count.js] | |
-skip-if = buildapp == 'mulet' | |
-[browser_treeWidget_basic.js] | |
-[browser_treeWidget_keyboard_interaction.js] | |
-[browser_treeWidget_mouse_interaction.js] | |
+#[browser_telemetry_sidebar.js] | |
+#[browser_telemetry_toolbox.js] | |
+#[browser_telemetry_toolboxtabs_canvasdebugger.js] | |
+#[browser_telemetry_toolboxtabs_inspector.js] | |
+#[browser_telemetry_toolboxtabs_jsdebugger.js] | |
+#[browser_telemetry_toolboxtabs_jsprofiler.js] | |
+#[browser_telemetry_toolboxtabs_netmonitor.js] | |
+#[browser_telemetry_toolboxtabs_options.js] | |
+#[browser_telemetry_toolboxtabs_shadereditor.js] | |
+#[browser_telemetry_toolboxtabs_styleeditor.js] | |
+#[browser_telemetry_toolboxtabs_webaudioeditor.js] | |
+#[browser_telemetry_toolboxtabs_webconsole.js] | |
+#[browser_templater_basic.js] | |
+#[browser_toolbar_basic.js] | |
+#[browser_toolbar_tooltip.js] | |
+#[browser_toolbar_webconsole_errors_count.js] | |
+#skip-if = buildapp == 'mulet' | |
+#[browser_treeWidget_basic.js] | |
+#[browser_treeWidget_keyboard_interaction.js] | |
+#[browser_treeWidget_mouse_interaction.js] | |
diff --git a/browser/devtools/shared/test/browser_telemetry_button_paintflashing.js b/browser/devtools/shared/test/browser_telemetry_button_paintflashing.js | |
--- a/browser/devtools/shared/test/browser_telemetry_button_paintflashing.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_button_paintflashing.js | |
@@ -8,33 +8,20 @@ const TEST_URI = "data:text/html;charset | |
const TOOL_DELAY = 200; | |
let promise = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}).Promise; | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
+let oldCanRecord = Services.telemetry.canRecord; | |
+ | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- }; | |
- | |
+ Services.telemetry.canRecord = true; | |
testButton("command-button-paintflashing"); | |
} | |
function testButton(id) { | |
info("Testing " + id); | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
@@ -66,58 +53,51 @@ function delayedClicks(node, clicks) { | |
setTimeout(delayedClick, TOOL_DELAY); | |
} | |
}, TOOL_DELAY); | |
return deferred.promise; | |
} | |
function checkResults(histIdFocus) { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 1, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 1, "numtimeentries"); | |
- 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; | |
- } | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_PAINTFLASHING_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_PAINTFLASHING_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_PAINTFLASHING_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- let okay = value.every(function(element) { | |
- return element === true; | |
- }); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
+ Services.telemetry.canRecord = oldCanRecord; | |
+ | |
+ // Clean up telemetry histogram changes | |
+ for (let histId in Services.telemetry.histogramSnapshots) { | |
+ try { | |
+ let histogram = Services.telemetry.getHistogramById(histId); | |
+ if (histogram) { | |
+ histogram.clear(); | |
+ } | |
+ } catch(e) {} | |
+ } | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_button_responsive.js b/browser/devtools/shared/test/browser_telemetry_button_responsive.js | |
--- a/browser/devtools/shared/test/browser_telemetry_button_responsive.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_button_responsive.js | |
@@ -8,49 +8,36 @@ const TEST_URI = "data:text/html;charset | |
const TOOL_DELAY = 200; | |
let promise = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}).Promise; | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
+let oldCanRecord = Services.telemetry.canRecord; | |
+ | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- }; | |
- | |
+ Services.telemetry.canRecord = true; | |
testButton("command-button-responsive"); | |
} | |
function testButton(id) { | |
info("Testing " + id); | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, "inspector").then(function(toolbox) { | |
info("inspector opened"); | |
let button = toolbox.doc.querySelector("#" + id); | |
ok(button, "Captain, we have the button"); | |
delayedClicks(button, 4).then(function() { | |
- checkResults("_RESPONSIVE_"); | |
+ checkResults(); | |
}); | |
}).then(null, console.error); | |
} | |
function delayedClicks(node, clicks) { | |
let deferred = promise.defer(); | |
let clicked = 0; | |
@@ -65,59 +52,42 @@ function delayedClicks(node, clicks) { | |
} else { | |
setTimeout(delayedClick, TOOL_DELAY); | |
} | |
}, TOOL_DELAY); | |
return deferred.promise; | |
} | |
-function checkResults(histIdFocus) { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+function checkResults() { | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 1, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 1, "numtimeentries"); | |
- 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; | |
- } | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_RESPONSIVE_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_RESPONSIVE_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_RESPONSIVE_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- let okay = value.every(function(element) { | |
- return element === true; | |
- }); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
+ Services.telemetry.canRecord = oldCanRecord; | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_button_scratchpad.js b/browser/devtools/shared/test/browser_telemetry_button_scratchpad.js | |
--- a/browser/devtools/shared/test/browser_telemetry_button_scratchpad.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_button_scratchpad.js | |
@@ -18,31 +18,17 @@ let promise = Cu.import("resource://gre/ | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
let numScratchpads = 0; | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- }; | |
+ initTelemetry(); | |
Services.ww.registerNotification(windowObserver); | |
testButton("command-button-scratchpad"); | |
} | |
function testButton(id) { | |
info("Testing " + id); | |
@@ -101,59 +87,39 @@ function delayedClicks(node, clicks) { | |
setTimeout(delayedClick, TOOL_DELAY); | |
} | |
}, TOOL_DELAY); | |
return deferred.promise; | |
} | |
function checkResults(histIdFocus) { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 1, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 1, "numtimeentries"); | |
- 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; | |
- } | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]); | |
- let okay = value.every(function(element) { | |
- return element === true; | |
- }); | |
+ checkTelemetry("DEVTOOLS_SCRATCHPAD_OPENED_BOOLEAN", [0,4,0]); | |
+ checkTelemetry("DEVTOOLS_SCRATCHPAD_OPENED_PER_USER_FLAG", [0,1,0]); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
TargetFactory = Services = promise = require = numScratchpads = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
gBrowser.selectedTab = gBrowser.addTab(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_button_tilt.js b/browser/devtools/shared/test/browser_telemetry_button_tilt.js | |
--- a/browser/devtools/shared/test/browser_telemetry_button_tilt.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_button_tilt.js | |
@@ -9,32 +9,17 @@ const TOOL_DELAY = 200; | |
let promise = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}).Promise; | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- }; | |
- | |
+ initTelemetry(); | |
testButton("command-button-tilt"); | |
} | |
function testButton(id) { | |
info("Testing " + id); | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
@@ -66,59 +51,40 @@ function delayedClicks(node, clicks) { | |
setTimeout(delayedClick, TOOL_DELAY); | |
} | |
}, TOOL_DELAY); | |
return deferred.promise; | |
} | |
function checkResults(histIdFocus) { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 1, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 1, "numtimeentries"); | |
- 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; | |
- } | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]); | |
- let okay = value.every(function(element) { | |
- return element === true; | |
- }); | |
+ checkTelemetry("DEVTOOLS_TILT_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TILT_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TILT_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
gBrowser.selectedTab = gBrowser.addTab(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_sidebar.js b/browser/devtools/shared/test/browser_telemetry_sidebar.js | |
--- a/browser/devtools/shared/test/browser_telemetry_sidebar.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_sidebar.js | |
@@ -9,32 +9,17 @@ const TOOL_DELAY = 200; | |
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- }; | |
- | |
+ initTelemetry(); | |
testSidebar(); | |
} | |
function testSidebar() { | |
info("Testing sidebar"); | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
@@ -56,59 +41,49 @@ function testSidebar() { | |
} else { | |
checkResults(); | |
} | |
}, TOOL_DELAY); | |
}); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_COMPUTEDVIEW_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_COMPUTEDVIEW_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_COMPUTEDVIEW_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- 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; | |
- } | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 1, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 1, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_FONTINSPECTOR_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_FONTINSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_FONTINSPECTOR_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- let okay = value.every(function(element) { | |
- return element === true; | |
- }); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
- ok(okay, "All " + histId + " entries are === true"); | |
- } else if (histId.endsWith("TIME_ACTIVE_SECONDS")) { | |
- ok(value.length > 1, histId + " has more than one entry"); | |
+ checkTelemetry("DEVTOOLS_LAYOUTVIEW_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_LAYOUTVIEW_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_LAYOUTVIEW_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- let okay = value.every(function(element) { | |
- return element > 0; | |
- }); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,3,0]); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- ok(okay, "All " + histId + " entries have time > 0"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
gBrowser.selectedTab = gBrowser.addTab(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_canvasdebugger.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_canvasdebugger.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_canvasdebugger.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_canvasdebugger.js | |
@@ -7,36 +7,22 @@ const TEST_URI = "data:text/html;charset | |
// opened we make use of setTimeout() to create tool active times. | |
const TOOL_DELAY = 200; | |
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
+ | |
let originalPref = Services.prefs.getBoolPref("devtools.canvasdebugger.enabled"); | |
Services.prefs.setBoolPref("devtools.canvasdebugger.enabled", true); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- } | |
- | |
+ initTelemetry(); | |
openToolboxTabTwice("canvasdebugger", false); | |
} | |
function openToolboxTabTwice(id, secondPass) { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, id).then(function(toolbox) { | |
info("Toolbox tab " + id + " opened"); | |
@@ -51,58 +37,44 @@ function openToolboxTabTwice(id, secondP | |
// We use a timeout to check the tools active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, reportError); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_CANVASDEBUGGER_OPENED_BOOLEAN", [0,4,0]); | |
+ checkTelemetry("DEVTOOLS_CANVASDEBUGGER_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_CANVASDEBUGGER_TIME_ACTIVE_SECONDS", 4, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 4, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 2, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
finishUp(); | |
} | |
function reportError(error) { | |
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: "); | |
ok(false, "ERROR: " + error + " at " + error.fileName + ":" + | |
error.lineNumber + "\n\nStack trace:" + stack); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
Services.prefs.setBoolPref("devtools.canvasdebugger.enabled", originalPref); | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_inspector.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_inspector.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_inspector.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_inspector.js | |
@@ -9,32 +9,17 @@ const TOOL_DELAY = 200; | |
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- } | |
- | |
+ initTelemetry(); | |
openToolboxTabTwice("inspector", false); | |
} | |
function openToolboxTabTwice(id, secondPass) { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, id).then(function(toolbox) { | |
info("Toolbox tab " + id + " opened"); | |
@@ -49,59 +34,48 @@ function openToolboxTabTwice(id, secondP | |
// We use a timeout to check the tools active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, reportError); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 4, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 2, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_INSPECTOR_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- let okay = value.every(function(element) { | |
- return element === true; | |
- }); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_RULEVIEW_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
finishUp(); | |
} | |
function reportError(error) { | |
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: "); | |
ok(false, "ERROR: " + error + " at " + error.fileName + ":" + | |
error.lineNumber + "\n\nStack trace:" + stack); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
gBrowser.selectedTab = gBrowser.addTab(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsdebugger.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsdebugger.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsdebugger.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsdebugger.js | |
@@ -9,32 +9,17 @@ const TOOL_DELAY = 200; | |
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- } | |
- | |
+ initTelemetry(); | |
openToolboxTabTwice("jsdebugger", false); | |
} | |
function openToolboxTabTwice(id, secondPass) { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, id).then(function(toolbox) { | |
info("Toolbox tab " + id + " opened"); | |
@@ -49,59 +34,48 @@ function openToolboxTabTwice(id, secondP | |
// We use a timeout to check the tools active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, reportError); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 4, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETHREAD_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RESUME_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_SOURCES_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_THREADDETACH_MS", 2, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_JSDEBUGGER_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_JSDEBUGGER_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_JSDEBUGGER_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
finishUp(); | |
} | |
function reportError(error) { | |
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: "); | |
ok(false, "ERROR: " + error + " at " + error.fileName + ":" + | |
error.lineNumber + "\n\nStack trace:" + stack); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
gBrowser.selectedTab = gBrowser.addTab(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsprofiler.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsprofiler.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsprofiler.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_jsprofiler.js | |
@@ -9,32 +9,17 @@ const TOOL_DELAY = 200; | |
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- } | |
- | |
+ initTelemetry(); | |
openToolboxTabTwice("jsprofiler", false); | |
} | |
function openToolboxTabTwice(id, secondPass) { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, id).then(function(toolbox) { | |
info("Toolbox tab " + id + " opened"); | |
@@ -49,59 +34,44 @@ function openToolboxTabTwice(id, secondP | |
// We use a timeout to check the tools active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, reportError); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 4, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 2, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_JSPROFILER_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_JSPROFILER_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_JSPROFILER_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
finishUp(); | |
} | |
function reportError(error) { | |
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: "); | |
ok(false, "ERROR: " + error + " at " + error.fileName + ":" + | |
error.lineNumber + "\n\nStack trace:" + stack); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
gBrowser.selectedTab = gBrowser.addTab(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_netmonitor.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_netmonitor.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_netmonitor.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_netmonitor.js | |
@@ -9,32 +9,17 @@ const TOOL_DELAY = 200; | |
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- } | |
- | |
+ initTelemetry(); | |
openToolboxTabTwice("netmonitor", false); | |
} | |
function openToolboxTabTwice(id, secondPass) { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, id).then(function(toolbox) { | |
info("Toolbox tab " + id + " opened"); | |
@@ -49,59 +34,44 @@ function openToolboxTabTwice(id, secondP | |
// We use a timeout to check the tools active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, reportError); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 4, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 2, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_NETMONITOR_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_NETMONITOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_NETMONITOR_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
finishUp(); | |
} | |
function reportError(error) { | |
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: "); | |
ok(false, "ERROR: " + error + " at " + error.fileName + ":" + | |
error.lineNumber + "\n\nStack trace:" + stack); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
gBrowser.selectedTab = gBrowser.addTab(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_options.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_options.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_options.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_options.js | |
@@ -9,32 +9,17 @@ const TOOL_DELAY = 200; | |
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- } | |
- | |
+ initTelemetry(); | |
openToolboxTabTwice("options", false); | |
} | |
function openToolboxTabTwice(id, secondPass) { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, id).then(function(toolbox) { | |
info("Toolbox tab " + id + " opened"); | |
@@ -49,59 +34,44 @@ function openToolboxTabTwice(id, secondP | |
// We use a timeout to check the tools active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, reportError); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 6, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 2, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_OPTIONS_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_OPTIONS_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_OPTIONS_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
finishUp(); | |
} | |
function reportError(error) { | |
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: "); | |
ok(false, "ERROR: " + error + " at " + error.fileName + ":" + | |
error.lineNumber + "\n\nStack trace:" + stack); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
gBrowser.selectedTab = gBrowser.addTab(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_shadereditor.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_shadereditor.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_shadereditor.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_shadereditor.js | |
@@ -14,36 +14,22 @@ const TEST_URI = "data:text/html;charset | |
// opened we make use of setTimeout() to create tool active times. | |
const TOOL_DELAY = 200; | |
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
+ | |
let originalPref = Services.prefs.getBoolPref("devtools.shadereditor.enabled"); | |
Services.prefs.setBoolPref("devtools.shadereditor.enabled", true); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- } | |
- | |
+ initTelemetry(); | |
openToolboxTabTwice("shadereditor", false); | |
} | |
function openToolboxTabTwice(id, secondPass) { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, id).then(function(toolbox) { | |
info("Toolbox tab " + id + " opened"); | |
@@ -58,58 +44,44 @@ function openToolboxTabTwice(id, secondP | |
// We use a timeout to check the tools active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, reportError); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 4, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 2, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_SHADEREDITOR_OPENED_BOOLEAN", [0,4,0]); | |
+ checkTelemetry("DEVTOOLS_SHADEREDITOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_SHADEREDITOR_TIME_ACTIVE_SECONDS", 4, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
finishUp(); | |
} | |
function reportError(error) { | |
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: "); | |
ok(false, "ERROR: " + error + " at " + error.fileName + ":" + | |
error.lineNumber + "\n\nStack trace:" + stack); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
Services.prefs.setBoolPref("devtools.shadereditor.enabled", originalPref); | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_styleeditor.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_styleeditor.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_styleeditor.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_styleeditor.js | |
@@ -9,32 +9,17 @@ const TOOL_DELAY = 200; | |
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- } | |
- | |
+ initTelemetry(); | |
openToolboxTabTwice("styleeditor", false); | |
} | |
function openToolboxTabTwice(id, secondPass) { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, id).then(function(toolbox) { | |
info("Toolbox tab " + id + " opened"); | |
@@ -49,59 +34,44 @@ function openToolboxTabTwice(id, secondP | |
// We use a timeout to check the tools active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, reportError); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 4, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 2, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_STYLEEDITOR_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_STYLEEDITOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_STYLEEDITOR_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
finishUp(); | |
} | |
function reportError(error) { | |
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: "); | |
ok(false, "ERROR: " + error + " at " + error.fileName + ":" + | |
error.lineNumber + "\n\nStack trace:" + stack); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
gBrowser.selectedTab = gBrowser.addTab(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webaudioeditor.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webaudioeditor.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webaudioeditor.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webaudioeditor.js | |
@@ -12,32 +12,17 @@ let {Services} = Cu.import("resource://g | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
let originalPref = Services.prefs.getBoolPref("devtools.webaudioeditor.enabled"); | |
Services.prefs.setBoolPref("devtools.webaudioeditor.enabled", true); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- } | |
- | |
+ initTelemetry(); | |
openToolboxTabTwice("webaudioeditor", false); | |
} | |
function openToolboxTabTwice(id, secondPass) { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, id).then(function(toolbox) { | |
info("Toolbox tab " + id + " opened"); | |
@@ -52,59 +37,44 @@ function openToolboxTabTwice(id, secondP | |
// We use a timeout to check the tools active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, reportError); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 4, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 2, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_WEBAUDIOEDITOR_OPENED_BOOLEAN", [0,4,0]); | |
+ checkTelemetry("DEVTOOLS_WEBAUDIOEDITOR_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_WEBAUDIOEDITOR_TIME_ACTIVE_SECONDS", 4, "numtimeentries"); | |
finishUp(); | |
} | |
function reportError(error) { | |
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: "); | |
ok(false, "ERROR: " + error + " at " + error.fileName + ":" + | |
error.lineNumber + "\n\nStack trace:" + stack); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
Services.prefs.setBoolPref("devtools.webaudioeditor.enabled", originalPref); | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
diff --git a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webconsole.js b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webconsole.js | |
--- a/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webconsole.js | |
+++ b/browser/devtools/shared/test/browser_telemetry_toolboxtabs_webconsole.js | |
@@ -9,32 +9,17 @@ const TOOL_DELAY = 200; | |
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); | |
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require; | |
let Telemetry = require("devtools/shared/telemetry"); | |
function init() { | |
- 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] = []; | |
- } | |
- | |
- this.telemetryInfo[histogramId].push(value); | |
- } | |
- } | |
- | |
+ initTelemetry(); | |
openToolboxTabTwice("webconsole", false); | |
} | |
function openToolboxTabTwice(id, secondPass) { | |
let target = TargetFactory.forTab(gBrowser.selectedTab); | |
gDevTools.showToolbox(target, id).then(function(toolbox) { | |
info("Toolbox tab " + id + " opened"); | |
@@ -49,59 +34,44 @@ function openToolboxTabTwice(id, secondP | |
// We use a timeout to check the tools active time | |
setTimeout(function() { | |
gDevTools.closeToolbox(target); | |
}, TOOL_DELAY); | |
}).then(null, reportError); | |
} | |
function checkResults() { | |
- let result = Telemetry.prototype.telemetryInfo; | |
+ // For help generating these tests use generateTelemetryTests("DEVTOOLS_") | |
+ // here. | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTTABS_MS", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_RECONFIGURETAB_MS", 4, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_DEBUGGER_RDP_LOCAL_TABDETACH_MS", 2, "numtimeentries"); | |
- 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"); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
- 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"); | |
- } | |
- } | |
+ checkTelemetry("DEVTOOLS_WEBCONSOLE_OPENED_BOOLEAN", [0,2,0]); | |
+ checkTelemetry("DEVTOOLS_WEBCONSOLE_OPENED_PER_USER_FLAG", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_WEBCONSOLE_TIME_ACTIVE_SECONDS", 2, "numtimeentries"); | |
finishUp(); | |
} | |
function reportError(error) { | |
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: "); | |
ok(false, "ERROR: " + error + " at " + error.fileName + ":" + | |
error.lineNumber + "\n\nStack trace:" + stack); | |
finishUp(); | |
} | |
function finishUp() { | |
gBrowser.removeCurrentTab(); | |
- Telemetry.prototype.log = Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype._oldlog; | |
- delete Telemetry.prototype.telemetryInfo; | |
- | |
TargetFactory = Services = promise = require = null; | |
finish(); | |
} | |
function test() { | |
waitForExplicitFinish(); | |
gBrowser.selectedTab = gBrowser.addTab(); | |
diff --git a/browser/devtools/shared/test/head.js b/browser/devtools/shared/test/head.js | |
--- a/browser/devtools/shared/test/head.js | |
+++ b/browser/devtools/shared/test/head.js | |
@@ -1,27 +1,18 @@ | |
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); | |
let {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {}); | |
let TargetFactory = devtools.TargetFactory; | |
-let oldCanRecord = Services.telemetry.canRecord; | |
gDevTools.testing = true; | |
SimpleTest.registerCleanupFunction(() => { | |
- Services.telemetry.canRecord = oldCanRecord; | |
- | |
- // Clean up telemetry histogram changes | |
- for (let histId in Services.telemetry.histogramSnapshots) { | |
- let histogram = Services.telemetry.getHistogramById(histId); | |
- histogram.clear(); | |
- } | |
- | |
gDevTools.testing = false; | |
}); | |
const TEST_URI_ROOT = "http://example.com/browser/browser/devtools/shared/test/"; | |
/** | |
* Open a new tab at a URL and call a callback on load | |
*/ | |
@@ -150,20 +141,16 @@ function* createHost(type = "bottom", sr | |
let domHelper = new DOMHelpers(iframe.contentWindow); | |
iframe.setAttribute("src", src); | |
domHelper.onceDOMReady(resolve); | |
}); | |
return [host, iframe.contentWindow, iframe.contentDocument]; | |
} | |
-function initTelemetry() { | |
- Services.telemetry.canRecord = true; | |
-} | |
- | |
/** | |
* Check the value of a given telemetry histogram. | |
* | |
* @param {String} histId | |
* Histogram id | |
* @param {Array|Number} expected | |
* Expected value | |
* @param {String} checkType | |
diff --git a/browser/devtools/webide/test/head.js b/browser/devtools/webide/test/head.js | |
--- a/browser/devtools/webide/test/head.js | |
+++ b/browser/devtools/webide/test/head.js | |
@@ -9,16 +9,18 @@ Cu.import('resource://gre/modules/Servic | |
Cu.import("resource://gre/modules/FileUtils.jsm"); | |
Cu.import("resource://gre/modules/Task.jsm"); | |
const {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {}); | |
const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); | |
const {require} = devtools; | |
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/"; | |
} else { | |
TEST_BASE = "chrome://mochitests/content/chrome/browser/devtools/webide/test/"; | |
} | |
Services.prefs.setBoolPref("devtools.webide.enabled", true); | |
@@ -26,16 +28,24 @@ Services.prefs.setBoolPref("devtools.web | |
Services.prefs.setCharPref("devtools.webide.addonsURL", TEST_BASE + "addons/simulators.json"); | |
Services.prefs.setCharPref("devtools.webide.simulatorAddonsURL", TEST_BASE + "addons/fxos_#SLASHED_VERSION#_simulator-#OS#.xpi"); | |
Services.prefs.setCharPref("devtools.webide.adbAddonURL", TEST_BASE + "addons/adbhelper-#OS#.xpi"); | |
Services.prefs.setCharPref("devtools.webide.adaptersAddonURL", TEST_BASE + "addons/fxdt-adapters-#OS#.xpi"); | |
Services.prefs.setCharPref("devtools.webide.templatesURL", TEST_BASE + "templates.json"); | |
SimpleTest.registerCleanupFunction(() => { | |
+ Services.telemetry.canRecord = oldCanRecord; | |
+ | |
+ // Clean up telemetry histogram changes | |
+ for (let histId in Services.telemetry.histogramSnapshots) { | |
+ let histogram = Services.telemetry.getHistogramById(histId); | |
+ histogram.clear(); | |
+ } | |
+ | |
Services.prefs.clearUserPref("devtools.webide.enabled"); | |
Services.prefs.clearUserPref("devtools.webide.autoinstallADBHelper"); | |
Services.prefs.clearUserPref("devtools.webide.autoinstallFxdtAdapters"); | |
}); | |
function openWebIDE(autoInstallAddons) { | |
info("opening WebIDE"); | |
@@ -191,8 +201,100 @@ function connectToLocalRuntime(aWindow) | |
items[1].click(); | |
return deferred.promise; | |
} | |
function handleError(aError) { | |
ok(false, "Got an error: " + aError.message + "\n" + aError.stack); | |
finish(); | |
} | |
+ | |
+function initTelemetry() { | |
+ Services.telemetry.canRecord = true; | |
+} | |
+ | |
+/** | |
+ * 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. | |
+ * "numtimeentries" - For non-enumerated linear and exponential | |
+ * histograms. This compares the number of time | |
+ * entries to the number in expected. | |
+ */ | |
+function checkTelemetry(histId, expected, checkType="array") { | |
+ let testMessage = histId + " correct."; | |
+ let actual = Services.telemetry.getHistogramById(histId).snapshot().counts; | |
+ | |
+ switch (checkType) { | |
+ case "array": | |
+ SimpleTest.is(JSON.stringify(actual), JSON.stringify(expected), testMessage); | |
+ break; | |
+ case "numtimeentries": | |
+ let total = 0; | |
+ for (let val of actual) { | |
+ total += val; | |
+ } | |
+ is(total, expected, testMessage); | |
+ break; | |
+ } | |
+} | |
+ | |
+/** | |
+ * Generate telemetry tests. You should call checkResults("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 snapshot in Services.telemetry.histogramSnapshots) { | |
+ if (!snapshot.startsWith(prefix)) { | |
+ continue; | |
+ } | |
+ | |
+ let histogram = Services.telemetry.histogramSnapshots[snapshot]; | |
+ let actual = histogram.counts; | |
+ | |
+ switch (histogram.histogram_type) { | |
+ case Services.telemetry.HISTOGRAM_EXPONENTIAL: | |
+ case Services.telemetry.HISTOGRAM_LINEAR: | |
+ let total = 0; | |
+ for (let val of actual) { | |
+ total += val; | |
+ } | |
+ | |
+ if (snapshot.endsWith("_ENUMERATED")) { | |
+ if (total > 0) { | |
+ dump("checkTelemetry(\"" + snapshot + "\", " + JSON.stringify(actual) + ");\n"); | |
+ } | |
+ continue; | |
+ } | |
+ | |
+ dump("checkTelemetry(\"" + snapshot + "\", " + total + ", \"numtimeentries\");\n"); | |
+ break; | |
+ case Services.telemetry.HISTOGRAM_BOOLEAN: | |
+ actual = JSON.stringify(actual); | |
+ | |
+ if (actual !== "[0,0,0]") { | |
+ dump("checkTelemetry(\"" + snapshot + "\", " + actual + ");\n"); | |
+ } | |
+ break; | |
+ case Services.telemetry.HISTOGRAM_FLAG: | |
+ actual = JSON.stringify(actual); | |
+ | |
+ if (actual !== "[1,0,0]") { | |
+ dump("checkTelemetry(\"" + snapshot + "\", " + actual + ");\n"); | |
+ } | |
+ break; | |
+ case Services.telemetry.HISTOGRAM_COUNT: | |
+ dump("checkTelemetry(\"" + snapshot + "\", " + actual + ");\n"); | |
+ break; | |
+ } | |
+ } | |
+ dump("=".repeat(80) + "\n"); | |
+} | |
diff --git a/browser/devtools/webide/test/test_telemetry.html b/browser/devtools/webide/test/test_telemetry.html | |
--- a/browser/devtools/webide/test/test_telemetry.html | |
+++ b/browser/devtools/webide/test/test_telemetry.html | |
@@ -19,35 +19,16 @@ | |
const { _DeprecatedUSBRuntime, _WiFiRuntime, _SimulatorRuntime, | |
_gRemoteRuntime, _gLocalRuntime, RuntimeTypes } | |
= require("devtools/webide/runtimes"); | |
// Because we need to gather stats for the period of time that a tool has | |
// 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(); | |
// Wait a bit, so we're open for a non-zero time | |
yield waitForTime(TOOL_DELAY); | |
yield closeWebIDE(win); | |
}); | |
} | |
@@ -144,95 +125,58 @@ | |
function connectToRuntime(win, type, index) { | |
return Task.spawn(function*() { | |
yield startConnection(win, type, index); | |
yield waitUntilConnected(win); | |
}); | |
} | |
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", 8, "numtimeentries"); | |
+ 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", 6, "numtimeentries"); | |
+ 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", 2, "numtimeentries"); | |
+ checkTelemetry("DEVTOOLS_WEBIDE_USB_CONNECTION_RESULT", [0,1,0]); | |
+ checkTelemetry("DEVTOOLS_WEBIDE_WIFI_CONNECTION_RESULT", [0,1,0]); | |
} | |
window.onload = function() { | |
SimpleTest.waitForExplicitFinish(); | |
let win; | |
SimpleTest.registerCleanupFunction(() => { | |
Task.spawn(function*() { | |
if (win) { | |
yield closeWebIDE(win); | |
} | |
DebuggerServer.destroy(); | |
yield removeAllProjects(); | |
- resetTelemetry(); | |
}); | |
}); | |
Task.spawn(function*() { | |
Cu.import("resource://gre/modules/devtools/dbg-server.jsm"); | |
if (!DebuggerServer.initialized) { | |
DebuggerServer.init(function () { return true; }); | |
DebuggerServer.addBrowserActors(); | |
} | |
- patchTelemetry(); | |
+ initTelemetry(); | |
// Cycle once, so we can test for multiple opens | |
yield cycleWebIDE(); | |
win = yield openWebIDE(); | |
// Wait a bit, so we're open for a non-zero time | |
yield waitForTime(TOOL_DELAY); | |
addFakeRuntimes(win); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Apply this patch then run:
./mach mochitest-devtools browser/devtools/shared/test/