Backed out changeset 9902641dcac5 (bug 836375) for B2G Marionette failures. a=backout
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 21 Feb 2013 05:53:52 -0500
changeset 118578 b29d929fa2377fda4f2234c0ddf1c2f2da8f281a
parent 118577 f4f1dc82686a40f91dc8e510f1841ae40d12e17e
child 118579 9e25bd41032f11740c563b9b42a40c86aee291a1
push id482
push userryanvm@gmail.com
push dateThu, 21 Feb 2013 10:55:22 +0000
reviewersbackout
bugs836375
milestone18.0
backs out9902641dcac506b7800ec7e58dfd944c72473a82
Backed out changeset 9902641dcac5 (bug 836375) for B2G Marionette failures. a=backout
testing/marionette/client/marionette/marionette.py
testing/marionette/client/marionette/tests/unit/test_press_release.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
@@ -51,22 +51,16 @@ class HTMLElement(object):
         return self.marionette._send_message('clickElement', 'ok', element=self.id)
 
     def single_tap(self):
         return self.marionette._send_message('singleTap', 'ok', element=self.id)
 
     def double_tap(self):
         return self.marionette._send_message('doubleTap', 'ok', element=self.id)
 
-    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)
-
     @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):
deleted file mode 100644
--- a/testing/marionette/client/marionette/tests/unit/test_press_release.py
+++ /dev/null
@@ -1,30 +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("testTouch.html")
-        self.marionette.navigate(testTouch)
-        button = self.marionette.find_element("id", "mozLink")
-        new_id = button.press(0, 300)
-        button.release(new_id, 0, 300)
-        time.sleep(10)
-        self.assertEqual("Clicked", self.marionette.execute_script("return document.getElementById('mozLinkPos').innerHTML;"))
-        new_id2 = button.press(0, 0)
-        button.release(new_id2, 0, 0)
-        time.sleep(10)
-        self.assertEqual("Clicked", self.marionette.execute_script("return document.getElementById('mozLink').innerHTML;"))
-
-    def test_no_coordinates(self):
-      testTouch = self.marionette.absolute_url("testTouch.html")
-      self.marionette.navigate(testTouch)
-      ele = self.marionette.find_element("id", "scroll")
-      scroll_id = ele.press()
-      ele.release(scroll_id)
-      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
@@ -42,20 +42,16 @@ b2g = false
 
 [test_timeouts.py]
 b2g = false
 
 [test_touch.py]
 b2g = true
 browser = false
 
-[test_press_release.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
@@ -1231,17 +1231,17 @@ MarionetteDriverActor.prototype = {
       }
     }
     else {
       this.sendAsync("setSearchTimeout", {value: aRequest.value,
                                           command_id: this.command_id});
     }
   },
 
-  /**
+/**
    * Set timeout for page loading, searching and scripts
    *
    * @param object aRequest
    *        'type' hold the type of timeout
    *        'ms' holds the timeout in milliseconds
    */
   timeouts: function MDA_timeouts(aRequest){
     /*setTimeout*/
@@ -1299,52 +1299,16 @@ MarionetteDriverActor.prototype = {
     }
     else {
       this.sendAsync("doubleTap", {value: serId,
                                    command_id: 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;
-    this.sendAsync("press", {value: element,
-                             corx: x,
-                             cory: y,
-                             command_id: 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;
-    this.sendAsync("release", {value: element,
-                               touchId: touchId,
-                               corx: x,
-                               cory: y,
-                               command_id: this.command_id});
-  },
-
-  /**
    * Find an element using the indicated search strategy.
    *
    * @param object aRequest
    *        'using' member indicates which search method to use
    *        'value' member is the value the client is looking for
    */
   findElement: function MDA_findElement(aRequest) {
     let command_id = this.command_id = this.getCommandId();
@@ -2056,18 +2020,16 @@ MarionetteDriverActor.prototype.requestT
   "addPerfData": MarionetteDriverActor.prototype.addPerfData,
   "getPerfData": MarionetteDriverActor.prototype.getPerfData,
   "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,
   "executeAsyncScript": MarionetteDriverActor.prototype.executeWithCallback,
   "executeJSScript": MarionetteDriverActor.prototype.executeJSScript,
   "setSearchTimeout": MarionetteDriverActor.prototype.setSearchTimeout,
   "findElement": MarionetteDriverActor.prototype.findElement,
   "findElements": MarionetteDriverActor.prototype.findElements,
   "clickElement": MarionetteDriverActor.prototype.clickElement,
   "getElementAttribute": MarionetteDriverActor.prototype.getElementAttribute,
   "getElementText": MarionetteDriverActor.prototype.getElementText,
--- a/testing/marionette/marionette-listener.js
+++ b/testing/marionette/marionette-listener.js
@@ -58,17 +58,17 @@ let originalOnError;
 //timer for doc changes
 let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
 // Send move events about this often
 let EVENT_INTERVAL = 30; // milliseconds
 // The current array of all pending touches
 let touches = [];
 // For assigning unique ids to all touches
 let nextTouchId = 1000;
-let touchIds = [];
+
 /**
  * Called when listener is first started up. 
  * The listener sends its unique window ID and its current URI to the actor.
  * If the actor returns an ID, we start the listeners. Otherwise, nothing happens.
  */
 function registerSelf() {
   let msg = {value: winUtil.outerWindowID, href: content.location.href};
   let register = sendSyncMessage("Marionette:register", msg);
@@ -99,18 +99,16 @@ function removeMessageListenerId(message
  */
 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:setSearchTimeout", setSearchTimeout);
   addMessageListenerId("Marionette:goUrl", goUrl);
   addMessageListenerId("Marionette:getUrl", getUrl);
   addMessageListenerId("Marionette:getTitle", getTitle);
   addMessageListenerId("Marionette:getPageSource", getPageSource);
   addMessageListenerId("Marionette:goBack", goBack);
   addMessageListenerId("Marionette:goForward", goForward);
   addMessageListenerId("Marionette:refresh", refresh);
@@ -190,18 +188,16 @@ function restart(msg) {
  */
 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:setSearchTimeout", setSearchTimeout);
   removeMessageListenerId("Marionette:goUrl", goUrl);
   removeMessageListenerId("Marionette:getTitle", getTitle);
   removeMessageListenerId("Marionette:getPageSource", getPageSource);
   removeMessageListenerId("Marionette:getUrl", getUrl);
   removeMessageListenerId("Marionette:goBack", goBack);
   removeMessageListenerId("Marionette:goForward", goForward);
   removeMessageListenerId("Marionette:refresh", refresh);
@@ -230,18 +226,16 @@ function deleteSession(msg) {
   removeMessageListenerId("Marionette:addCookie", addCookie);
   removeMessageListenerId("Marionette:getAllCookies", getAllCookies);
   removeMessageListenerId("Marionette:deleteAllCookies", deleteAllCookies);
   removeMessageListenerId("Marionette:deleteCookie", deleteCookie);
   this.elementManager.reset();
   // reset frame to the top-most frame
   curWindow = content;
   curWindow.focus();
-  touches = [];
-  touchIds = [];
 }
 
 /*
  * Helper methods 
  */
 
 /**
  * Generic method to send a message to the server
@@ -792,96 +786,16 @@ function doubleTap(msg) {
     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
- */
-function createATouch(el, corx, cory, id) {
-  var doc = el.ownerDocument;
-  var win = doc.defaultView;
-  if (corx == null) {
-    corx = '50%';
-  }
-  if (cory == null){
-    cory = '50%';
-  }
-  var c = coordinates(el, corx, cory);
-  var clientX = Math.round(c.x0),
-      clientY = Math.round(c.y0);
-  var pageX = clientX + win.pageXOffset,
-      pageY = clientY + win.pageYOffset;
-  var screenX = clientX + win.mozInnerScreenX,
-      screenY = clientY + win.mozInnerScreenY;
-  var atouch = doc.createTouch(win, el, id, pageX, pageY, screenX, screenY, clientX, clientY);
-  return atouch;
-}
-
-/**
- * Function to start a touch event
- */
-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;
-    }
-    var touchId = nextTouchId++;
-    var touch = createATouch(el, corx, cory, touchId);
-    emitTouchEvent('touchstart', touch);
-    touchIds.push(touchId);
-    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;
-    let currentIndex = touchIds.indexOf(id);
-    if (currentIndex != -1) {
-      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;
-      }
-      var touch = createATouch(el, corx, cory, id);
-      emitTouchEvent('touchend', touch);
-      touchIds.splice(currentIndex, 1);
-      sendOk(msg.json.command_id);
-    }
-    else {
-      sendError("Element has not be pressed: InvalidElementCoordinates", 29, null, command_id);
-      return;
-    }
-  }
-  catch (e) {
-    sendError(e.message, e.code, e.stack, msg.json.command_id);
-  }
-}
-
-/**
  * Function to set the timeout period for element searching 
  */
 function setSearchTimeout(msg) {
   try {
     elementManager.setSearchTimeout(msg.json.value);
   }
   catch (e) {
     sendError(e.message, e.code, e.stack, msg.json.command_id);