Bug 1388365 - Add client.Window#state and #rect. r=whimboo
authorAndreas Tolfsen <ato@sny.no>
Tue, 08 Aug 2017 14:59:09 +0100
changeset 373648 4cecb03e82360847ca9c923409b74cd6f6bcd5d1
parent 373647 65dc7d28c6fce3e55fadea2ad8b65cabf723e789
child 373649 54f45fe718c54d31535982f055bbce06cd836c6e
push id32308
push userarchaeopteryx@coole-files.de
push dateThu, 10 Aug 2017 15:20:33 +0000
treeherdermozilla-central@5322c03f4c85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1388365
milestone57.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 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
testing/web-platform/tests/tools/webdriver/webdriver/client.py
--- 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