Bug 1268349 - tell BrowserUITelemetry that the sync-button is in the menu panel by default. r=Gijs
MozReview-Commit-ID: 991ZT9upYDR
--- a/browser/modules/BrowserUITelemetry.jsm
+++ b/browser/modules/BrowserUITelemetry.jsm
@@ -38,16 +38,17 @@ XPCOMUtils.defineLazyGetter(this, "DEFAU
"privatebrowsing-button",
"save-page-button",
"print-button",
"history-panelmenu",
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
+ "sync-button",
"developer-button",
],
"nav-bar": [
"urlbar-container",
"search-container",
"bookmarks-menu-button",
"pocket-button",
"downloads-button",
@@ -86,17 +87,16 @@ XPCOMUtils.defineLazyGetter(this, "DEFAU
});
XPCOMUtils.defineLazyGetter(this, "PALETTE_ITEMS", function() {
let result = [
"open-file-button",
"developer-button",
"feed-button",
"email-link-button",
- "sync-button",
];
let panelPlacements = DEFAULT_AREA_PLACEMENTS["PanelUI-contents"];
if (panelPlacements.indexOf("characterencoding-button") == -1) {
result.push("characterencoding-button");
}
if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
--- a/browser/modules/test/browser.ini
+++ b/browser/modules/test/browser.ini
@@ -1,13 +1,14 @@
[DEFAULT]
support-files =
head.js
[browser_BrowserUITelemetry_buckets.js]
+[browser_BrowserUITelemetry_defaults.js]
[browser_ProcessHangNotifications.js]
skip-if = !e10s
[browser_ContentSearch.js]
support-files =
contentSearch.js
contentSearchBadImage.xml
contentSearchSuggestions.sjs
contentSearchSuggestions.xml
new file mode 100644
--- /dev/null
+++ b/browser/modules/test/browser_BrowserUITelemetry_defaults.js
@@ -0,0 +1,31 @@
+// The purpose of this test is to ensure that by default, BrowserUITelemetry
+// isn't reporting any UI customizations. This is primarily so changes to
+// customizableUI (eg, new buttons, button location changes) also have a
+// corresponding BrowserUITelemetry change.
+
+function test() {
+ let s = {};
+ Cu.import("resource:///modules/CustomizableUI.jsm", s);
+ Cu.import("resource:///modules/BrowserUITelemetry.jsm", s);
+
+ let { CustomizableUI, BrowserUITelemetry } = s;
+
+ Assert.ok(CustomizableUI.inDefaultState,
+ "No other test should have left CUI in a dirty state.");
+
+ let result = BrowserUITelemetry._getWindowMeasurements(window, 0);
+
+ Assert.deepEqual(result.defaultMoved, []);
+ Assert.deepEqual(result.nondefaultAdded, []);
+ // This one is a bit weird - the "social-share-button" is dynamically added
+ // to the toolbar as the feature is first used - but it's listed as being in
+ // the toolbar by default so it doesn't end up in nondefaultAdded once it
+ // is created. The end result is that it ends up in defaultRemoved before
+ // the feature has been activated.
+ // Bug 1273358 exists to fix this.
+ Assert.deepEqual(result.defaultRemoved, ["social-share-button"]);
+
+ // And mochi insists there's only a single window with a single tab when
+ // starting a test, so check that for good measure.
+ Assert.deepEqual(result.visibleTabs, [1]);
+}