Bug 1504872 - Wait for mouseover and mouseout events in browser_UrlbarInput_tooltip.js. r=mak
authorDão Gottwald <dao@mozilla.com>
Fri, 30 Nov 2018 14:23:55 +0000
changeset 448963 a27c599bed805807826d3bfd7f7be40c7e629759
parent 448962 b8d320ccbfbc3aab1d59f168c0c9f9bb93bea62d
child 448964 6feb94524b7e519e720d7cccc3fa9cccc51f904e
push id35139
push userccoroiu@mozilla.com
push dateSat, 01 Dec 2018 02:30:08 +0000
treeherdermozilla-central@22425b629a9d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1504872
milestone65.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 1504872 - Wait for mouseover and mouseout events in browser_UrlbarInput_tooltip.js. r=mak Differential Revision: https://phabricator.services.mozilla.com/D13537
browser/components/urlbar/tests/browser/browser_UrlbarInput_tooltip.js
--- a/browser/components/urlbar/tests/browser/browser_UrlbarInput_tooltip.js
+++ b/browser/components/urlbar/tests/browser/browser_UrlbarInput_tooltip.js
@@ -1,56 +1,64 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 function synthesizeMouseOver(element) {
   window.windowUtils.disableNonTestMouseEvents(true);
 
+  let promise = BrowserTestUtils.waitForEvent(gURLBar.inputField, "mouseover");
+
   EventUtils.synthesizeMouse(element, 1, 1, {type: "mouseover"});
   EventUtils.synthesizeMouse(element, 2, 2, {type: "mousemove"});
   EventUtils.synthesizeMouse(element, 3, 3, {type: "mousemove"});
   EventUtils.synthesizeMouse(element, 4, 4, {type: "mousemove"});
+
+  return promise;
 }
 
 function synthesizeMouseOut(element) {
+  let promise = BrowserTestUtils.waitForEvent(gURLBar.inputField, "mouseout");
+
   EventUtils.synthesizeMouse(element, 0, 0, {type: "mouseout"});
   EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"});
   EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"});
   EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mousemove"});
 
   window.windowUtils.disableNonTestMouseEvents(false);
+
+  return promise;
 }
 
 async function expectTooltip(text) {
   ok(gURLBar.hasAttribute("textoverflow"), "Urlbar is overflowing");
 
   let tooltip = document.getElementById("aHTMLTooltip");
   let element = gURLBar.inputField;
 
   let popupShownPromise = BrowserTestUtils.waitForEvent(tooltip, "popupshown");
-  synthesizeMouseOver(element);
+  await synthesizeMouseOver(element);
   await popupShownPromise;
 
   is(element.getAttribute("title"), text, "title attribute has expected text");
   is(tooltip.textContent, text, "tooltip shows expected text");
 
-  synthesizeMouseOut(element);
+  await synthesizeMouseOut(element);
 }
 
 async function expectNoTooltip() {
   ok(!gURLBar.hasAttribute("textoverflow"), "Urlbar isn't overflowing");
 
   let element = gURLBar.inputField;
-  synthesizeMouseOver(element);
+  await synthesizeMouseOver(element);
 
   is(element.getAttribute("title"), null, "title attribute shouldn't be set");
 
-  synthesizeMouseOut(element);
+  await synthesizeMouseOut(element);
 }
 
 add_task(async function() {
   // Ensure the URL bar isn't focused.
   gBrowser.selectedBrowser.focus();
 
   gURLBar.value = "short string";
   await expectNoTooltip();