Bug 1478358 - [wdspec] Enhance tests for the "Set Window Rect" command. r=ato
authorHenrik Skupin <mail@hskupin.info>
Fri, 11 Jan 2019 23:25:01 +0000
changeset 510843 3ef29704bc3d34cc4e3b4c804f5547d5527c2564
parent 510842 d4a75d417b037b3e3a0b52c86ebba9b1f3fdb99a
child 510844 ee53bdc5b1d4b868b80149e361720a9baa076c1a
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1478358
milestone66.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 1478358 - [wdspec] Enhance tests for the "Set Window Rect" command. r=ato 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.