Bug 1280101 - Remove check for window sizes larger than screen; r?automatedtester draft
authorAndreas Tolfsen <ato@mozilla.com>
Tue, 14 Jun 2016 18:58:15 +0100
changeset 380228 29b979d401e583e0a4c1af7d830bf83438ce76f7
parent 380227 59cdaa8ed114f94cc5bb1c1ecc0c4edf13419ddb
child 523678 1963719f6d0b299dd49759cf984fa0e790010a6c
push id21171
push userbmo:ato@mozilla.com
push dateTue, 21 Jun 2016 08:19:42 +0000
reviewersautomatedtester
bugs1280101
milestone50.0a1
Bug 1280101 - Remove check for window sizes larger than screen; r?automatedtester MozReview-Commit-ID: K2l0pPfGbGp
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
@@ -2476,33 +2476,24 @@ GeckoDriver.prototype.getWindowSize = fu
 };
 
 /**
  * Set the size of the browser window currently in focus.
  *
  * Not supported on B2G. The supplied width and height values refer to
  * the window outerWidth and outerHeight values, which include scroll
  * bars, title bars, etc.
- *
- * An error will be returned if the requested window size would result
- * in the window being in the maximized state.
  */
 GeckoDriver.prototype.setWindowSize = function(cmd, resp) {
   if (this.appName != "Firefox") {
     throw new UnsupportedOperationError();
   }
 
-  let width = cmd.parameters.width;
-  let height = cmd.parameters.height;
-
+  let {width, height} = cmd.parameters;
   let win = this.getCurrentWindow();
-  if (width >= win.screen.availWidth || height >= win.screen.availHeight) {
-    throw new UnsupportedOperationError("Requested size exceeds screen size")
-  }
-
   win.resizeTo(width, height);
 };
 
 /**
  * Maximizes the user agent window as if the user pressed the maximise
  * button.
  *
  * Not Supported on B2G or Fennec.
--- a/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py
@@ -38,27 +38,23 @@ class TestSetWindowSize(MarionetteTestCa
         self.marionette.set_window_size(width, height)
         self.wait_for_condition(lambda m: m.execute_script("return window.wrappedJSObject.rcvd_event;"))
         size = self.marionette.window_size
         self.assertEqual(size['width'], width,
                          "Window width is %s but should be %s" % (size['width'], width))
         self.assertEqual(size['height'], height,
                          "Window height is %s but should be %s" % (size['height'], height))
 
-    def test_that_we_throw_an_error_when_trying_to_set_maximum_size(self):
-        # valid size
-        width = self.max_width - 100
-        height = self.max_height - 100
-        self.marionette.set_window_size(width, height)
-        # invalid size (cannot maximize)
-        with self.assertRaisesRegexp(UnsupportedOperationException, "Requested size exceeds screen size"):
-            self.marionette.set_window_size(self.max_width, self.max_height)
+    def test_possible_to_request_window_larger_than_screen(self):
+        self.marionette.set_window_size(100000, 100000)
         size = self.marionette.window_size
-        self.assertEqual(size['width'], width, "Window width should not have changed")
-        self.assertEqual(size['height'], height, "Window height should not have changed")
+
+        # In X the window size may be greater than the bounds of the screen
+        self.assertGreaterEqual(size["width"], self.max_width)
+        self.assertGreaterEqual(size["height"], self.max_height)
 
     def test_that_we_can_maximise_the_window(self):
         # valid size
         width = self.max_width - 100
         height = self.max_height - 100
         self.marionette.set_window_size(width, height)
 
         # event handler