Bug 1258316 - Have marionette call maximize() on window instead of resize r?ato draft
authorDavid Burns <dburns@mozilla.com>
Fri, 06 May 2016 21:15:13 +0100
changeset 364591 2932b36ceb845e7433c0fb932ae46dd8986e31de
parent 364590 5f07c60b78ece809b08717944de74b8563ff3ab6
child 520325 75a57c8455dc214575d186e98f956045d2d769fa
push id17498
push userdburns@mozilla.com
push dateFri, 06 May 2016 22:47:02 +0000
reviewersato
bugs1258316
milestone49.0a1
Bug 1258316 - Have marionette call maximize() on window instead of resize r?ato This allows use to be able restore the window size if we wanted to. MozReview-Commit-ID: Kx3JH1UroI2
testing/marionette/driver.js
testing/marionette/harness/marionette/tests/unit/test_set_window_size.py
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2664,18 +2664,17 @@ GeckoDriver.prototype.setWindowSize = fu
  * Not Supported on B2G or Fennec.
  */
 GeckoDriver.prototype.maximizeWindow = function(cmd, resp) {
   if (this.appName != "Firefox") {
     throw new UnsupportedOperationError();
   }
 
   let win = this.getCurrentWindow();
-  win.moveTo(0,0);
-  win.resizeTo(win.screen.availWidth, win.screen.availHeight);
+  win.maximize()
 };
 
 /**
  * Dismisses a currently displayed tab modal, or returns no such alert if
  * no modal is displayed.
  */
 GeckoDriver.prototype.dismissDialog = function(cmd, resp) {
   if (!this.dialog) {
--- a/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py
@@ -66,10 +66,12 @@ class TestSetWindowSize(MarionetteTestCa
         window.onresize = function() {
             window.wrappedJSObject.rcvd_event = true;
         };
         """)
         self.marionette.maximize_window()
         self.wait_for_condition(lambda m: m.execute_script("return window.wrappedJSObject.rcvd_event;"))
 
         size = self.marionette.window_size
-        self.assertEqual(size['width'], self.max_width, "Window width does not use availWidth")
-        self.assertEqual(size['height'], self.max_height, "Window height does not use availHeight")
+        self.assertGreaterEqual(size['width'], self.max_width,
+                         "Window width does not use availWidth, current width: {0}, max width: {1}".format(size['width'], self.max_width))
+        self.assertGreaterEqual(size['height'], self.max_height,
+                         "Window height does not use availHeight. current width: {0}, max width: {1}".format(size['height'], self.max_height))