Skip to content

Commit a8bebb7

Browse files
committed
Bug 1522790 - Use marionette new window command to open wptrunner windows r=jgraham
Differential Revision: https://phabricator.services.mozilla.com/D23972
1 parent eac8ff1 commit a8bebb7

File tree

6 files changed

+31
-80
lines changed

6 files changed

+31
-80
lines changed

testing/web-platform/meta/css/css-contain/container-queries/font-relative-units-dynamic.html.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
expected:
1313
if not fission and (os == "linux") and not debug and asan: [PASS, FAIL]
1414
if not fission and (os == "android"): FAIL
15-
if fission: PASS
16-
[FAIL, PASS]
15+
if fission: FAIL
16+
FAIL
1717

1818
[rcap units respond to changes]
1919
expected: FAIL

testing/web-platform/meta/html/canvas/element/text/2d.text.draw.fontface.notinpage.html.ini

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
if not fission and debug and swgl: [PASS, FAIL]
55
if not fission and debug and not swgl: [FAIL, PASS]
66
if not fission and not debug: [PASS, FAIL]
7+
FAIL

testing/web-platform/meta/resource-timing/no-entries-for-cross-origin-css-fetched.sub.html.ini

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
if (os == "linux") and not fission and not debug: [PASS, FAIL]
55
if (os == "linux") and not fission and debug: [PASS, FAIL]
66
if os == "android": FAIL
7+
FAIL

testing/web-platform/mozilla/meta/webdriver/harness/crash_content_process.py.ini

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
[crash_content_process.py]
22
disabled:
33
if asan or tsan: Crash Reporter not enabled.
4-
if (os == "android"): https://bugzilla.mozilla.org/show_bug.cgi?id=1848850
5-
6-
expected:
7-
CRASH
8-
4+
if os == "android": https://bugzilla.mozilla.org/show_bug.cgi?id=1848850
5+
expected: CRASH
96
[test_detect_crash[capabilities0\]]
107
bug: 1848850
118
expected:

testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py

+17-61
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ def set_timeout(self, timeout):
103103
self.marionette.timeout.script = timeout
104104
self.timeout = timeout
105105

106+
def create_window(self, type="tab", **kwargs):
107+
return self.marionette.open(type=type, focus=True)["handle"]
108+
106109
@property
107110
def current_window(self):
108111
return self.marionette.current_window_handle
@@ -233,57 +236,6 @@ def dismiss_alert(self, f):
233236
else:
234237
break
235238

236-
def get_test_window(self, window_id, parent, timeout=5):
237-
"""Find the test window amongst all the open windows.
238-
This is assumed to be either the named window or the one after the parent in the list of
239-
window handles
240-
241-
:param window_id: The DOM name of the Window
242-
:param parent: The handle of the runner window
243-
:param timeout: The time in seconds to wait for the window to appear. This is because in
244-
some implementations there's a race between calling window.open and the
245-
window being added to the list of WebDriver accessible windows."""
246-
test_window = None
247-
end_time = time.time() + timeout
248-
while time.time() < end_time:
249-
if window_id:
250-
try:
251-
# Try this, it's in Level 1 but nothing supports it yet
252-
win_s = self.parent.base.execute_script("return window['%s'];" % self.window_id)
253-
win_obj = json.loads(win_s)
254-
test_window = win_obj["window-fcc6-11e5-b4f8-330a88ab9d7f"]
255-
except Exception:
256-
pass
257-
258-
if test_window is None:
259-
handles = self.marionette.window_handles
260-
if len(handles) == 2:
261-
test_window = next(iter(set(handles) - {parent}))
262-
elif len(handles) > 2 and handles[0] == parent:
263-
# Hope the first one here is the test window
264-
test_window = handles[1]
265-
266-
if test_window is not None:
267-
assert test_window != parent
268-
return test_window
269-
270-
time.sleep(0.1)
271-
272-
raise Exception("unable to find test window")
273-
274-
def test_window_loaded(self):
275-
"""Wait until the page in the new window has been loaded.
276-
277-
Hereby ignore Javascript execptions that are thrown when
278-
the document has been unloaded due to a process change.
279-
"""
280-
while True:
281-
try:
282-
self.parent.base.execute_script(self.window_loaded_script, asynchronous=True)
283-
break
284-
except errors.JavascriptException:
285-
pass
286-
287239

288240
class MarionettePrefsProtocolPart(PrefsProtocolPart):
289241
def setup(self):
@@ -986,16 +938,13 @@ def do_test(self, test):
986938
return (test.make_result(extra=extra, *data), [])
987939

988940
def do_testharness(self, protocol, url, timeout):
989-
parent_window = protocol.testharness.close_old_windows(self.last_environment["protocol"])
941+
protocol.testharness.close_old_windows(self.last_environment["protocol"])
990942

991943
if self.protocol.coverage.is_enabled:
992944
self.protocol.coverage.reset()
993945

994-
protocol.base.execute_script("window.open('about:blank', '%s', 'noopener')" % self.window_id)
995-
test_window = protocol.testharness.get_test_window(self.window_id, parent_window,
996-
timeout=10 * self.timeout_multiplier)
946+
test_window = protocol.base.create_window()
997947
self.protocol.base.set_window(test_window)
998-
protocol.testharness.test_window_loaded()
999948

1000949
if self.debug_test and self.browser.supports_devtools:
1001950
self.protocol.debug.load_devtools()
@@ -1059,8 +1008,6 @@ def __init__(self, logger, browser, server_config, timeout_multiplier=1,
10591008

10601009
self.install_extensions = browser.extensions
10611010

1062-
with open(os.path.join(here, "reftest.js")) as f:
1063-
self.script = f.read()
10641011
with open(os.path.join(here, "test-wait.js")) as f:
10651012
self.wait_script = f.read() % {"classname": "reftest-wait"}
10661013

@@ -1108,10 +1055,19 @@ def do_test(self, test):
11081055
self.has_window = False
11091056

11101057
if not self.has_window:
1111-
self.protocol.base.execute_script(self.script)
1112-
self.protocol.base.set_window(self.protocol.marionette.window_handles[-1])
1058+
self.protocol.base.create_window(type="window")
1059+
# Resize the browser window so that its inner dimensions have
1060+
# exactly a size of 800x600 pixels, which means ignoring all
1061+
# visible toolbars and sidebars.
1062+
offsets = self.protocol.marionette.execute_script("""
1063+
return {
1064+
width: window.outerWidth - window.innerWidth,
1065+
height: window.outerHeight - window.innerHeight,
1066+
};
1067+
""")
1068+
self.protocol.marionette.set_window_rect(
1069+
x=0, y=0, width=800 + offsets["width"], height=600 + offsets["height"])
11131070
self.has_window = True
1114-
self.protocol.testharness.test_window_loaded()
11151071

11161072
if self.protocol.coverage.is_enabled:
11171073
self.protocol.coverage.reset()

testing/web-platform/tests/tools/wptrunner/wptrunner/executors/protocol.py

+8-12
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ def wait(self):
150150
:returns: True to re-run the test, or False to continue with the next test"""
151151
pass
152152

153+
@abstractmethod
154+
def create_window(self, type="tab", **kwargs):
155+
"""Return a handle identifying a freshly created top level browsing context
156+
157+
:param type: - Type hint, either "tab" or "window"
158+
:returns: A protocol-specific handle"""
159+
pass
160+
153161
@property
154162
def current_window(self):
155163
"""Return a handle identifying the current top level browsing context
@@ -202,18 +210,6 @@ def close_old_windows(self, url_protocol):
202210
"""
203211
pass
204212

205-
@abstractmethod
206-
def get_test_window(self, window_id, parent):
207-
"""Get the window handle dorresponding to the window containing the
208-
currently active test.
209-
210-
:param window_id: A string containing the DOM name of the Window that
211-
contains the test, or None.
212-
:param parent: The handle of the runner window.
213-
:returns: A protocol-specific window handle.
214-
"""
215-
pass
216-
217213
@abstractmethod
218214
def test_window_loaded(self):
219215
"""Wait until the newly opened test window has been loaded."""

0 commit comments

Comments
 (0)