Bug 1258316 - Have marionette call maximize() on window instead of resize r=ato a=test-only
authorDavid Burns <dburns@mozilla.com>
Fri, 06 May 2016 21:15:13 +0100
changeset 333233 58cc44dac6d5a6e4d39a494401c18ac7cdc8a40a
parent 333232 31d4316fa44cc0e9b1cf661b7000cc8dc5093b62
child 333234 ba30a69fed983e083be59ac9c273b2dc6ec3f59e
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1258316
milestone48.0a2
Bug 1258316 - Have marionette call maximize() on window instead of resize r=ato a=test-only 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))