Bug 1388365 - Add client.Window#state and #rect. r?whimboo
Introduces two new APIs on client.Window in the WPT WebDriver client:
client.Window#state and client.Window#rect. The latter is used to reduce
raw calls amongst client.Window's shorthands to GET window/rect.
MozReview-Commit-ID: Kf4P2q93QaL
--- a/testing/web-platform/tests/tools/webdriver/webdriver/client.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/client.py
@@ -234,40 +234,50 @@ class Actions(object):
class Window(object):
def __init__(self, session):
self.session = session
@property
@command
+ def rect(self):
+ return self.session.send_session_command("GET", "window/rect")
+
+ @property
+ @command
def size(self):
- resp = self.session.send_session_command("GET", "window/rect")
- return (resp["width"], resp["height"])
+ rect = self.rect
+ return (rect["width"], rect["height"])
@size.setter
@command
def size(self, data):
width, height = data
body = {"width": width, "height": height}
self.session.send_session_command("POST", "window/rect", body)
@property
@command
def position(self):
- resp = self.session.send_session_command("GET", "window/rect")
- return (resp["x"], resp["y"])
+ rect = self.rect
+ return (rect["x"], rect["y"])
@position.setter
@command
def position(self, data):
data = x, y
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")
class Find(object):
def __init__(self, session):
self.session = session