Bug 858834 - Deprecate press/release/double_tap/cancel_touch, rename single_tap to tap. r=mdas, a=test-only
authorYiming Yang <yiyang@mozilla.com>
Fri, 26 Apr 2013 15:18:55 -0700
changeset 119249 8deacd062eb8311ffa12b7507baab035a5ba9d76
parent 119248 1087e3e68ef50222bbeb5194f34d602f375f49bb
child 119250 06746f5ec97e642db08587b01befc1ff7d9001a5
push id749
push usermdas@mozilla.com
push dateThu, 02 May 2013 14:46:35 +0000
reviewersmdas, test-only
bugs858834
milestone18.0
Bug 858834 - Deprecate press/release/double_tap/cancel_touch, rename single_tap to tap. r=mdas, a=test-only
testing/marionette/client/marionette/marionette.py
testing/marionette/client/marionette/tests/unit/test_cancel.py
testing/marionette/client/marionette/tests/unit/test_press_release.py
testing/marionette/client/marionette/tests/unit/test_single_finger.py
testing/marionette/client/marionette/tests/unit/test_tap.py
testing/marionette/client/marionette/tests/unit/test_touch.py
testing/marionette/client/marionette/tests/unit/unit-tests.ini
testing/marionette/marionette-actors.js
testing/marionette/marionette-listener.js
--- a/testing/marionette/client/marionette/marionette.py
+++ b/testing/marionette/client/marionette/marionette.py
@@ -44,31 +44,19 @@ class HTMLElement(object):
         return self.marionette.find_elements(method, target, self.id)
 
     def get_attribute(self, attribute):
         return self.marionette._send_message('getElementAttribute', 'value', element=self.id, name=attribute)
 
     def click(self):
         return self.marionette._send_message('clickElement', 'ok', element=self.id)
 
-    def single_tap(self, x=None, y=None):
+    def tap(self, x=None, y=None):
         return self.marionette._send_message('singleTap', 'ok', element=self.id, x=x, y=y)
 
-    def double_tap(self, x=None, y=None):
-        return self.marionette._send_message('doubleTap', 'ok', element=self.id, x=x, y=y)
-
-    def press(self, x=None, y=None):
-        return self.marionette._send_message('press', 'value', element=self.id, x=x, y=y)
-
-    def release(self, touch_id, x=None, y=None):
-        return self.marionette._send_message('release', 'ok', element=self.id, touchId=touch_id, x=x, y=y)
-
-    def cancel_touch(self, touch_id):
-        return self.marionette._send_message('cancelTouch', 'ok', element=self.id, touchId=touch_id)
-
     @property
     def text(self):
         return self.marionette._send_message('getElementText', 'value', element=self.id)
 
     def send_keys(self, *string):
         typing = []
         for val in string:
             if isinstance(val, Keys):
@@ -133,16 +121,30 @@ class Actions(object):
     def wait(self, time=None):
         self.action_chain.append(['wait', time])
         return self
 
     def cancel(self):
         self.action_chain.append(['cancel'])
         return self
 
+    def tap(self, element, x=None, y=None):
+        element=element.id
+        self.action_chain.append(['press', element, x, y])
+        self.action_chain.append(['release'])
+        return self
+
+    def double_tap(self, element, x=None, y=None):
+        element=element.id
+        self.action_chain.append(['press', element, x, y])
+        self.action_chain.append(['release'])
+        self.action_chain.append(['press', element, x, y])
+        self.action_chain.append(['release'])
+        return self
+
     def flick(self, element, x1, y1, x2, y2, duration=200):
         element = element.id
         time = 0
         time_increment = 10
         if time_increment >= duration:
             time_increment = duration
         move_x = time_increment*1.0/duration * (x2 - x1)
         move_y = time_increment*1.0/duration * (y2 - y1)
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/test_cancel.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import time
-from marionette_test import MarionetteTestCase
-from marionette import Actions
-
-class testSingleFinger(MarionetteTestCase):
-    def test_chain(self):
-        testTouch = self.marionette.absolute_url("testAction.html")
-        self.marionette.navigate(testTouch)
-        button = self.marionette.find_element("id", "mozLinkCancel")
-        action = Actions(self.marionette)
-        action.press(button).wait(5).cancel()
-        action.perform()
-        time.sleep(15)
-        self.assertEqual("End", self.marionette.execute_script("return document.getElementById('mozLinkCancel').innerHTML;"))
-
-    def test_element(self):
-        testTouch = self.marionette.absolute_url("testAction.html")
-        self.marionette.navigate(testTouch)
-        button = self.marionette.find_element("id", "mozLinkCancel")
-        new_id = button.press()
-        button.cancel_touch(new_id)
-        time.sleep(15)
-        self.assertEqual("End", self.marionette.execute_script("return document.getElementById('mozLinkCancel').innerHTML;"))
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/test_press_release.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import os
-import time
-from marionette_test import MarionetteTestCase
-
-class testPressRelease(MarionetteTestCase):
-    def test_coordinates(self):
-        testTouch = self.marionette.absolute_url("testAction.html")
-        self.marionette.navigate(testTouch)
-        button1 = self.marionette.find_element("id", "mozLink")
-        new_id = button1.press(0, 400)
-        button1.release(new_id, 0, 400)
-        time.sleep(10)
-        self.assertEqual("End", self.marionette.execute_script("return document.getElementById('mozLinkCopy').innerHTML;"))
-
-    def test_no_coordinates(self):
-      testTouch = self.marionette.absolute_url("testAction.html")
-      self.marionette.navigate(testTouch)
-      ele = self.marionette.find_element("id", "mozLinkCopy")
-      new_id = ele.press()
-      ele.release(new_id)
-      time.sleep(10)
-      self.assertEqual("End", self.marionette.execute_script("return document.getElementById('mozLinkCopy').innerHTML;"))
-
-    def test_move(self):
-      testTouch = self.marionette.absolute_url("testAction.html")
-      self.marionette.navigate(testTouch)
-      ele = self.marionette.find_element("id", "mozLink")
-      press_id = ele.press()
-      ele.release(press_id, 0, 300)
-      time.sleep(10)
-      self.assertEqual("Move", self.marionette.execute_script("return document.getElementById('mozLink').innerHTML;"))
-      self.assertEqual("End", self.marionette.execute_script("return document.getElementById('mozLinkPos').innerHTML;"))
--- a/testing/marionette/client/marionette/tests/unit/test_single_finger.py
+++ b/testing/marionette/client/marionette/tests/unit/test_single_finger.py
@@ -152,8 +152,60 @@ class testSingleFinger(MarionetteTestCas
         self.marionette.navigate(testTouch)
         button = self.marionette.find_element("id", "mozLinkScrollStart")
         action = Actions(self.marionette)
         action.flick(button, 0, 0, 0, -250).perform()
         time.sleep(15)
         self.assertEqual("End", self.marionette.execute_script("return document.getElementById('mozLinkScroll').innerHTML;"))
         self.assertEqual("Start", self.marionette.execute_script("return document.getElementById('mozLinkScrollStart').innerHTML;"))
 
+    """
+    #Skipping due to Bug 865334
+    def test_touchcancel_chain(self):
+        testTouch = self.marionette.absolute_url("testAction.html")
+        self.marionette.navigate(testTouch)
+        button = self.marionette.find_element("id", "mozLinkCancel")
+        action = Actions(self.marionette)
+        action.press(button).wait(5).cancel()
+        action.perform()
+        time.sleep(15)
+        self.assertEqual("End", self.marionette.execute_script("return document.getElementById('mozLinkCancel').innerHTML;"))
+    """
+
+    def test_mouse_single_tap(self):
+        testTouch = self.marionette.absolute_url("testAction.html")
+        self.marionette.navigate(testTouch)
+        self.marionette.send_mouse_event(True)
+        button = self.marionette.find_element("id", "mozMouse")
+        action = Actions(self.marionette)
+        action.tap(button).perform()
+        time.sleep(15)
+        self.assertEqual("MouseClick", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;"))
+
+    def test_mouse_double_tap(self):
+        testTouch = self.marionette.absolute_url("testAction.html")
+        self.marionette.navigate(testTouch)
+        self.marionette.send_mouse_event(True)
+        button = self.marionette.find_element("id", "mozMouse")
+        action = Actions(self.marionette)
+        action.double_tap(button).perform()
+        time.sleep(15)
+        self.assertEqual("MouseClick2", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;"))
+
+    def test_touch(self):
+        testTouch = self.marionette.absolute_url("testAction.html")
+        self.marionette.navigate(testTouch)
+        self.marionette.send_mouse_event(False)
+        button = self.marionette.find_element("id", "mozMouse")
+        action = Actions(self.marionette)
+        action.tap(button).perform()
+        time.sleep(10)
+        self.assertEqual("TouchEnd", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;"))
+
+    def test_dbtouch(self):
+        testTouch = self.marionette.absolute_url("testAction.html")
+        self.marionette.navigate(testTouch)
+        self.marionette.send_mouse_event(False)
+        button = self.marionette.find_element("id", "mozMouse")
+        action = Actions(self.marionette)
+        action.double_tap(button).perform()
+        time.sleep(10)
+        self.assertEqual("TouchEnd2", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;"))
--- a/testing/marionette/client/marionette/tests/unit/test_tap.py
+++ b/testing/marionette/client/marionette/tests/unit/test_tap.py
@@ -7,58 +7,20 @@ from marionette_test import MarionetteTe
 from marionette import HTMLElement
 
 class testSingleFinger(MarionetteTestCase):
     def test_mouse_single_tap(self):
         testTouch = self.marionette.absolute_url("testAction.html")
         self.marionette.navigate(testTouch)
         self.marionette.send_mouse_event(True)
         button = self.marionette.find_element("id", "mozMouse")
-        button.single_tap()
+        button.tap()
         time.sleep(15)
         self.assertEqual("MouseClick", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;"))
 
-    def test_mouse_double_tap(self):
-        testTouch = self.marionette.absolute_url("testAction.html")
-        self.marionette.navigate(testTouch)
-        self.marionette.send_mouse_event(True)
-        button = self.marionette.find_element("id", "mozMouse")
-        button.double_tap()
-        time.sleep(15)
-        self.assertEqual("MouseClick2", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;"))
-
     def test_touch(self):
         testTouch = self.marionette.absolute_url("testAction.html")
         self.marionette.navigate(testTouch)
         self.marionette.send_mouse_event(False)
         button = self.marionette.find_element("id", "mozMouse")
-        button.single_tap()
+        button.tap()
         time.sleep(10)
         self.assertEqual("TouchEnd", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;"))
-
-    def test_dbtouch(self):
-        testTouch = self.marionette.absolute_url("testAction.html")
-        self.marionette.navigate(testTouch)
-        self.marionette.send_mouse_event(False)
-        button = self.marionette.find_element("id", "mozMouse")
-        button.double_tap()
-        time.sleep(10)
-        self.assertEqual("TouchEnd2", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;"))
-
-    def test_press_release(self):
-        testTouch = self.marionette.absolute_url("testAction.html")
-        self.marionette.navigate(testTouch)
-        self.marionette.send_mouse_event(True)
-        button = self.marionette.find_element("id", "mozMouse")
-        button_id = button.press(0, 0)
-        button.release(button_id, 0, 0)
-        time.sleep(10)
-        self.assertEqual("MouseClick", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;"))
-
-    def test_no_press_release(self):
-        testTouch = self.marionette.absolute_url("testAction.html")
-        self.marionette.navigate(testTouch)
-        self.marionette.send_mouse_event(False)
-        button = self.marionette.find_element("id", "mozMouse")
-        button_id = button.press()
-        button.release(button_id)
-        time.sleep(10)
-        self.assertEqual("TouchEnd", self.marionette.execute_script("return document.getElementById('mozMouse').innerHTML;"))
--- a/testing/marionette/client/marionette/tests/unit/test_touch.py
+++ b/testing/marionette/client/marionette/tests/unit/test_touch.py
@@ -8,28 +8,28 @@ from marionette_test import MarionetteTe
 from marionette import HTMLElement
 from errors import MarionetteException
 
 class testTouch(MarionetteTestCase):
     def test_touch(self):
       testTouch = self.marionette.absolute_url("testTouch.html")
       self.marionette.navigate(testTouch)
       button = self.marionette.find_element("id", "mozLink")
-      button.single_tap(0, 300)
+      button.tap(0, 300)
       time.sleep(10)
       self.assertEqual("Clicked", self.marionette.execute_script("return document.getElementById('mozLinkPos').innerHTML;"))
-      button.single_tap()
+      button.tap()
       time.sleep(10)
       self.assertEqual("Clicked", self.marionette.execute_script("return document.getElementById('mozLink').innerHTML;"))
 
     def test_invisible(self):
       testTouch = self.marionette.absolute_url("testTouch.html")
       self.marionette.navigate(testTouch)
       ele = self.marionette.find_element("id", "testh2")
-      self.assertRaises(MarionetteException, ele.single_tap)
+      self.assertRaises(MarionetteException, ele.tap)
 
     def test_scrolling(self):
       testTouch = self.marionette.absolute_url("testTouch.html")
       self.marionette.navigate(testTouch)
       ele = self.marionette.find_element("id", "scroll")
-      ele.single_tap()
+      ele.tap()
       time.sleep(10)
       self.assertEqual("Clicked", self.marionette.execute_script("return document.getElementById('scroll').innerHTML;"))
--- a/testing/marionette/client/marionette/tests/unit/unit-tests.ini
+++ b/testing/marionette/client/marionette/tests/unit/unit-tests.ini
@@ -44,20 +44,16 @@ b2g = false
 
 [test_timeouts.py]
 b2g = false
 
 [test_touch.py]
 b2g = true
 browser = false
 
-[test_press_release.py]
-b2g = true
-browser = false
-
 [test_gesture.py]
 b2g = true
 browser = false
 unagi = true
 
 [test_single_finger.py]
 b2g = true
 browser = false
@@ -65,20 +61,16 @@ browser = false
 [test_multi_finger.py]
 b2g = true
 browser = false
 
 [test_tap.py]
 b2g = true
 browser = false
 
-[test_cancel.py]
-b2g = true
-browser = false
-
 [test_simpletest_pass.js]
 [test_simpletest_sanity.py]
 [test_simpletest_chrome.js]
 [test_simpletest_timeout.js]
 [test_specialpowers.py]
 [test_switch_frame.py]
 b2g = false
 
--- a/testing/marionette/marionette-actors.js
+++ b/testing/marionette/marionette-actors.js
@@ -1374,116 +1374,16 @@ MarionetteDriverActor.prototype = {
                        corx: x,
                        cory: y
                      },
                      this.command_id);
     }
   },
 
   /**
-   * Double Tap
-   *
-   * @param object aRequest
-   *        'element' represents the ID of the element to double tap on
-   */
-  doubleTap: function MDA_doubleTap(aRequest) {
-    this.command_id = this.getCommandId();
-    let serId = aRequest.element;
-    let x = aRequest.x;
-    let y = aRequest.y;
-    if (this.context == "chrome") {
-      this.sendError("Not in Chrome", 500, null, this.command_id);
-    }
-    else {
-      this.sendAsync("doubleTap",
-                     {
-                       value: serId,
-                       corx: x,
-                       cory: y
-                     },
-                     this.command_id);
-    }
-  },
-
-  /**
-   * Start touch
-   *
-   * @param object aRequest
-   *        'element' represents the ID of the element to touch
-   */
-  press: function MDA_press(aRequest) {
-    this.command_id = this.getCommandId();
-    let element = aRequest.element;
-    let x = aRequest.x;
-    let y = aRequest.y;
-    if (this.context == "chrome") {
-      this.sendError("Not in Chrome", 500, null, this.command_id);
-    }
-    else {
-      this.sendAsync("press",
-                     {
-                       value: element,
-                       corx: x,
-                       cory: y
-                     },
-                     this.command_id);
-    }
-  },
-
-  /**
-   * Cancel touch
-   *
-   * @param object aRequest
-   *        'element' represents the ID of the element to touch
-   */
-  cancelTouch: function MDA_cancelTouch(aRequest) {
-    this.command_id = this.getCommandId();
-    let element = aRequest.element;
-    let touchId = aRequest.touchId;
-    if (this.context == "chrome") {
-      this.sendError("Not in Chrome", 500, null, this.command_id);
-    }
-    else {
-      this.sendAsync("cancelTouch",
-                     {
-                       value: element,
-                       touchId: touchId
-                     },
-                     this.command_id);
-    }
-  },
-
-  /**
-   * End touch
-   *
-   * @param object aRequest
-   *        'element' represents the ID of the element to end the touch
-   */
-  release: function MDA_release(aRequest) {
-    this.command_id = this.getCommandId();
-    let element = aRequest.element;
-    let touchId = aRequest.touchId;
-    let x = aRequest.x;
-    let y = aRequest.y;
-    if (this.context == "chrome") {
-      this.sendError("Not in Chrome", 500, null, this.command_id);
-    }
-    else {
-      this.sendAsync("release",
-                     {
-                       value: element,
-                       touchId: touchId,
-                       corx: x,
-                       cory: y
-                     },
-                     this.command_id);
-    }
-  },
-
-  /**
    * actionChain
    *
    * @param object aRequest
    *        'value' represents a nested array: inner array represents each event; outer array represents collection of events
    */
   actionChain: function MDA_actionChain(aRequest) {
     this.command_id = this.getCommandId();
     if (this.context == "chrome") {
@@ -2287,20 +2187,16 @@ MarionetteDriverActor.prototype.requestT
   "getStatus": MarionetteDriverActor.prototype.getStatus,
   "log": MarionetteDriverActor.prototype.log,
   "getLogs": MarionetteDriverActor.prototype.getLogs,
   "setContext": MarionetteDriverActor.prototype.setContext,
   "executeScript": MarionetteDriverActor.prototype.execute,
   "setScriptTimeout": MarionetteDriverActor.prototype.setScriptTimeout,
   "timeouts": MarionetteDriverActor.prototype.timeouts,
   "singleTap": MarionetteDriverActor.prototype.singleTap,
-  "doubleTap": MarionetteDriverActor.prototype.doubleTap,
-  "press": MarionetteDriverActor.prototype.press,
-  "release": MarionetteDriverActor.prototype.release,
-  "cancelTouch": MarionetteDriverActor.prototype.cancelTouch,
   "actionChain": MarionetteDriverActor.prototype.actionChain,
   "multiAction": MarionetteDriverActor.prototype.multiAction,
   "executeAsyncScript": MarionetteDriverActor.prototype.executeWithCallback,
   "executeJSScript": MarionetteDriverActor.prototype.executeJSScript,
   "setSearchTimeout": MarionetteDriverActor.prototype.setSearchTimeout,
   "sendMouseEvent": MarionetteDriverActor.prototype.sendMouseEvent,
   "findElement": MarionetteDriverActor.prototype.findElement,
   "findElements": MarionetteDriverActor.prototype.findElements,
--- a/testing/marionette/marionette-listener.js
+++ b/testing/marionette/marionette-listener.js
@@ -104,20 +104,16 @@ function removeMessageListenerId(message
  * Start all message listeners
  */
 function startListeners() {
   addMessageListenerId("Marionette:newSession", newSession);
   addMessageListenerId("Marionette:executeScript", executeScript);
   addMessageListenerId("Marionette:executeAsyncScript", executeAsyncScript);
   addMessageListenerId("Marionette:executeJSScript", executeJSScript);
   addMessageListenerId("Marionette:singleTap", singleTap);
-  addMessageListenerId("Marionette:doubleTap", doubleTap);
-  addMessageListenerId("Marionette:press", press);
-  addMessageListenerId("Marionette:release", release);
-  addMessageListenerId("Marionette:cancelTouch", cancelTouch);
   addMessageListenerId("Marionette:actionChain", actionChain);
   addMessageListenerId("Marionette:multiAction", multiAction);
   addMessageListenerId("Marionette:sendMouseEvent", sendMouseEvent);
   addMessageListenerId("Marionette:setSearchTimeout", setSearchTimeout);
   addMessageListenerId("Marionette:goUrl", goUrl);
   addMessageListenerId("Marionette:getUrl", getUrl);
   addMessageListenerId("Marionette:getTitle", getTitle);
   addMessageListenerId("Marionette:getPageSource", getPageSource);
@@ -199,20 +195,16 @@ function restart(msg) {
  * Removes all listeners
  */
 function deleteSession(msg) {
   removeMessageListenerId("Marionette:newSession", newSession);
   removeMessageListenerId("Marionette:executeScript", executeScript);
   removeMessageListenerId("Marionette:executeAsyncScript", executeAsyncScript);
   removeMessageListenerId("Marionette:executeJSScript", executeJSScript);
   removeMessageListenerId("Marionette:singleTap", singleTap);
-  removeMessageListenerId("Marionette:doubleTap", doubleTap);
-  removeMessageListenerId("Marionette:press", press);
-  removeMessageListenerId("Marionette:release", release);
-  removeMessageListenerId("Marionette:cancelTouch", cancelTouch);
   removeMessageListenerId("Marionette:actionChain", actionChain);
   removeMessageListenerId("Marionette:multiAction", multiAction);
   removeMessageListenerId("Marionette:sendMouseEvent", sendMouseEvent);
   removeMessageListenerId("Marionette:setSearchTimeout", setSearchTimeout);
   removeMessageListenerId("Marionette:goUrl", goUrl);
   removeMessageListenerId("Marionette:getTitle", getTitle);
   removeMessageListenerId("Marionette:getPageSource", getPageSource);
   removeMessageListenerId("Marionette:getUrl", getUrl);
@@ -874,74 +866,16 @@ function mousetap(target, duration, x, y
   var doc = target.ownerDocument;
   detail = detail || 1;
   button = button || 0;
   emitMouseEvent(doc, 'mousemove', detail, button, x, y);
   mouse(doc, duration, [x, x], [y, y], then, detail, button);
 }
 
 /**
- * Function that performs a double tap
- */
-function doubleTap(msg) {
-  let command_id = msg.json.command_id;
-  let el;
-  try {
-    el = elementManager.getKnownElement(msg.json.value, curWindow);
-    let x = msg.json.corx;
-    let y = msg.json.cory;
-    if (!checkVisible(el, command_id)) {
-      sendError("Element is not currently visible and may not be manipulated", 11, null, command_id);
-      return;
-    }
-    if (x == null){
-      x = '50%';
-    }
-    if (y == null){
-      y = '50%';
-    }
-    let c = coordinates(el, x, y);
-    if (mouseEvent) {
-      touch(el, 25, [c.x0, c.x0], [c.y0, c.y0], function() {
-        // When the first tap is done, start a timer for interval ms
-        checkTimer.initWithCallback(function() {
-          //After interval ms, send the first mouse tap
-          mousetap(el, 25, c.x0, c.y0, 1, 0, function() {
-            // when the first tap is done, start a timer for interval ms
-            checkTimer.initWithCallback(function() {
-              //After interval ms, send the second tap
-              touch(el, 25, [c.x0, c.x0], [c.y0, c.y0], function() {
-                // when the second tap is done, start a timer for interval ms
-                checkTimer.initWithCallback(function() {
-                  //After interval ms, send the mousetap
-                  mousetap(el, 25, c.x0, c.y0, 2, 0, null);
-                }, 50, Ci.nsITimer.TYPE_ONE_SHOT);
-              });
-            }, 50, Ci.nsITimer.TYPE_ONE_SHOT);
-          });
-        }, 50, Ci.nsITimer.TYPE_ONE_SHOT);
-      });
-    }
-    else {
-      touch(el, 25, [c.x0, c.x0], [c.y0, c.y0], function() {
-        // When the first tap is done, start a timer for interval ms
-        checkTimer.initWithCallback(function() {
-            //After interval ms, send the second tap
-            touch(el, 25, [c.x0, c.x0], [c.y0, c.y0], null);
-        }, 50, Ci.nsITimer.TYPE_ONE_SHOT);
-      });
-    }
-    sendOk(msg.json.command_id);
-  }
-  catch (e) {
-    sendError(e.message, e.code, e.stack, msg.json.command_id);
-  }
-}
-
-/**
  * Function to create a touch based on the element
  * corx and cory are related to the el, id is the touchId
  */
 function createATouch(el, corx, cory, id) {
   let doc = el.ownerDocument;
   let win = doc.defaultView;
   if (corx == null) {
     corx = '50%';
@@ -958,104 +892,16 @@ function createATouch(el, corx, cory, id
       pageY = clientY + win.pageYOffset;
   let screenX = clientX + win.mozInnerScreenX,
       screenY = clientY + win.mozInnerScreenY;
   let atouch = doc.createTouch(win, el, id, pageX, pageY, screenX, screenY, clientX, clientY);
   return atouch;
 }
 
 /**
- * Function to start a touch event
- * corx and cory are relative to the element
- */
-function press(msg) {
-  let command_id = msg.json.command_id;
-  let el;
-  try {
-    el = elementManager.getKnownElement(msg.json.value, curWindow);
-    let corx = msg.json.corx;
-    let cory = msg.json.cory;
-    if (!checkVisible(el, command_id)) {
-      sendError("Element is not currently visible and may not be manipulated", 11, null, command_id);
-      return;
-    }
-    let touchId = nextTouchId++;
-    let touch = createATouch(el, corx, cory, touchId);
-    emitTouchEvent('touchstart', touch);
-    touchIds[touchId] = touch;
-    sendResponse({value: touch.identifier}, command_id);
-  }
-  catch (e) {
-    sendError(e.message, e.code, e.stack, msg.json.command_id);
-  }
-}
-
-/**
- * Function to end a touch event
- */
-function release(msg) {
-  let command_id = msg.json.command_id;
-  let el;
-  try {
-    let id = msg.json.touchId;
-    if (id in touchIds) {
-      let startTouch = touchIds[id];
-      el = startTouch.target;
-      let corx = msg.json.corx;
-      let cory = msg.json.cory;
-      var isTap = true;
-      if (!checkVisible(el, command_id)) {
-        sendError("Element is not currently visible and may not be manipulated", 11, null, command_id);
-        return;
-      }
-      let touch = createATouch(el, corx, cory, id);
-      if (touch.clientX != startTouch.clientX ||
-          touch.clientY != startTouch.clientY) {
-        emitTouchEvent('touchmove', touch);
-        isTap = false;
-      }
-      emitTouchEvent('touchend', touch);
-      if (isTap && mouseEvent) {
-        mousetap(el, 25, touch.clientX, touch.clientY, 1, 0, null);
-      }
-      delete touchIds[id];
-      sendOk(msg.json.command_id);
-    }
-    else {
-      sendError("Element has not been pressed: no such element", 7, null, command_id);
-    }
-  }
-  catch (e) {
-    sendError(e.message, e.code, e.stack, msg.json.command_id);
-  }
-}
-
-/**
- * Function to cancel a touch event
- */
-function cancelTouch(msg) {
-  let command_id = msg.json.command_id;
-  try {
-    let id = msg.json.touchId;
-    if (id in touchIds) {
-      let startTouch = touchIds[id];
-      emitTouchEvent('touchcancel', startTouch);
-      delete touchIds[id];
-      sendOk(msg.json.command_id);
-    }
-    else {
-      sendError("Element not previously interacted with", 7, null, command_id);
-    }
-  }
-  catch (e) {
-    sendError(e.message, e.code, e.stack, msg.json.command_id);
-  }
-}
-
-/**
  * Function to emit touch events for each finger. e.g. finger=[['press', id], ['wait', 5], ['release']]
  * touchId represents the finger id, i keeps track of the current action of the finger
  */
 function actions(finger, touchId, command_id, i){
   if (typeof i === "undefined") {
     i = 0;
   }
   if (i == finger.length) {
@@ -1098,17 +944,19 @@ function actions(finger, touchId, comman
       if (lastTouch == null) {
         sendError("Element has not been pressed: no such element", 7, null, command_id);
         return;
       }
       touch = lastTouch;
       lastTouch = null;
       emitTouchEvent('touchend', touch);
       if (isTouchStart && mouseEvent) {
-        mousetap(touch.target, 25, touch.clientX, touch.clientY, 1, 0, null);
+        emitMouseEvent(touch.target.ownerDocument, 'mousemove', 1, 0, touch.clientX, touch.clientY);
+        emitMouseEvent(touch.target.ownerDocument, 'mousedown', 1, 0, touch.clientX, touch.clientY);
+        emitMouseEvent(touch.target.ownerDocument, 'mouseup', 1, 0, touch.clientX, touch.clientY);
       }
       isTouchStart = false;
       actions(finger, touchId, command_id, i);
       break;
     case 'move':
       if (lastTouch == null) {
         sendError("Element has not been pressed: no such element", 7, null, command_id);
         return;