Bug 1271636 - Clarify language in error for GeckoDriver#setWindowSize; r=automatedtester a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Wed, 18 May 2016 11:35:20 +0100
changeset 333244 023770b1ecf103178726e4b69e5e88dead4ceb44
parent 333243 d41dfe6fd3350c8a09e4a4bc3fe78d18749035ab
child 333245 a4ff8afa88829ecb0410cbd51b34028fd738c8c8
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)
reviewersautomatedtester, test-only
bugs1271636
milestone48.0a2
Bug 1271636 - Clarify language in error for GeckoDriver#setWindowSize; r=automatedtester a=test-only MozReview-Commit-ID: 6YhiDKdtFcT
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
@@ -2443,18 +2443,18 @@ GeckoDriver.prototype.setWindowSize = fu
   if (this.appName != "Firefox") {
     throw new UnsupportedOperationError();
   }
 
   let width = parseInt(cmd.parameters.width);
   let height = parseInt(cmd.parameters.height);
 
   let win = this.getCurrentWindow();
-  if (width >= win.screen.availWidth && height >= win.screen.availHeight) {
-    throw new UnsupportedOperationError("Invalid requested size, cannot maximize");
+  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.
--- a/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_set_window_size.py
@@ -1,15 +1,16 @@
 # 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/.
 
-from marionette_driver.errors import MarionetteException
+from marionette_driver.errors import UnsupportedOperationException
 from marionette import MarionetteTestCase
 
+
 class TestSetWindowSize(MarionetteTestCase):
     def setUp(self):
         super(MarionetteTestCase, self).setUp()
         self.start_size = self.marionette.window_size
         self.max_width = self.marionette.execute_script("return window.screen.availWidth;")
         self.max_height = self.marionette.execute_script("return window.screen.availHeight;")
 
     def tearDown(self):
@@ -43,17 +44,17 @@ class TestSetWindowSize(MarionetteTestCa
                          "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(MarionetteException, "Invalid requested size"):
+        with self.assertRaisesRegexp(UnsupportedOperationException, "Requested size exceeds screen size"):
             self.marionette.set_window_size(self.max_width, self.max_height)
         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")
 
     def test_that_we_can_maximise_the_window(self):
         # valid size
         width = self.max_width - 100