Bug 1478358 - [wdspec] Enhance tests for the "Set Window Rect" command. r=ato a=test-only
authorHenrik Skupin <mail@hskupin.info>
Fri, 11 Jan 2019 23:25:01 +0000
changeset 509475 c3a3d5aadad26e7a4d97cd034871c94b2371c375
parent 509474 c52783e0d7e1e3ca9463e36a6b3de2a5ed04a563
child 509476 d7374a988e21becf83e2c549933cf74c4ec5c087
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1478358
milestone65.0
Bug 1478358 - [wdspec] Enhance tests for the "Set Window Rect" command. r=ato a=test-only Depends on D16340 Differential Revision: https://phabricator.services.mozilla.com/D16342
testing/web-platform/tests/webdriver/tests/set_window_rect/set.py
--- a/testing/web-platform/tests/webdriver/tests/set_window_rect/set.py
+++ b/testing/web-platform/tests/webdriver/tests/set_window_rect/set.py
@@ -182,16 +182,27 @@ def test_height_width(session):
     assert_success(response, {
         "x": original["x"],
         "y": original["y"],
         "width": screen_width - 100,
         "height": screen_height - 100,
     })
 
 
+def test_height_width_smaller_than_minimum_browser_size(session):
+    original = session.window.rect
+
+    response = set_window_rect(session, {"width": 10, "height": 10})
+    rect = assert_success(response)
+    assert rect["width"] < original["width"]
+    assert rect["width"] > 10
+    assert rect["height"] < original["height"]
+    assert rect["height"] > 10
+
+
 def test_height_width_larger_than_max(session):
     screen_width, screen_height = screen_size(session)
     avail_width, avail_height = available_screen_size(session)
 
     response = set_window_rect(session, {
         "width": screen_width + 100,
         "height": screen_height + 100
     })
@@ -210,16 +221,46 @@ def test_height_width_as_current(session
     assert_success(response, {
         "x": original["x"],
         "y": original["y"],
         "width": original["width"],
         "height": original["height"]
     })
 
 
+def test_height_as_current(session):
+    original = session.window.rect
+
+    response = set_window_rect(session, {
+        "width": original["width"] + 10,
+        "height": original["height"]
+    })
+    assert_success(response, {
+        "x": original["x"],
+        "y": original["y"],
+        "width": original["width"] + 10,
+        "height": original["height"]
+    })
+
+
+def test_width_as_current(session):
+    original = session.window.rect
+
+    response = set_window_rect(session, {
+        "width": original["width"],
+        "height": original["height"] + 10
+    })
+    assert_success(response, {
+        "x": original["x"],
+        "y": original["y"],
+        "width": original["width"],
+        "height": original["height"] + 10
+    })
+
+
 def test_x_y(session):
     original = session.window.rect
     response = set_window_rect(session, {
         "x": original["x"] + 10,
         "y": original["y"] + 10
     })
     assert_success(response, {
         "x": original["x"] + 10,
@@ -262,50 +303,59 @@ def test_negative_x_y(session):
     # window can be reliably positioned off-screen.
     elif os == "windows":
         assert_success(response, {"x": -8,
                                   "y": -8,
                                   "width": original["width"],
                                   "height": original["height"]})
 
 
-def test_move_to_same_position(session):
-    original_position = session.window.position
-    position = session.window.position = original_position
-    assert position == original_position
+def test_x_y_as_current(session):
+    original = session.window.rect
 
-
-def test_move_to_same_x(session):
-    original_x = session.window.position[0]
-    position = session.window.position = (original_x, 345)
-    assert position == (original_x, 345)
+    response = set_window_rect(session, {
+        "x": original["x"],
+        "y": original["y"]
+    })
+    assert_success(response, {
+        "x": original["x"],
+        "y": original["y"],
+        "width": original["width"],
+        "height": original["height"]
+    })
 
 
-def test_move_to_same_y(session):
-    original_y = session.window.position[1]
-    position = session.window.position = (456, original_y)
-    assert position == (456, original_y)
+def test_x_as_current(session):
+    original = session.window.rect
+
+    response = set_window_rect(session, {
+        "x": original["x"],
+        "y": original["y"] + 10
+    })
+    assert_success(response, {
+        "x": original["x"],
+        "y": original["y"] + 10,
+        "width": original["width"],
+        "height": original["height"]
+    })
 
 
-def test_resize_to_same_size(session):
-    original_size = session.window.size
-    size = session.window.size = original_size
-    assert size == original_size
-
+def test_y_as_current(session):
+    original = session.window.rect
 
-def test_resize_to_same_width(session):
-    original_width = session.window.size[0]
-    size = session.window.size = (original_width, 345)
-    assert size == (original_width, 345)
-
-
-def test_resize_to_same_height(session):
-    original_height = session.window.size[1]
-    size = session.window.size = (456, original_height)
-    assert size == (456, original_height)
+    response = set_window_rect(session, {
+        "x": original["x"] + 10,
+        "y": original["y"]
+    })
+    assert_success(response, {
+        "x": original["x"] + 10,
+        "y": original["y"],
+        "width": original["width"],
+        "height": original["height"]
+    })
 
 
 """
 TODO(ato):
 
     Disable test because the while statements are wrong.
     To fix this properly we need to write an explicit wait utility.