Bug 651554 permaorange: browser_tapping.js | Fired a good double tap r=wesj
authorBenjamin Stover <bstover@mozilla.com>
Fri, 22 Apr 2011 16:09:05 -0700
changeset 68568 657cd15fa85d64e39d6fd7f1307f50daacfbb581
parent 68567 863db843fde46a9e34f49d3e61d789b3b5c766d8
child 68569 9b17b766116db33212b72853482bd2e6c691e594
push id99
push usereakhgari@mozilla.com
push dateTue, 24 May 2011 18:03:59 +0000
treeherdermozilla-aurora@26d6981b3d6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs651554
milestone6.0a1
Bug 651554 permaorange: browser_tapping.js | Fired a good double tap r=wesj
mobile/chrome/tests/browser_tapping.js
--- a/mobile/chrome/tests/browser_tapping.js
+++ b/mobile/chrome/tests/browser_tapping.js
@@ -139,17 +139,17 @@ gTests.push({
   run: function() {
     let inputHandler = gCurrentTab.browser.parentNode;
     let width = inputHandler.getBoundingClientRect().width;
     let height = inputHandler.getBoundingClientRect().height;
 
     // Should fire "TapSingle"
     info("Test good single tap");
     clearEvents();
-    EventUtils.synthesizeMouse(inputHandler, width / 2, height / 2, {});
+    EventUtils.synthesizeMouse(document.documentElement, width / 2, height / 2, {});
 
     // We wait a bit because of the delay allowed for double clicking on device
     // where it is not native
     setTimeout(function() {
       ok(checkEvents(["TapSingle"]), "Fired a good single tap");
       clearEvents();
       gCurrentTest.doubleTapTest();
     }, kDoubleClickIntervalPlus);
@@ -158,18 +158,18 @@ gTests.push({
   doubleTapTest: function() {
     let inputHandler = gCurrentTab.browser.parentNode;
     let width = inputHandler.getBoundingClientRect().width;
     let height = inputHandler.getBoundingClientRect().height;
 
     // Should fire "TapDouble"
     info("Test good double tap");
     clearEvents();
-    EventUtils.synthesizeMouse(inputHandler, width / 2, height / 2, {});
-    EventUtils.synthesizeMouse(inputHandler, width / 2, height / 2, {});
+    EventUtils.synthesizeMouse(document.documentElement, width / 2, height / 2, {});
+    EventUtils.synthesizeMouse(document.documentElement, width / 2, height / 2, {});
 
     setTimeout(function() {
       ok(checkEvents(["TapDouble"]), "Fired a good double tap");
       clearEvents();
 
       gCurrentTest.doubleTapFailTest();
     }, kDoubleClickIntervalPlus);
   },
@@ -177,54 +177,54 @@ gTests.push({
   doubleTapFailTest: function() {
     let inputHandler = gCurrentTab.browser.parentNode;
     let width = inputHandler.getBoundingClientRect().width;
     let height = inputHandler.getBoundingClientRect().height;
 
     // Should fire "TapSingle", "TapSingle"
     info("Test two single taps in different locations");
     clearEvents();
-    EventUtils.synthesizeMouse(inputHandler, width / 3, height / 3, {});
-    EventUtils.synthesizeMouse(inputHandler, width * 2 / 3, height * 2 / 3, {});
+    EventUtils.synthesizeMouse(document.documentElement, width / 3, height / 3, {});
+    EventUtils.synthesizeMouse(document.documentElement, width * 2 / 3, height * 2 / 3, {});
 
     setTimeout(function() {
       ok(checkEvents(["TapSingle", "TapSingle"]), "Fired two single taps in different places, not a double tap");
       clearEvents();
 
       gCurrentTest.tapPanTest();
     }, 500);
   },
 
   tapPanTest: function() {
     let inputHandler = gCurrentTab.browser.parentNode;
     let width = inputHandler.getBoundingClientRect().width;
     let height = inputHandler.getBoundingClientRect().height;
 
     info("Test a pan - non-tap event");
     clearEvents();
-    EventUtils.synthesizeMouse(inputHandler, width / 2, height / 3, { type: "mousedown" });
-    EventUtils.synthesizeMouse(inputHandler, width / 2, height * 2 / 3, { type: "mousemove" });
-    EventUtils.synthesizeMouse(inputHandler, width / 2, height * 2 / 3, { type: "mouseup" });
+    EventUtils.synthesizeMouse(document.documentElement, width / 2, height / 3, { type: "mousedown" });
+    EventUtils.synthesizeMouse(document.documentElement, width / 2, height * 2 / 3, { type: "mousemove" });
+    EventUtils.synthesizeMouse(document.documentElement, width / 2, height * 2 / 3, { type: "mouseup" });
     ok(checkEvents([]), "Fired a pan which should be seen as a non event");
     clearEvents();
 
     setTimeout(function() { gCurrentTest.longTapFailTest(); }, 500);
   },
 
   longTapFailTest: function() {
     let inputHandler = gCurrentTab.browser.parentNode;
     let width = inputHandler.getBoundingClientRect().width;
     let height = inputHandler.getBoundingClientRect().height;
 
     info("Test a long pan - non-tap event");
     clearEvents();
-    EventUtils.synthesizeMouse(inputHandler, width / 2, height / 3, { type: "mousedown" });
-    EventUtils.synthesizeMouse(inputHandler, width / 2, height * 2 / 3, { type: "mousemove" });
+    EventUtils.synthesizeMouse(document.documentElement, width / 2, height / 3, { type: "mousedown" });
+    EventUtils.synthesizeMouse(document.documentElement, width / 2, height * 2 / 3, { type: "mousemove" });
     setTimeout(function() {
-      EventUtils.synthesizeMouse(inputHandler, width / 2, height * 2 / 3, { type: "mouseup" });
+      EventUtils.synthesizeMouse(document.documentElement, width / 2, height * 2 / 3, { type: "mouseup" });
       ok(checkEvents([]), "Fired a pan + delay which should be seen as a non-event");
       clearEvents();
 
       window.addEventListener("PanFinished", function() {
         setTimeout(gCurrentTest.longTapPassTest, 0);
       }, true);
     }, 500);
   },
@@ -232,29 +232,29 @@ gTests.push({
   longTapPassTest: function() {
     let browser = gCurrentTab.browser;
     let inputHandler = browser.parentNode;
     let width = inputHandler.getBoundingClientRect().width;
     let height = inputHandler.getBoundingClientRect().height;
 
     window.addEventListener("TapLong", function() {
       window.removeEventListener("TapLong", arguments.callee, true);
-      EventUtils.synthesizeMouse(inputHandler, width / 2, height / 2, { type: "mouseup" });
+      EventUtils.synthesizeMouse(document.documentElement, width / 2, height / 2, { type: "mouseup" });
       ok(checkEvents(["TapLong"]), "Fired a good long tap");
       clearEvents();
     }, true);
 
     browser.messageManager.addMessageListener("Browser:ContextMenu", function(aMessage) {
       browser.messageManager.removeMessageListener(aMessage.name, arguments.callee);
       setTimeout(gCurrentTest.contextPlainLinkTest, 0);
     });
 
     info("Test a good long pan");
     clearEvents();
-    EventUtils.synthesizeMouse(inputHandler, width / 2, height / 2, { type: "mousedown" });
+    EventUtils.synthesizeMouse(document.documentElement, width / 2, height / 2, { type: "mousedown" });
   },
 
   contextPlainLinkTest: function() {
     waitForContextMenu(function(aJSON) {
       is(aJSON.linkTitle, "A blank page - nothing interesting", "Text content should be the content of the second link");
       ok(checkContextTypes(["link", "link-saveable","link-openable"]), "Plain link context types");
     }, gCurrentTest.contextPlainImageTest);