Bug 1064421: Clean up setWindowSize tests and add support for Fennec; r=jgriffin
authorDavid Burns <dburns@mozilla.com>
Fri, 19 Sep 2014 00:26:54 +0100
changeset 206117 ca7e71c15c4f1b302df06994695e049b8741e89f
parent 206116 245051c6a7ede4ddedb24d6a58b25bf4f8132026
child 206118 14fc678064b3d0a784198f81a9659caa9c2e2449
push id27513
push usercbook@mozilla.com
push dateFri, 19 Sep 2014 12:15:35 +0000
treeherdermozilla-central@dadafedc0760 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs1064421
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1064421: Clean up setWindowSize tests and add support for Fennec; r=jgriffin
testing/marionette/client/marionette/tests/unit/test_set_window_size.py
testing/marionette/marionette-server.js
--- a/testing/marionette/client/marionette/tests/unit/test_set_window_size.py
+++ b/testing/marionette/client/marionette/tests/unit/test_set_window_size.py
@@ -17,17 +17,17 @@ class TestSetWindowSize(MarionetteTestCa
         # error is returned if that is the case; therefore if the window is maximized
         # at the start of this test, returning to the original size via set_window_size
         # size will result in error; so reset to original size minus 1 pixel width
         if self.start_size['width'] == self.max_width and self.start_size['height'] == self.max_height:
             self.start_size['width']-=1
         self.marionette.set_window_size(self.start_size['width'], self.start_size['height'])
         super(MarionetteTestCase, self).tearDown()
 
-    def test_set_window_size(self):
+    def test_that_we_can_get_and_set_window_size(self):
         # event handler
         self.marionette.execute_script("""
         window.wrappedJSObject.rcvd_event = false;
         window.onresize = function() {
             window.wrappedJSObject.rcvd_event = true;
         };
         """)
 
@@ -37,14 +37,19 @@ 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(MarionetteException, "Invalid requested 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")
--- a/testing/marionette/marionette-server.js
+++ b/testing/marionette/marionette-server.js
@@ -2415,18 +2415,18 @@ MarionetteServerConnection.prototype = {
    * bars, title bars, etc.
    *
    * An error will be returned if the requested window size would result
    * in the window being in the maximized state.
    */
   setWindowSize: function MDA_setWindowSize(aRequest) {
     this.command_id = this.getCommandId();
 
-    if (appName == "B2G") {
-      this.sendError("Not supported on B2G", 405, null, this.command_id);
+    if (appName !== "Firefox") {
+      this.sendError("Not supported on mobile", 405, null, this.command_id);
       return;
     }
 
     try {
       var width = parseInt(aRequest.parameters.width);
       var height = parseInt(aRequest.parameters.height);
     }
     catch(e) {