зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1396838 - Remove window state from wdpsec tests. r=jgraham
MozReview-Commit-ID: 7zogEgoABnV --HG-- extra : rebase_source : 45920ac12cff35e5aa99c520a3ccdc93fb7828d7
This commit is contained in:
Родитель
7316bc343d
Коммит
ba22a00638
|
@ -272,11 +272,6 @@ class Window(object):
|
|||
body = {"x": x, "y": y}
|
||||
self.session.send_session_command("POST", "window/rect", body)
|
||||
|
||||
@property
|
||||
@command
|
||||
def state(self):
|
||||
return self.rect["state"]
|
||||
|
||||
@command
|
||||
def maximize(self):
|
||||
return self.session.send_session_command("POST", "window/maximize")
|
||||
|
|
|
@ -29,19 +29,16 @@ def test_handle_user_prompt(session):
|
|||
|
||||
def test_maximize(session):
|
||||
before_size = session.window.size
|
||||
assert session.window.state == "normal"
|
||||
|
||||
# step 4
|
||||
response = maximize(session)
|
||||
assert_success(response)
|
||||
|
||||
assert before_size != session.window.size
|
||||
assert session.window.state == "maximized"
|
||||
|
||||
|
||||
def test_payload(session):
|
||||
before_size = session.window.size
|
||||
assert session.window.state == "normal"
|
||||
|
||||
response = maximize(session)
|
||||
|
||||
|
@ -54,27 +51,22 @@ def test_payload(session):
|
|||
assert "height" in value
|
||||
assert "x" in value
|
||||
assert "y" in value
|
||||
assert "state" in value
|
||||
assert isinstance(value["width"], (int, float))
|
||||
assert isinstance(value["height"], (int, float))
|
||||
assert isinstance(value["x"], (int, float))
|
||||
assert isinstance(value["y"], (int, float))
|
||||
assert isinstance(value["state"], basestring)
|
||||
|
||||
assert before_size != session.window.size
|
||||
assert session.window.state == "maximized"
|
||||
|
||||
|
||||
def test_maximize_twice_is_idempotent(session):
|
||||
assert session.window.state == "normal"
|
||||
|
||||
first_response = maximize(session)
|
||||
assert_success(first_response)
|
||||
assert session.window.state == "maximized"
|
||||
max_size = session.window.size
|
||||
|
||||
second_response = maximize(session)
|
||||
assert_success(second_response)
|
||||
assert session.window.state == "maximized"
|
||||
assert session.window.size == max_size
|
||||
|
||||
|
||||
def test_maximize_when_resized_to_max_size(session):
|
||||
|
@ -83,9 +75,7 @@ def test_maximize_when_resized_to_max_size(session):
|
|||
#
|
||||
# Then resize the window to the maximum available size.
|
||||
session.end()
|
||||
assert session.window.state == "normal"
|
||||
available = session.window.maximize()
|
||||
assert session.window.state == "maximized"
|
||||
session.end()
|
||||
|
||||
session.window.size = (int(available["width"]), int(available["height"]))
|
||||
|
@ -95,8 +85,6 @@ def test_maximize_when_resized_to_max_size(session):
|
|||
# since this is often a special state. If a remote end expects a DOM
|
||||
# resize event, this may not fire if the window has already reached
|
||||
# its expected dimensions.
|
||||
assert session.window.state == "normal"
|
||||
before = session.window.size
|
||||
session.window.maximize()
|
||||
assert session.window.size == before
|
||||
assert session.window.state == "maximized"
|
||||
|
|
|
@ -28,17 +28,17 @@ def test_handle_user_prompt(session):
|
|||
|
||||
|
||||
def test_minimize(session):
|
||||
assert session.window.state == "normal"
|
||||
assert not session.execute_script("return document.hidden")
|
||||
|
||||
# step 4
|
||||
response = minimize(session)
|
||||
assert_success(response)
|
||||
|
||||
assert session.window.state == "minimized"
|
||||
assert session.execute_script("return document.hidden")
|
||||
|
||||
|
||||
def test_payload(session):
|
||||
assert session.window.state == "normal"
|
||||
assert not session.execute_script("return document.hidden")
|
||||
|
||||
response = minimize(session)
|
||||
|
||||
|
@ -51,23 +51,21 @@ def test_payload(session):
|
|||
assert "height" in value
|
||||
assert "x" in value
|
||||
assert "y" in value
|
||||
assert "state" in value
|
||||
assert isinstance(value["width"], (int, float))
|
||||
assert isinstance(value["height"], (int, float))
|
||||
assert isinstance(value["x"], (int, float))
|
||||
assert isinstance(value["y"], (int, float))
|
||||
assert isinstance(value["state"], basestring)
|
||||
|
||||
assert session.window.state == "minimized"
|
||||
assert session.execute_script("return document.hidden")
|
||||
|
||||
|
||||
def test_minimize_twice_is_idempotent(session):
|
||||
assert session.execute_script("return document.hidden") is False
|
||||
assert not session.execute_script("return document.hidden")
|
||||
|
||||
first_response = minimize(session)
|
||||
assert_success(first_response)
|
||||
assert session.execute_script("return document.hidden") is True
|
||||
assert session.execute_script("return document.hidden")
|
||||
|
||||
second_response = minimize(session)
|
||||
assert_success(second_response)
|
||||
assert session.execute_script("return document.hidden") is True
|
||||
assert session.execute_script("return document.hidden")
|
||||
|
|
|
@ -299,7 +299,6 @@ def test_fully_exit_fullscreen(session):
|
|||
value = assert_success(response)
|
||||
assert value["width"] == 400
|
||||
assert value["height"] == 400
|
||||
assert value["state"] == "normal"
|
||||
|
||||
assert session.execute_script("return window.fullScreen") is False
|
||||
|
||||
|
@ -326,7 +325,6 @@ def test_restore_from_minimized(session):
|
|||
value = assert_success(response)
|
||||
assert value["width"] == 450
|
||||
assert value["height"] == 450
|
||||
assert value["state"] == "normal"
|
||||
|
||||
assert session.execute_script("return document.hidden") is False
|
||||
|
||||
|
@ -349,13 +347,11 @@ def test_restore_from_maximized(session):
|
|||
original_size = session.window.size
|
||||
session.window.maximize()
|
||||
assert session.window.size != original_size
|
||||
assert session.window.state == "maximized"
|
||||
|
||||
response = set_window_rect(session, {"width": 400, "height": 400})
|
||||
value = assert_success(response)
|
||||
assert value["width"] == 400
|
||||
assert value["height"] == 400
|
||||
assert value["state"] == "normal"
|
||||
|
||||
|
||||
def test_height_width(session):
|
||||
|
@ -374,8 +370,7 @@ def test_height_width(session):
|
|||
assert_success(response, {"x": original["x"],
|
||||
"y": original["y"],
|
||||
"width": max["width"] - 100,
|
||||
"height": max["height"] - 100,
|
||||
"state": "normal"})
|
||||
"height": max["height"] - 100})
|
||||
|
||||
|
||||
def test_height_width_larger_than_max(session):
|
||||
|
@ -393,7 +388,6 @@ def test_height_width_larger_than_max(session):
|
|||
rect = assert_success(response)
|
||||
assert rect["width"] >= max["width"]
|
||||
assert rect["height"] >= max["height"]
|
||||
assert rect["state"] == "normal"
|
||||
|
||||
|
||||
def test_height_width_as_current(session):
|
||||
|
@ -407,8 +401,7 @@ def test_height_width_as_current(session):
|
|||
assert_success(response, {"x": original["x"],
|
||||
"y": original["y"],
|
||||
"width": original["width"],
|
||||
"height": original["height"],
|
||||
"state": original["state"]})
|
||||
"height": original["height"]})
|
||||
|
||||
|
||||
def test_x_y(session):
|
||||
|
@ -422,8 +415,7 @@ def test_x_y(session):
|
|||
assert_success(response, {"x": original["x"] + 10,
|
||||
"y": original["y"] + 10,
|
||||
"width": original["width"],
|
||||
"height": original["height"],
|
||||
"state": original["state"]})
|
||||
"height": original["height"]})
|
||||
|
||||
|
||||
def test_negative_x_y(session):
|
||||
|
@ -441,7 +433,6 @@ def test_negative_x_y(session):
|
|||
assert rect["y"] <= 0
|
||||
assert rect["width"] == original["width"]
|
||||
assert rect["height"] == original["height"]
|
||||
assert rect["state"] == original["state"]
|
||||
|
||||
# On macOS, windows can only be moved off the screen on the
|
||||
# horizontal axis. The system menu bar also blocks windows from
|
||||
|
@ -450,8 +441,7 @@ def test_negative_x_y(session):
|
|||
assert_success(response, {"x": -8,
|
||||
"y": 23,
|
||||
"width": original["width"],
|
||||
"height": original["height"],
|
||||
"state": original["state"]})
|
||||
"height": original["height"]})
|
||||
|
||||
# It turns out that Windows is the only platform on which the
|
||||
# window can be reliably positioned off-screen.
|
||||
|
@ -459,8 +449,7 @@ def test_negative_x_y(session):
|
|||
assert_success(response, {"x": -8,
|
||||
"y": -8,
|
||||
"width": original["width"],
|
||||
"height": original["height"],
|
||||
"state": original["state"]})
|
||||
"height": original["height"]})
|
||||
|
||||
|
||||
def test_move_to_same_position(session):
|
||||
|
@ -510,9 +499,7 @@ def test_payload(session):
|
|||
assert "height" in rect
|
||||
assert "x" in rect
|
||||
assert "y" in rect
|
||||
assert "state" in rect
|
||||
assert isinstance(rect["width"], (int, float))
|
||||
assert isinstance(rect["height"], (int, float))
|
||||
assert isinstance(rect["x"], (int, float))
|
||||
assert isinstance(rect["y"], (int, float))
|
||||
assert isinstance(rect["state"], basestring)
|
||||
|
|
Загрузка…
Ссылка в новой задаче