Bug 1348145 - Remove getWindowPosition/setWindowPosition and getWindowSize/setWindowSize. r?whimboo draft
authorVenkatesh Pitta <venkateshpitta@gmail.com>
Sat, 05 May 2018 12:07:59 +1000
changeset 791734 c67f57149843e0d9b5ede442061d99e3fbab5ba6
parent 791733 fc76042d6f445780c52470838a69fcb43a44e3d9
push id108892
push userbmo:venkateshpitta@gmail.com
push dateSat, 05 May 2018 02:49:46 +0000
reviewerswhimboo
bugs1348145
milestone61.0a1
Bug 1348145 - Remove getWindowPosition/setWindowPosition and getWindowSize/setWindowSize. r?whimboo MozReview-Commit-ID: HjUb2YLKRFy
testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_rect.py
@@ -117,44 +117,42 @@ class TestWindowRect(MarionetteTestCase)
         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 = self.marionette.window_rect
-        self.marionette.set_window_rect(x=old["x"], y=old["y"])
+        old_position = self.marionette.window_rect
 
-        new = self.marionette.window_rect
+        new_position = self.marionette.set_window_rect(x=old_position["x"], y=old_position["y"])
 
-        self.assertEqual(new["x"], old["x"])
-        self.assertEqual(new["y"], old["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 = self.marionette.window_rect
-        self.marionette.set_window_rect(height=old["height"], width=old["width"])
+        old_size = self.marionette.window_rect
 
-        new = self.marionette.window_rect
+        new = self.marionette.set_window_rect(height=old_size["height"], width=old_size["width"])
 
-        self.assertEqual(new["height"], old["height"])
-        self.assertEuqal(new["width"], old["width"])
+        self.assertEqual(new_position["height"], old_position["height"])
+        self.assertEuqal(new_position["width"], old_position["width"])
 
     def test_move_to_current_position_and_size(self):
-        old = self.marionette.window_rect
-        self.marionette.set_window_rect(old["x"], old["y"],
-                                        old["height"], old["width"])
+        old_rect = self.marionette.window_rect
+
+        new_rect = self.marionette.set_window_rect(old_rect["x"], old_rect["y"],
+                                                   old_rect["height"], old_rect["width"])
 
-        new = self.marionette.window_rect
 
-        self.assertEqual(new["x"], old["x"])
-        self.assertEqual(new["y"], old["y"])
-        self.assertEqual(new["width"], old["width"])
-        self.assertEqual(new["height"], old["height"])
+        self.assertEqual(new_rect["x"], old_rect["x"])
+        self.assertEqual(new_rect["y"], old_rect["y"])
+        self.assertEqual(new_rect["width"], old_rect["width"])
+        self.assertEqual(new_rect["height"], old_rect["height"])
 
     def test_move_to_negative_coordinates(self):
         position = self.marionette.window_rect
         print("Current position: {}".format(
             position["x"], position["y"]))
         self.marionette.set_window_rect(-8, -8)
         position = self.marionette.window_rect
         print("Position after requesting move to negative coordinates: {}, {}"
@@ -199,40 +197,40 @@ class TestWindowRect(MarionetteTestCase)
 
         # 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"])
 
     def test_resize_larger_than_screen(self):
-        new = self.marionette.set_window_rect(
+        new_size = self.marionette.set_window_rect(
             self.max["width"] * 2, self.max["height"] * 2)
-        actual = self.marionette.window_rect
+        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.assertEqual(new["width"], actual["width"])
-        self.assertEqual(new["height"], actual["width"])
+        self.assertGreaterEqual(new_size["width"], self.max["width"])
+        self.assertGreaterEqual(new_size["height"], self.max["height"])
+        self.assertEqual(new_size["width"], actual_size["width"])
+        self.assertEqual(new_size["height"], actual_size["width"])
 
     def test_resize_to_available_screen_size(self):
-        expected = self.marionette.set_window_rect(width=self.max["width"],
+        expected_size = self.marionette.set_window_rect(width=self.max["width"],
                                                    height=self.max["height"])
-        result = self.marionette.window_rect
+        result_size = self.marionette.window_rect
 
-        self.assertEqual(result["width"], self.max["width"])
-        self.assertEqual(result["height"], self.max["height"])
-        self.assertEqual(result["width"], self.expected["width"])
-        self.assertEqual(result["height"], self.expected["height"])
+        self.assertEqual(result_size["width"], self.max["width"])
+        self.assertEqual(result_size["height"], self.max["height"])
+        self.assertEqual(result_size["width"], self.expected_size["width"])
+        self.assertEqual(result_size["height"], self.expected_size["height"])
 
     def test_resize_while_fullscreen(self):
         self.marionette.fullscreen()
-        expected = self.marionette.set_window_rect(width=self.max["width"] - 100,
+        expected_size = self.marionette.set_window_rect(width=self.max["width"] - 100,
                                                    height=self.max["height"] - 100)
-        result = self.marionette.window_rect
+        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(result["width"], self.expected["width"])
-        self.assertEqual(result["height"], self.expected["height"])
+                                                       sandbox=None))
+        self.assertEqual(result_size["width"], self.max["width"] - 100)
+        self.assertEqual(result_size["height"], self.max["height"] - 100)
+        self.assertEqual(result_size["width"], self.expected_size["width"])
+        self.assertEqual(result_size["height"], self.expected_size["height"])