Bug 1319237 - Make GeckoDriver#setWindowPosition synchronous. r=automatedtester, a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 21 Nov 2016 23:43:35 +0100
changeset 378504 50aa351e8ffd0d70639e3da3d04eb5c64feedf41
parent 378503 74a25dd2c130358de26dac554c1907c9a59d917d
child 378505 9040530f721acf09e402a3f4d7533310a4428b5e
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester, test-only
bugs1319237
milestone53.0a2
Bug 1319237 - Make GeckoDriver#setWindowPosition synchronous. r=automatedtester, a=test-only This change makes the Set Window Position command synchronous by waiting for the original window position to change before returning. MozReview-Commit-ID: 3gOv6bNPASV
testing/marionette/driver.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -31,16 +31,17 @@ Cu.import("chrome://marionette/content/e
 Cu.import("chrome://marionette/content/interaction.js");
 Cu.import("chrome://marionette/content/l10n.js");
 Cu.import("chrome://marionette/content/legacyaction.js");
 Cu.import("chrome://marionette/content/logging.js");
 Cu.import("chrome://marionette/content/modal.js");
 Cu.import("chrome://marionette/content/proxy.js");
 Cu.import("chrome://marionette/content/session.js");
 Cu.import("chrome://marionette/content/simpletest.js");
+Cu.import("chrome://marionette/content/wait.js");
 
 this.EXPORTED_SYMBOLS = ["GeckoDriver", "Context"];
 
 var FRAME_SCRIPT = "chrome://marionette/content/listener.js";
 const BROWSER_STARTUP_FINISHED = "browser-delayed-startup-finished";
 const CLICK_TO_START_PREF = "marionette.debugging.clicktostart";
 const CONTENT_LISTENER_PREF = "marionette.contentListener";
 
@@ -1171,25 +1172,29 @@ GeckoDriver.prototype.getWindowPosition 
  *     moved to.
  * @param {number} y
  *     Y coordinate of the top/left of the window that it will be
  *     moved to.
  *
  * @return {Object.<string, number>}
  *     Object with |x| and |y| coordinates.
  */
-GeckoDriver.prototype.setWindowPosition = function (cmd, resp) {
+GeckoDriver.prototype.setWindowPosition = function* (cmd, resp) {
   assert.firefox()
 
   let {x, y} = cmd.parameters;
   assert.positiveInteger(x);
   assert.positiveInteger(y);
 
   let win = this.getCurrentWindow();
+  let orig = {screenX: win.screenX, screenY: win.screenY};
+
   win.moveTo(x, y);
+  yield wait.until(() => win.screenX != orig.screenX ||
+      win.screenY != orig.screenY);
 
   return this.curBrowser.position;
 };
 
 /**
  * Switch current top-level browsing context by name or server-assigned ID.
  * Searches for windows by name, then ID.  Content windows take precedence.
  *