Bug 1348145 - Remove getWindowPosition/setWindowPosition and getWindowSize/setWindowSize. draft
authorVenkatesh Pitta <venkateshpitta@gmail.com>
Sat, 02 Jun 2018 09:14:06 +1000
changeset 803204 c2b709552c2f342a33598fdfd5488903e0345b1b
parent 792871 0cd106a2eb78aa04fd481785257e6f4f9b94707b
push id112043
push userbmo:venkateshpitta@gmail.com
push dateSat, 02 Jun 2018 01:04:54 +0000
bugs1348145
milestone62.0a1
Bug 1348145 - Remove getWindowPosition/setWindowPosition and getWindowSize/setWindowSize. MozReview-Commit-ID: AUxPhJwOKB6
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/driver.js
testing/marionette/harness/marionette_harness/tests/unit/test_window_maximize.py
testing/marionette/harness/marionette_harness/tests/unit/test_window_minimize.py
testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -7,17 +7,16 @@ from __future__ import absolute_import
 import base64
 import datetime
 import json
 import os
 import socket
 import sys
 import time
 import traceback
-import warnings
 
 from contextlib import contextmanager
 
 from six import reraise
 
 from . import errors
 from . import transport
 from .decorators import do_process_check
@@ -1313,35 +1312,16 @@ class Marionette(object):
         :returns: unique window handle
         :rtype: string
         """
         self.chrome_window = self._send_message("WebDriver:GetChromeWindowHandle",
                                                 key="value")
 
         return self.chrome_window
 
-    def get_window_position(self):
-        """Get the current window's position.
-
-        :returns: a dictionary with x and y
-        """
-        warnings.warn("get_window_position() has been deprecated, please use get_window_rect()",
-                      DeprecationWarning)
-        return self._send_message("getWindowPosition")
-
-    def set_window_position(self, x, y):
-        """Set the position of the current window
-
-        :param x: x coordinate for the top left of the window
-        :param y: y coordinate for the top left of the window
-        """
-        warnings.warn("set_window_position() has been deprecated, please use set_window_rect()",
-                      DeprecationWarning)
-        self._send_message("setWindowPosition", {"x": x, "y": y})
-
     def set_window_rect(self, x=None, y=None, height=None, width=None):
         """Set the position and size of the current window.
 
         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 maximised state.
@@ -1982,49 +1962,16 @@ class Marionette(object):
         :param orientation: The orientation to lock the screen in.
         """
         body = {"orientation": orientation}
         try:
             self._send_message("Marionette:SetScreenOrientation", body)
         except errors.UnknownCommandException:
             self._send_message("setScreenOrientation", body)
 
-    @property
-    def window_size(self):
-        """Get the current browser window size.
-
-        Will return the current browser window size in pixels. Refers to
-        window outerWidth and outerHeight values, which include scroll bars,
-        title bars, etc.
-
-        :returns: Window rect.
-        """
-        warnings.warn("window_size property has been deprecated, please use get_window_rect()",
-                      DeprecationWarning)
-        return self._send_message("getWindowSize")
-
-    def set_window_size(self, width, height):
-        """Resize the browser window currently in focus.
-
-        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 maximised state.
-
-        :param width: The width to resize the window to.
-        :param height: The height to resize the window to.
-
-        :returns Window rect.
-        """
-        warnings.warn("set_window_size() has been deprecated, please use set_window_rect()",
-                      DeprecationWarning)
-        body = {"width": width, "height": height}
-        return self._send_message("setWindowSize", body)
-
     def minimize_window(self):
         """Iconify the browser window currently receiving commands.
         The action should be equivalent to the user pressing the minimize
         button in the OS window.
 
         Note that this command is not available on Fennec.  It may also
         not be available in certain window managers.
 
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -3613,35 +3613,31 @@ GeckoDriver.prototype.commands = {
   "get": GeckoDriver.prototype.get,
   "getPageSource": GeckoDriver.prototype.getPageSource,
   "getSessionCapabilities": GeckoDriver.prototype.getSessionCapabilities,
   "getTextFromDialog": GeckoDriver.prototype.getTextFromDialog,
   "getTimeouts": GeckoDriver.prototype.getTimeouts,
   "getTitle": GeckoDriver.prototype.getTitle,
   "getWindowHandle": GeckoDriver.prototype.getWindowHandle,
   "getWindowHandles": GeckoDriver.prototype.getWindowHandles,
-  "getWindowPosition": GeckoDriver.prototype.getWindowRect, // redirect for compatibility
   "getWindowRect": GeckoDriver.prototype.getWindowRect,
-  "getWindowSize": GeckoDriver.prototype.getWindowRect, // redirect for compatibility
   "goBack": GeckoDriver.prototype.goBack,
   "goForward": GeckoDriver.prototype.goForward,
   "isElementDisplayed": GeckoDriver.prototype.isElementDisplayed,
   "isElementEnabled": GeckoDriver.prototype.isElementEnabled,
   "isElementSelected": GeckoDriver.prototype.isElementSelected,
   "maximizeWindow": GeckoDriver.prototype.maximizeWindow,
   "newSession": GeckoDriver.prototype.newSession,
   "performActions": GeckoDriver.prototype.performActions,
   "refresh":  GeckoDriver.prototype.refresh,
   "releaseActions": GeckoDriver.prototype.releaseActions,
   "sendKeysToDialog": GeckoDriver.prototype.sendKeysToDialog,
   "sendKeysToElement": GeckoDriver.prototype.sendKeysToElement,
   "setTimeouts": GeckoDriver.prototype.setTimeouts,
-  "setWindowPosition": GeckoDriver.prototype.setWindowRect, // redirect for compatibility
   "setWindowRect": GeckoDriver.prototype.setWindowRect,
-  "setWindowSize": GeckoDriver.prototype.setWindowRect, // redirect for compatibility
   "switchToFrame": GeckoDriver.prototype.switchToFrame,
   "switchToParentFrame": GeckoDriver.prototype.switchToParentFrame,
   "switchToShadowRoot": GeckoDriver.prototype.switchToShadowRoot,
   "switchToWindow": GeckoDriver.prototype.switchToWindow,
   "takeScreenshot": GeckoDriver.prototype.takeScreenshot,
 };
 
 function getOuterWindowId(win) {
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_maximize.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_maximize.py
@@ -13,27 +13,27 @@ class TestWindowMaximize(MarionetteTestC
         MarionetteTestCase.setUp(self)
         self.max = self.marionette.execute_script("""
             return {
               width: window.screen.availWidth,
               height: window.screen.availHeight,
             }""", sandbox=None)
 
         # ensure window is not maximized
-        self.marionette.set_window_size(
-            self.max["width"] - 100, self.max["height"] - 100)
-        actual = self.marionette.window_size
+        self.marionette.set_window_rect(
+            width=self.max["width"] - 100, height=self.max["height"] - 100)
+        actual = self.marionette.window_rect
         self.assertNotEqual(actual["width"], self.max["width"])
         self.assertNotEqual(actual["height"], self.max["height"])
 
         self.original_size = actual
 
     def tearDown(self):
-        self.marionette.set_window_size(
-            self.original_size["width"], self.original_size["height"])
+        self.marionette.set_window_rect(
+            width=self.original_size["width"], height=self.original_size["height"])
 
     def assert_window_maximized(self, actual, delta=None):
         if self.marionette.session_capabilities["platformName"] == "windows_nt":
             delta = 16
         else:
             delta = 22
 
         self.assertGreaterEqual(
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_minimize.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_minimize.py
@@ -8,17 +8,17 @@ from marionette_driver.errors import Inv
 
 from marionette_harness import MarionetteTestCase
 
 class TestWindowMinimize(MarionetteTestCase):
 
     def setUp(self):
         MarionetteTestCase.setUp(self)
 
-        self.original_size = self.marionette.window_size
+        self.original_size = self.marionette.window_rect
 
     def is_minimized(self):
         return self.marionette.execute_script("return document.hidden", sandbox=None)
 
     def assert_window_minimized(self, resp):
         self.assertEqual("minimized", resp["state"])
 
     def assert_window_restored(self, actual):
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
@@ -3,74 +3,160 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function
 
 from marionette_driver.errors import InvalidArgumentException
 from marionette_harness import MarionetteTestCase
 
 
-class TestPosition(MarionetteTestCase):
+class TestWindowRect(MarionetteTestCase):
 
     def setUp(self):
-        MarionetteTestCase.setUp(self)
-        self.original_position = self.marionette.get_window_position()
+        super(TestWindowRect, self).setUp()
+
+        self.original_rect = self.marionette.window_rect
+
+        self.max = self.marionette.execute_script("""
+            return {
+              width: window.screen.availWidth,
+              height: window.screen.availHeight,
+            }""", sandbox=None)
+
+        # WebDriver spec says a resize cannot result in window being
+        # maximised, an error is returned if that is the case; therefore if
+        # the window is maximised at the start of this test, returning to
+        # the original size via set_window_rect size will result in error;
+        # so reset to original size minus 1 pixel width
+        start_size = {"height": self.original_rect["height"], "width": self.original_rect["width"]}
+        if start_size["width"] == self.max["width"] and start_size["height"] == self.max["height"]:
+            start_size["width"] -= 10
+            start_size["height"] -= 10
+        self.marionette.set_window_rect(height=start_size["height"], width=start_size["width"])
 
     def tearDown(self):
-        x, y = self.original_position["x"], self.original_position["y"]
-        self.marionette.set_window_position(x, y)
-        MarionetteTestCase.tearDown(self)
+        x, y = self.original_rect["x"], self.original_rect["y"]
+        height, width = self.original_rect["height"], self.original_rect["width"]
+
+        self.marionette.set_window_rect(x=x, y=y, height=height, width=width)
+
+        is_fullscreen = self.marionette.execute_script("return document.fullscreenElement;", sandbox=None)
+        if is_fullscreen:
+            self.marionette.fullscreen()
+
+        super(TestWindowRect, self).tearDown()
 
     def test_get_types(self):
-        position = self.marionette.get_window_position()
-        self.assertIn("x", position)
-        self.assertIn("y", position)
-        self.assertIsInstance(position["x"], int)
-        self.assertIsInstance(position["y"], int)
+        rect = self.marionette.window_rect
+        self.assertIn("x", rect)
+        self.assertIn("y", rect)
+        self.assertIn("height", rect)
+        self.assertIn("width", rect)
+        self.assertIsInstance(rect["x"], int)
+        self.assertIsInstance(rect["y"], int)
+        self.assertIsInstance(rect["height"], int)
+        self.assertIsInstance(rect["width"], int)
 
     def test_set_types(self):
-        for x, y in (["a", "b"], [1.2, 3.4], [True, False], [[], []], [{}, {}]):
+        invalid_rects = (["a", "b", "h", "w"],
+                         [1.2, 3.4, 4.5, 5.6],
+                         [True, False, True, False],
+                         [[], [], [], []],
+                         [{}, {}, {}, {}])
+        for x, y, h, w in invalid_rects:
             print("testing invalid type position ({},{})".format(x, y))
             with self.assertRaises(InvalidArgumentException):
-                self.marionette.set_window_position(x, y)
+                self.marionette.set_window_rect(x=x, y=y, height=h, width=w)
 
     def test_setting_window_rect_with_nulls_errors(self):
         with self.assertRaises(InvalidArgumentException):
             self.marionette.set_window_rect(height=None, width=None,
                                             x=None, y=None)
 
-    def test_set_position_with_rect(self):
+    def test_set_position(self):
         old_position = self.marionette.window_rect
         wanted_position = {"x": old_position["x"] + 10, "y": old_position["y"] + 10}
 
         new_position = self.marionette.set_window_rect(x=wanted_position["x"], y=wanted_position["y"])
+        expected_position = self.marionette.window_rect
 
-        self.assertNotEqual(old_position["x"], new_position["x"])
-        self.assertNotEqual(old_position["y"], new_position["y"])
+        self.assertEqual(new_position["x"], wanted_position["x"])
+        self.assertEqual(new_position["y"], wanted_position["y"])
+        self.assertEqual(new_position["x"], expected_position["x"])
+        self.assertEqual(new_position["y"], expected_position["y"])
+
+    def test_set_size(self):
+        old_size = self.marionette.window_rect
+        wanted_size = {"height": old_size["height"] - 50, "width": old_size["width"] - 50}
+
+        new_size = self.marionette.set_window_rect(height=wanted_size["height"], width=wanted_size["width"])
+        expected_size = self.marionette.window_rect
+
+        self.assertEqual(new_size["width"], wanted_size["width"],
+                         "New width is {0} but should be {1}".format(new_size["width"], wanted_size["width"]))
+        self.assertEqual(new_size["height"], wanted_size["height"],
+                         "New height is {0} but should be {1}".format(new_size["height"], wanted_size["height"]))
+        self.assertEqual(new_size["width"], expected_size["width"],
+                         "New width is {0} but should be {1}".format(new_size["width"], expected_size["width"]))
+        self.assertEqual(new_size["height"], expected_size["height"],
+                         "New height is {0} but should be {1}".format(new_size["height"], expected_size["height"]))
+
+    def test_set_position_and_size(self):
+        old_rect = self.marionette.window_rect
+        wanted_rect = {"x": old_rect["x"] + 10, "y": old_rect["y"] + 10,
+                       "width": old_rect["width"] - 50, "height": old_rect["height"] - 50}
+
+        new_rect = self.marionette.set_window_rect(x=wanted_rect["x"], y=wanted_rect["y"],
+                                                   width=wanted_rect["width"], height=wanted_rect["height"])
+        expected_rect = self.marionette.window_rect
 
-    def test_move_to_new_position(self):
-        old_position = self.marionette.get_window_position()
-        new_position = {"x": old_position["x"] + 10, "y": old_position["y"] + 10}
-        self.marionette.set_window_position(new_position["x"], new_position["y"])
-        self.assertNotEqual(old_position["x"], new_position["x"])
-        self.assertNotEqual(old_position["y"], new_position["y"])
+        self.assertEqual(new_rect["x"], wanted_rect["x"])
+        self.assertEqual(new_rect["y"], wanted_rect["y"])
+        self.assertEqual(new_rect["width"], wanted_rect["width"],
+                         "New width is {0} but should be {1}".format(new_rect["width"], wanted_rect["width"]))
+        self.assertEqual(new_rect["height"], wanted_rect["height"],
+                         "New height is {0} but should be {1}".format(new_rect["height"], wanted_rect["height"]))
+        self.assertEqual(new_rect["x"], expected_rect["x"])
+        self.assertEqual(new_rect["y"], expected_rect["y"])
+        self.assertEqual(new_rect["width"], expected_rect["width"],
+                         "New width is {0} but should be {1}".format(new_rect["width"], expected_rect["width"]))
+        self.assertEqual(new_rect["height"], expected_rect["height"],
+                         "New height is {0} but should be {1}".format(new_rect["height"], expected_rect["height"]))
+
+    def test_move_to_current_position(self):
+        old_position = self.marionette.window_rect
+        new_position = self.marionette.set_window_rect(x=old_position["x"], y=old_position["y"])
 
-    def test_move_to_existing_position(self):
-        old_position = self.marionette.get_window_position()
-        self.marionette.set_window_position(old_position["x"], old_position["y"])
-        new_position = self.marionette.get_window_position()
-        self.assertEqual(old_position["x"], new_position["x"])
-        self.assertEqual(old_position["y"], new_position["y"])
+        self.assertEqual(new_position["x"], old_position["x"])
+        self.assertEqual(new_position["y"], old_position["y"])
+
+    def test_move_to_current_size(self):
+        old_size = self.marionette.window_rect
+        new_size = self.marionette.set_window_rect(height=old_size["height"], width=old_size["width"])
+
+        self.assertEqual(new_size["height"], old_size["height"])
+        self.assertEqual(new_size["width"], old_size["width"])
+
+    def test_move_to_current_position_and_size(self):
+        old_position_and_size = self.marionette.window_rect
+        new_position_and_size = self.marionette.set_window_rect(x=old_position_and_size["x"], y=old_position_and_size["y"],
+                                                                height=old_position_and_size["height"], width=old_position_and_size["width"])
+
+        self.assertEqual(new_position_and_size["x"], old_position_and_size["x"])
+        self.assertEqual(new_position_and_size["y"], old_position_and_size["y"])
+        self.assertEqual(new_position_and_size["width"], old_position_and_size["width"])
+        self.assertEqual(new_position_and_size["height"], old_position_and_size["height"])
 
     def test_move_to_negative_coordinates(self):
+        old_position = self.marionette.window_rect
         print("Current position: {}".format(
-            self.marionette.get_window_position()))
-        self.marionette.set_window_position(-8, -8)
-        position = self.marionette.get_window_position()
-        print("Position after requesting move to negative coordinates: {}".format(position))
+            old_position["x"], old_position["y"]))
+        new_position = self.marionette.set_window_rect(x=-8, y=-8)
+        print("Position after requesting move to negative coordinates: {}, {}"
+              .format(new_position["x"], new_position["y"]))
 
         # Different systems will report more or less than (-8,-8)
         # depending on the characteristics of the window manager, since
         # the screenX/screenY position measures the chrome boundaries,
         # including any WM decorations.
         #
         # This makes this hard to reliably test across different
         # environments.  Generally we are happy when calling
@@ -81,132 +167,65 @@ class TestPosition(MarionetteTestCase):
         # the following assertions are the most common denominator that
         # make this test pass, irregardless of system characteristics.
 
         os = self.marionette.session_capabilities["platformName"]
 
         # Regardless of platform, headless always supports being positioned
         # off-screen.
         if self.marionette.session_capabilities["moz:headless"]:
-            self.assertEqual(-8, position["x"])
-            self.assertEqual(-8, position["y"])
+            self.assertEqual(-8, new_position["x"])
+            self.assertEqual(-8, new_position["y"])
 
         # Certain WMs prohibit windows from being moved off-screen,
         # but we don't have this information.  It should be safe to
         # assume a window can be moved to (0,0) or less.
         elif os == "linux":
             # certain WMs prohibit windows from being moved off-screen
-            self.assertLessEqual(position["x"], 0)
-            self.assertLessEqual(position["y"], 0)
+            self.assertLessEqual(new_position["x"], 0)
+            self.assertLessEqual(new_position["y"], 0)
 
         # On macOS, windows can only be moved off the screen on the
         # horizontal axis.  The system menu bar also blocks windows from
         # being moved to (0,0).
         elif os == "darwin":
-            self.assertEqual(-8, position["x"])
-            self.assertEqual(23, position["y"])
+            self.assertEqual(-8, new_position["x"])
+            self.assertEqual(23, new_position["y"])
 
         # It turns out that Windows is the only platform on which the
         # window can be reliably positioned off-screen.
         elif os == "windows_nt":
-            self.assertEqual(-8, position["x"])
-            self.assertEqual(-8, position["y"])
-
-
-class TestSize(MarionetteTestCase):
-
-    def setUp(self):
-        super(MarionetteTestCase, self).setUp()
-        self.max = self.marionette.execute_script("""
-            return {
-              width: window.screen.availWidth,
-              height: window.screen.availHeight,
-            }""", sandbox=None)
-
-        # WebDriver spec says a resize cannot result in window being
-        # maximised, an error is returned if that is the case; therefore if
-        # the window is maximised 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
-        start_size = self.marionette.window_size
-        if start_size["width"] == self.max["width"] and start_size["height"] == self.max["height"]:
-            start_size["width"] -= 10
-            start_size["height"] -= 10
-        self.marionette.set_window_size(start_size["width"], start_size["height"])
-
-        self.original_size = self.marionette.window_size
-
-    def tearDown(self):
-        self.marionette.set_window_size(
-            self.original_size["width"], self.original_size["height"])
-        is_fullscreen = self.marionette.execute_script("return document.fullscreenElement;", sandbox=None)
-        if is_fullscreen:
-            self.marionette.fullscreen()
-        super(MarionetteTestCase, self).tearDown()
-
-    def test_get_types(self):
-        size = self.marionette.window_size
-        self.assertIn("width", size)
-        self.assertIn("height", size)
-        self.assertIsInstance(size["width"], int)
-        self.assertIsInstance(size["height"], int)
-
-    def test_set_types(self):
-        for width, height in (["a", "b"], [1.2, 3.4], [True, False], [[], []], [{}, {}]):
-            print("testing invalid type size ({},{})".format(width, height))
-            with self.assertRaises(InvalidArgumentException):
-                self.marionette.set_window_size(width, height)
-
-    def test_setting_window_rect_with_nulls_errors(self):
-        with self.assertRaises(InvalidArgumentException):
-            self.marionette.set_window_rect(height=None, width=None,
-                                            x=None, y=None)
-
-    def test_set_size_with_rect(self):
-        actual = self.marionette.window_size
-        width = actual["width"] - 50
-        height = actual["height"] - 50
-
-        size = self.marionette.set_window_rect(width=width, height=height)
-        self.assertEqual(size["width"], width,
-                         "New width is {0} but should be {1}".format(size["width"], width))
-        self.assertEqual(size["height"], height,
-                         "New height is {0} but should be {1}".format(size["height"], height))
-
-    def test_resize_to_new_size(self):
-        old = self.marionette.window_size
-        new = {"width": old["width"] + 10, "height": old["height"] + 10}
-        self.marionette.set_window_size(new["width"], new["height"])
-        actual = self.marionette.window_size
-        self.assertEqual(actual["width"], new["width"])
-        self.assertEqual(actual["height"], new["height"])
-
-    def test_resize_to_existing_size(self):
-        old = self.marionette.window_size
-        self.marionette.set_window_size(old["width"], old["height"])
-        new = self.marionette.window_size
-        self.assertEqual(old["width"], new["width"])
-        self.assertEqual(old["height"], new["height"])
+            self.assertEqual(-8, new_position["x"])
+            self.assertEqual(-8, new_position["y"])
 
     def test_resize_larger_than_screen(self):
-        self.marionette.set_window_size(
-            self.max["width"] * 2, self.max["height"] * 2)
-        new = self.marionette.window_size
+        new_size = self.marionette.set_window_rect(
+            width=self.max["width"] * 2, height=self.max["height"] * 2)
+        actual_size = self.marionette.window_rect
 
         # in X the window size may be greater than the bounds of the screen
-        self.assertGreaterEqual(new["width"], self.max["width"])
-        self.assertGreaterEqual(new["height"], self.max["height"])
+        self.assertGreaterEqual(new_size["width"], self.max["width"])
+        self.assertGreaterEqual(new_size["height"], self.max["height"])
+        self.assertEqual(actual_size["width"], new_size["width"])
+        self.assertEqual(actual_size["height"], new_size["height"])
 
     def test_resize_to_available_screen_size(self):
-        result = self.marionette.set_window_rect(width=self.max['width'],
-                                                 height=self.max["height"])
-        self.assertEqual(result["width"], self.max["width"])
-        self.assertEqual(result["height"], self.max["height"])
+        expected_size = self.marionette.set_window_rect(width=self.max["width"],
+                                                        height=self.max["height"])
+        result_size = self.marionette.window_rect
+
+        self.assertGreaterEqual(expected_size["width"], self.max["width"])
+        self.assertGreaterEqual(expected_size["height"], self.max["height"])
+        self.assertEqual(result_size["width"], expected_size["width"])
+        self.assertEqual(result_size["height"], expected_size["height"])
 
     def test_resize_while_fullscreen(self):
         self.marionette.fullscreen()
-        result = self.marionette.set_window_rect(width=self.max["width"] - 100,
-                                                 height=self.max["height"] - 100)
+        expected_size = self.marionette.set_window_rect(width=self.max["width"] - 100,
+                                                        height=self.max["height"] - 100)
+        result_size = self.marionette.window_rect
 
         self.assertTrue(self.marionette.execute_script("return window.fullscreenElement == null",
                                                         sandbox=None))
-        self.assertEqual(result["width"], self.max["width"] - 100)
-        self.assertEqual(result["height"], self.max["height"] - 100)
+        self.assertEqual(self.max["width"] - 100, expected_size["width"])
+        self.assertEqual(self.max["height"] - 100, expected_size["height"])
+        self.assertEqual(result_size["width"], expected_size["width"])
+        self.assertEqual(result_size["height"], expected_size["height"])