Bug 1157276, rework test to fix intermittent failure, r=test
authorNeil Deakin <neil@mozilla.com>
Tue, 28 Apr 2015 08:20:17 -0400
changeset 241437 52610ced75b05755c6b00499ba64ed83961a1e08
parent 241436 02520ac48ee30dfea00d43b65bfd6b791ad8f517
child 241438 1b04bf62185810297d444bbbee13c8870e370f63
push id28661
push userryanvm@gmail.com
push dateTue, 28 Apr 2015 19:32:03 +0000
treeherdermozilla-central@4de411d0cf38 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstest
bugs1157276
milestone40.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 1157276, rework test to fix intermittent failure, r=test
layout/xul/test/browser_bug685470.js
--- a/layout/xul/test/browser_bug685470.js
+++ b/layout/xul/test/browser_bug685470.js
@@ -1,33 +1,19 @@
 add_task(function* () {
   const html = "<p id=\"p1\" title=\"tooltip is here\">This paragraph has a tooltip.</p>";
   yield BrowserTestUtils.openNewForegroundTab(gBrowser, "data:text/html," + html);
 
   yield new Promise(resolve => {
     SpecialPowers.pushPrefEnv({"set": [["ui.tooltipDelay", 0]]}, resolve);
   });
 
-  var popup = false;
-  var doc;
-  var win;
-  var p1;
-
-  let onPopupShown = function(aEvent) {
-    popup = true;
-  }
-  document.addEventListener("popupshown", onPopupShown, true);
+  yield BrowserTestUtils.synthesizeMouseAtCenter("#p1", { type: "mousemove" },
+                                                 gBrowser.selectedBrowser);
+  yield BrowserTestUtils.synthesizeMouseAtCenter("#p1", { }, gBrowser.selectedBrowser);
 
-  // Send a mousemove at a known position to start the test.
-  BrowserTestUtils.synthesizeMouseAtCenter("#p1", { type: "mousemove" },
-                                           gBrowser.selectedBrowser);
-  BrowserTestUtils.synthesizeMouseAtCenter("#p1", { }, gBrowser.selectedBrowser);
+  // Wait until the tooltip timeout triggers that would normally have opened the popup.
+  yield new Promise(resolve => setTimeout(resolve, 0));
+  is(document.getElementById("aHTMLTooltip").state, "closed", "local tooltip is closed");
+  is(document.getElementById("remoteBrowserTooltip").state, "closed", "remote tooltip is closed");
 
-  yield new Promise(resolve => {
-    setTimeout(function() {
-      is(popup, false, "shouldn't get tooltip after click");
-      resolve();
-    }, 200);
-  });
-
-  document.removeEventListener("popupshown", onPopupShown, true);
   gBrowser.removeCurrentTab();
 });