Bug 1260552 - Fix test failures. r=me
☠☠ backed out by 8dc7461d078e ☠ ☠
authorJan Odvarko <odvarko@gmail.com>
Tue, 13 Sep 2016 15:32:20 +0200
changeset 314164 c6564e0c04919ae61b11db49ed717d2f19f345fd
parent 314163 e8de82ab570d878051233aef77271e693d362c78
child 314165 fb2117ade1f8a8075a3ac4d2243e212050d57325
push id30709
push usercbook@mozilla.com
push dateFri, 16 Sep 2016 10:53:07 +0000
treeherdermozilla-central@23cd4d6ba00c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1260552
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1260552 - Fix test failures. r=me
devtools/client/framework/test/browser_toolbox_textbox_context_menu.js
devtools/client/framework/test/shared-head.js
devtools/client/inspector/computed/test/browser_computed_search-filter_context-menu.js
devtools/client/inspector/rules/test/browser_rules_eyedropper.js
devtools/client/inspector/rules/test/browser_rules_filtereditor-appears-on-swatch-click.js
devtools/client/inspector/rules/test/browser_rules_search-filter_context-menu.js
devtools/client/inspector/test/browser.ini
devtools/client/inspector/test/browser_inspector_pane-toggle-04.js
devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js
--- a/devtools/client/framework/test/browser_toolbox_textbox_context_menu.js
+++ b/devtools/client/framework/test/browser_toolbox_textbox_context_menu.js
@@ -4,24 +4,26 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const URL = "data:text/html;charset=utf8,test for textbox context menu";
 
 add_task(function* () {
   let toolbox = yield openNewTabAndToolbox(URL, "inspector");
   let textboxContextMenu = toolbox.textboxContextMenuPopup;
 
+  emptyClipboard();
+
   // Make sure the focus is predictable.
   let inspector = toolbox.getPanel("inspector");
+  let onFocus = once(inspector.searchBox, "focus");
   inspector.searchBox.focus();
+  yield onFocus;
 
   ok(textboxContextMenu, "The textbox context menu is loaded in the toolbox");
 
-  emptyClipboard();
-
   let cmdUndo = textboxContextMenu.querySelector("[command=cmd_undo]");
   let cmdDelete = textboxContextMenu.querySelector("[command=cmd_delete]");
   let cmdSelectAll = textboxContextMenu.querySelector("[command=cmd_selectAll]");
   let cmdCut = textboxContextMenu.querySelector("[command=cmd_cut]");
   let cmdCopy = textboxContextMenu.querySelector("[command=cmd_copy]");
   let cmdPaste = textboxContextMenu.querySelector("[command=cmd_paste]");
 
   info("Opening context menu");
@@ -30,17 +32,20 @@ add_task(function* () {
   textboxContextMenu.openPopupAtScreen(0, 0, true);
   yield onContextMenuPopup;
 
   is(cmdUndo.getAttribute("disabled"), "true", "cmdUndo is disabled");
   is(cmdDelete.getAttribute("disabled"), "true", "cmdDelete is disabled");
   is(cmdSelectAll.getAttribute("disabled"), "true", "cmdSelectAll is disabled");
   is(cmdCut.getAttribute("disabled"), "true", "cmdCut is disabled");
   is(cmdCopy.getAttribute("disabled"), "true", "cmdCopy is disabled");
-  is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
+  if (isWindows()) {
+    // emptyClipboard only works on Windows (666254), assert paste only for this OS.
+    is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
+  }
 
   yield cleanup(toolbox);
 });
 
 function* cleanup(toolbox) {
   yield toolbox.destroy();
   gBrowser.removeCurrentTab();
 }
--- a/devtools/client/framework/test/shared-head.js
+++ b/devtools/client/framework/test/shared-head.js
@@ -556,15 +556,23 @@ function stopRecordingTelemetryLogs(Tele
   Telemetry.prototype.log = Telemetry.prototype._oldlog;
   Telemetry.prototype.logKeyed = Telemetry.prototype._oldlogKeyed;
   delete Telemetry.prototype._oldlog;
   delete Telemetry.prototype._oldlogKeyed;
   delete Telemetry.prototype.telemetryInfo;
 }
 
 /**
- * Clean the OS clipboard content.
+ * Clean the logical clipboard content. This method only clears the OS clipboard on
+ * Windows (see Bug 666254).
  */
 function emptyClipboard() {
   let clipboard = Cc["@mozilla.org/widget/clipboard;1"]
     .getService(SpecialPowers.Ci.nsIClipboard);
-  clipboard.emptyClipboard(1);
+  clipboard.emptyClipboard(clipboard.kGlobalClipboard);
 }
+
+/**
+ * Check if the current operating system is Windows.
+ */
+function isWindows() {
+  return Services.appinfo.OS === "WINNT";
+}
--- a/devtools/client/inspector/computed/test/browser_computed_search-filter_context-menu.js
+++ b/devtools/client/inspector/computed/test/browser_computed_search-filter_context-menu.js
@@ -24,27 +24,37 @@ add_task(function* () {
   let cmdUndo = searchContextMenu.querySelector("[command=cmd_undo]");
   let cmdDelete = searchContextMenu.querySelector("[command=cmd_delete]");
   let cmdSelectAll = searchContextMenu.querySelector("[command=cmd_selectAll]");
   let cmdCut = searchContextMenu.querySelector("[command=cmd_cut]");
   let cmdCopy = searchContextMenu.querySelector("[command=cmd_copy]");
   let cmdPaste = searchContextMenu.querySelector("[command=cmd_paste]");
 
   info("Opening context menu");
+
+  emptyClipboard();
+
+  let onFocus = once(searchField, "focus");
+  searchField.focus();
+  yield onFocus;
+
   let onContextMenuPopup = once(searchContextMenu, "popupshowing");
   EventUtils.synthesizeMouse(searchField, 2, 2,
     {type: "contextmenu", button: 2}, win);
   yield onContextMenuPopup;
 
   is(cmdUndo.getAttribute("disabled"), "true", "cmdUndo is disabled");
   is(cmdDelete.getAttribute("disabled"), "true", "cmdDelete is disabled");
-  is(cmdSelectAll.getAttribute("disabled"), "", "cmdSelectAll is enabled");
+  is(cmdSelectAll.getAttribute("disabled"), "true", "cmdSelectAll is disabled");
   is(cmdCut.getAttribute("disabled"), "true", "cmdCut is disabled");
   is(cmdCopy.getAttribute("disabled"), "true", "cmdCopy is disabled");
-  is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
+  if (isWindows()) {
+    // emptyClipboard only works on Windows (666254), assert paste only for this OS.
+    is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
+  }
 
   info("Closing context menu");
   let onContextMenuHidden = once(searchContextMenu, "popuphidden");
   searchContextMenu.hidePopup();
   yield onContextMenuHidden;
 
   info("Copy text in search field using the context menu");
   searchField.value = TEST_INPUT;
--- a/devtools/client/inspector/rules/test/browser_rules_eyedropper.js
+++ b/devtools/client/inspector/rules/test/browser_rules_eyedropper.js
@@ -59,16 +59,18 @@ add_task(function* () {
 
   info("Test that a color can be selected with the eyedropper");
   yield testSelect(view, swatch, inspector, testActor);
 
   let onHidden = tooltip.once("hidden");
   tooltip.hide();
   yield onHidden;
   ok(!tooltip.isVisible(), "color picker tooltip is closed");
+
+  yield waitForTick();
 });
 
 function* testESC(swatch, inspector, testActor) {
   info("Press escape");
   let onCanceled = new Promise(resolve => {
     inspector.inspector.once("color-pick-canceled", resolve);
   });
   yield testActor.synthesizeKey({key: "VK_ESCAPE", options: {}});
--- a/devtools/client/inspector/rules/test/browser_rules_filtereditor-appears-on-swatch-click.js
+++ b/devtools/client/inspector/rules/test/browser_rules_filtereditor-appears-on-swatch-click.js
@@ -24,9 +24,11 @@ add_task(function* () {
   swatch.click();
   yield onRuleViewChanged;
 
   ok(true, "The shown event was emitted after clicking on swatch");
   ok(!inplaceEditor(swatch.parentNode),
   "The inplace editor wasn't shown as a result of the filter swatch click");
 
   yield hideTooltipAndWaitForRuleViewChanged(filterTooltip, view);
+
+  yield waitForTick();
 });
--- a/devtools/client/inspector/rules/test/browser_rules_search-filter_context-menu.js
+++ b/devtools/client/inspector/rules/test/browser_rules_search-filter_context-menu.js
@@ -23,27 +23,37 @@ add_task(function* () {
   let cmdUndo = searchContextMenu.querySelector("[command=cmd_undo]");
   let cmdDelete = searchContextMenu.querySelector("[command=cmd_delete]");
   let cmdSelectAll = searchContextMenu.querySelector("[command=cmd_selectAll]");
   let cmdCut = searchContextMenu.querySelector("[command=cmd_cut]");
   let cmdCopy = searchContextMenu.querySelector("[command=cmd_copy]");
   let cmdPaste = searchContextMenu.querySelector("[command=cmd_paste]");
 
   info("Opening context menu");
+
+  emptyClipboard();
+
+  let onFocus = once(searchField, "focus");
+  searchField.focus();
+  yield onFocus;
+
   let onContextMenuPopup = once(searchContextMenu, "popupshowing");
   EventUtils.synthesizeMouse(searchField, 2, 2,
     {type: "contextmenu", button: 2}, win);
   yield onContextMenuPopup;
 
   is(cmdUndo.getAttribute("disabled"), "true", "cmdUndo is disabled");
   is(cmdDelete.getAttribute("disabled"), "true", "cmdDelete is disabled");
-  is(cmdSelectAll.getAttribute("disabled"), "", "cmdSelectAll is enabled");
+  is(cmdSelectAll.getAttribute("disabled"), "true", "cmdSelectAll is disabled");
   is(cmdCut.getAttribute("disabled"), "true", "cmdCut is disabled");
   is(cmdCopy.getAttribute("disabled"), "true", "cmdCopy is disabled");
-  is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
+  if (isWindows()) {
+    // emptyClipboard only works on Windows (666254), assert paste only for this OS.
+    is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
+  }
 
   info("Closing context menu");
   let onContextMenuHidden = once(searchContextMenu, "popuphidden");
   searchContextMenu.hidePopup();
   yield onContextMenuHidden;
 
   info("Copy text in search field using the context menu");
   searchField.value = TEST_INPUT;
--- a/devtools/client/inspector/test/browser.ini
+++ b/devtools/client/inspector/test/browser.ini
@@ -125,17 +125,16 @@ subsuite = clipboard
 subsuite = clipboard
 [browser_inspector_menu-04-use-in-console.js]
 [browser_inspector_menu-05-attribute-items.js]
 [browser_inspector_menu-06-other.js]
 [browser_inspector_navigation.js]
 [browser_inspector_pane-toggle-01.js]
 [browser_inspector_pane-toggle-02.js]
 [browser_inspector_pane-toggle-03.js]
-[browser_inspector_pane-toggle-04.js]
 [browser_inspector_pane-toggle-05.js]
 skip-if = os == "mac" # Full keyboard navigation on OSX only works if Full Keyboard Access setting is set to All Control in System Keyboard
 [browser_inspector_picker-stop-on-destroy.js]
 [browser_inspector_picker-stop-on-tool-change.js]
 [browser_inspector_pseudoclass-lock.js]
 [browser_inspector_pseudoclass-menu.js]
 [browser_inspector_reload-01.js]
 [browser_inspector_reload-02.js]
deleted file mode 100644
--- a/devtools/client/inspector/test/browser_inspector_pane-toggle-04.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-let { Toolbox } = require("devtools/client/framework/toolbox");
-
-// Test that the dimensions of the collapsed inspector panel are not modified
-// when switching from horizontal to vertical layout, which is mandatory to make
-// sure the panel remains visually hidden (using negative margins).
-
-add_task(function* () {
-  info("Set temporary preferences to ensure a small sidebar width.");
-  yield new Promise(resolve => {
-    let options = {"set": [
-      ["devtools.toolsidebar-width.inspector", 200]
-    ]};
-    SpecialPowers.pushPrefEnv(options, resolve);
-  });
-
-  let { inspector, toolbox } = yield openInspectorForURL("about:blank");
-  let button = inspector.panelDoc.querySelector(".sidebar-toggle");
-  let panel = inspector.panelDoc.querySelector("#inspector-splitter-box .controlled");
-
-  info("Changing toolbox host to a window.");
-  yield toolbox.switchHost(Toolbox.HostType.WINDOW);
-
-  let hostWindow = toolbox._host._window;
-  let originalWidth = hostWindow.outerWidth;
-  let originalHeight = hostWindow.outerHeight;
-
-  info("Resizing window to switch to the horizontal layout.");
-  hostWindow.resizeTo(800, 300);
-
-  // Check the sidebar is expanded when the test starts.
-  ok(!panel.classList.contains("pane-collapsed"), "The panel is in expanded state");
-
-  info("Collapse the inspector sidebar.");
-  let onTransitionEnd = once(panel, "transitionend");
-  EventUtils.synthesizeMouseAtCenter(button, {},
-    inspector.panelDoc.defaultView);
-  yield onTransitionEnd;
-
-  ok(panel.classList.contains("pane-collapsed"), "The panel is in collapsed state");
-  let currentPanelHeight = panel.getBoundingClientRect().height;
-  let currentPanelMarginBottom = panel.style.marginBottom;
-
-  info("Resizing window to switch to the vertical layout.");
-  hostWindow.resizeTo(300, 800);
-
-  // Check the panel is collapsed, and still has the same dimensions.
-  ok(panel.classList.contains("pane-collapsed"), "The panel is still collapsed");
-  is(panel.getBoundingClientRect().height, currentPanelHeight,
-    "The panel height has not been modified when changing the layout.");
-  is(panel.style.marginBottom, currentPanelMarginBottom,
-    "The panel margin-bottom has not been modified when changing the layout.");
-
-  info("Restoring window original size.");
-  hostWindow.resizeTo(originalWidth, originalHeight);
-});
-
-registerCleanupFunction(function () {
-  // Restore the host type for other tests.
-  Services.prefs.clearUserPref("devtools.toolbox.host");
-});
--- a/devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js
+++ b/devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js
@@ -14,38 +14,44 @@ add_task(function* () {
   let {searchBox} = inspector;
   yield selectNode("h1", inspector);
 
   let win = inspector.panelWin;
   let searchContextMenu = toolbox.textboxContextMenuPopup;
   ok(searchContextMenu,
     "The search filter context menu is loaded in the inspector");
 
-  emptyClipboard();
-
   let cmdUndo = searchContextMenu.querySelector("[command=cmd_undo]");
   let cmdDelete = searchContextMenu.querySelector("[command=cmd_delete]");
   let cmdSelectAll = searchContextMenu.querySelector("[command=cmd_selectAll]");
   let cmdCut = searchContextMenu.querySelector("[command=cmd_cut]");
   let cmdCopy = searchContextMenu.querySelector("[command=cmd_copy]");
   let cmdPaste = searchContextMenu.querySelector("[command=cmd_paste]");
 
+  emptyClipboard();
+
   info("Opening context menu");
+  let onFocus = once(searchBox, "focus");
   searchBox.focus();
+  yield onFocus;
+
   let onContextMenuPopup = once(searchContextMenu, "popupshowing");
   EventUtils.synthesizeMouse(searchBox, 2, 2,
     {type: "contextmenu", button: 2}, win);
   yield onContextMenuPopup;
 
   is(cmdUndo.getAttribute("disabled"), "true", "cmdUndo is disabled");
   is(cmdDelete.getAttribute("disabled"), "true", "cmdDelete is disabled");
   is(cmdSelectAll.getAttribute("disabled"), "true", "cmdSelectAll is disabled");
   is(cmdCut.getAttribute("disabled"), "true", "cmdCut is disabled");
   is(cmdCopy.getAttribute("disabled"), "true", "cmdCopy is disabled");
-  is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
+  if (isWindows()) {
+    // emptyClipboard only works on Windows (666254), assert paste only for this OS.
+    is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
+  }
 
   info("Closing context menu");
   let onContextMenuHidden = once(searchContextMenu, "popuphidden");
   searchContextMenu.hidePopup();
   yield onContextMenuHidden;
 
   info("Copy text in search field using the context menu");
   searchBox.value = TEST_INPUT;