Bug 685470 - Test. r=sicking
☠☠ backed out by 7ad2846f3ece ☠ ☠
authorJames H <jh.dev0@gmail.com>
Tue, 04 Dec 2012 20:56:21 -0500
changeset 115143 5a1ff68f37d983f75e9b213fca17fd78d55fc7d8
parent 115142 eed8b79a4803cbd745df0088f599f2a24f62a24e
child 115144 4998bde6d220408a28a65e767ef0f68939afa9e1
push id23973
push useremorley@mozilla.com
push dateThu, 06 Dec 2012 10:04:18 +0000
treeherdermozilla-central@ddda5400c826 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs685470
milestone20.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 685470 - Test. r=sicking
layout/xul/test/Makefile.in
layout/xul/test/browser_bug685470.js
--- a/layout/xul/test/Makefile.in
+++ b/layout/xul/test/Makefile.in
@@ -21,13 +21,14 @@ MOCHITEST_CHROME_FILES = \
 		test_bug159346.xul \
 		test_bug372685.xul \
 		test_bug398982-1.xul \
 		test_bug398982-2.xul \
 		test_bug703150.xul \
 		$(NULL)
 
 MOCHITEST_BROWSER_FILES = \
+		browser_bug685470.js \
 		browser_bug703210.js \
 		browser_bug706743.js \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/layout/xul/test/browser_bug685470.js
@@ -0,0 +1,56 @@
+function test() {
+  waitForExplicitFinish();
+
+  gBrowser.selectedTab = gBrowser.addTab();
+
+  SpecialPowers.setIntPref("ui.tooltipDelay", 0);
+
+  var popup = false;
+  var doc;
+  var win;
+  var p1;
+
+  let onPopupShown = function(aEvent) {
+    popup = true;
+  }
+
+  // test that a mouse click prior to the tooltip appearing blocks it and
+  // mouse movement without leaving the target doesn't show it
+  let runTest = function() {
+    var rc = p1.getBoundingClientRect();
+
+    EventUtils.synthesizeMouseAtCenter(p1, { type: "mousemove" }, win);
+    EventUtils.sendMouseEvent({type:'mousedown'}, p1, win);
+    EventUtils.sendMouseEvent({type:'mouseup'}, p1, win);
+    EventUtils.synthesizeMouse(p1, rc.left, rc.top, { type: "mousemove" }, win);
+
+    setTimeout(function() {
+      is(popup, false, "shouldn't get tooltip after click and mouse move " +
+                       "within target");
+
+      document.removeEventListener("popupshown", onPopupShown, true);
+      SpecialPowers.clearUserPref("ui.tooltipDelay");
+
+      gBrowser.removeCurrentTab();
+      finish();
+    }, 200);
+  }
+
+  let onLoad = function (aEvent) {
+    doc = gBrowser.contentDocument;
+    win = gBrowser.contentWindow;
+    p1 = doc.getElementById("p1");
+
+    document.addEventListener("popupshown", onPopupShown, true);
+
+    runTest();
+  }
+
+  gBrowser.selectedBrowser.addEventListener("load", function loadListener() {
+    gBrowser.selectedBrowser.removeEventListener("load", loadListener, true);
+    setTimeout(onLoad, 0);
+  }, true);
+
+  content.location = "data:text/html," +
+    "<p id=\"p1\" title=\"tooltip is here\">This paragraph has a tooltip.</p>";
+}