Commit 3b1c7980 authored by Chromium WPT Sync's avatar Chromium WPT Sync Committed by Commit Bot

Import wpt@0e615f38afaa95df7f5b410508f4eec4d155d6ed

Using wpt-import in Chromium 7e12fc7c.
With Chromium commits locally applied on WPT:
5579aad0 "SharedWorker: Name shared workers identically in credentials mode WPT"


Note to sheriffs: This CL imports external tests and adds
expectations for those tests; if this CL is large and causes
a few new failures, please fix the failures by adding new
lines to TestExpectations rather than reverting. See:
https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_platform_tests.md

Directory owners for changes in this CL:
eae@chromium.org, szager@chromium.org:
  external/wpt/intersection-observer
foolip@chromium.org, lpz@chromium.org, robertma@chromium.org:
  external/wpt/tools

NOAUTOREVERT=true
TBR=robertma

No-Export: true
Change-Id: I9b97e813d58e375c473b3546b359485fe27e338a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2050991Reviewed-by: default avatarWPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: WPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Cr-Commit-Position: refs/heads/master@{#740470}
parent 14acdeec
<!DOCTYPE html>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="/css/cssom-view/support/scroll-behavior.js"></script>
<script src="./resources/intersection-observer-test-utils.js"></script>
<style>
.spacer {
height: calc(100vh + 100px);
}
</style>
<div class="spacer"></div>
<iframe id="iframe"></iframe>
<script>
promise_test(async t => {
iframe.src = // non secure port.
get_host_info().HTTP_NOTSAMESITE_ORIGIN + "/intersection-observer/resources/nested-cross-origin-child-iframe.sub.html";
await new Promise(resolve => {
window.addEventListener("message", event => {
if (event.data == "ready") {
resolve();
}
}, { once: true });
});
let isIntersecting = false;
window.addEventListener("message", function listener(event) {
if (event.origin == get_host_info().HTTPS_NOTSAMESITE_ORIGIN) {
isIntersecting = event.data;
window.removeEventListener("message", listener);
}
});
await new Promise(resolve => waitForNotification(t, resolve));
await new Promise(resolve => waitForNotification(t, resolve));
assert_false(isIntersecting,
"The target element is not intersecting in all ancestor viewports");
// Scroll the iframe in this document into view, but still the target element
// in the grand child document is out of the child iframe's viewport.
iframe.scrollIntoView({ behavior: "instant" });
await waitForScrollEnd(document.scrollingElement);
assert_false(isIntersecting,
"The target element is not intersecting in all ancestor viewports");
// Now make the target element visible in the child iframe's viewport.
frames[0].postMessage("scroll", "*");
await new Promise(resolve => {
window.addEventListener("message", function listener(event) {
// It's possible that the message from the IntersectionObserver in the
// grand child document (HTTPS_NORSAMESITE_ORIGIN) is delivered ealier
// than scrollEnd message from the child document
// (HTTP_NOTSAMESITE_ORIGIN), so we need to differentiate them.
if (event.origin == get_host_info().HTTP_NOTSAMESITE_ORIGIN &&
event.data == "scrollEnd" ) {
window.removeEventListener("message", listener);
resolve();
}
});
});
await new Promise(resolve => waitForNotification(t, resolve));
assert_true(isIntersecting,
"The target element is now intersecting in all ancestor viewports");
}, "IntersectionObserver with `implicit root` in a nested cross-origin iframe works");
</script>
<!DOCTYPE html>
<script src="/common/get-host-info.sub.js"></script>
<script src="/css/cssom-view/support/scroll-behavior.js"></script>
<style>
.spacer {
height: calc(100vh + 100px);
}
</style>
<div class="spacer"></div>
<iframe id="iframe"></iframe>
<script>
iframe.src = // secure port
get_host_info().HTTPS_NOTSAMESITE_ORIGIN + "/intersection-observer/resources/nested-cross-origin-grand-child-iframe.html";
window.addEventListener("message", async event => {
if (event.data == "scroll") {
iframe.scrollIntoView({ behavior: "instant" });
await waitForScrollEnd(document.scrollingElement);
window.parent.postMessage("scrollEnd", "*");
}
});
</script>
<!DOCTYPE html>
<div id="target" style="height: 100px; background-color: green;"></div>
<script>
const observer = new IntersectionObserver(records => {
records.forEach(record => {
if (record.isIntersecting) {
window.top.postMessage(record.isIntersecting, "*");
}
});
}, {});
observer.observe(target);
window.addEventListener("load", () => {
window.top.postMessage("ready", "*");
});
</script>
......@@ -124,7 +124,7 @@ class WeblayerShell(Browser):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -123,7 +123,7 @@ class SystemWebViewShell(Browser):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -125,7 +125,7 @@ class ChromeBrowser(Browser):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -114,7 +114,7 @@ class ChromeAndroidBrowser(Browser):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -71,7 +71,7 @@ class ChromeiOSBrowser(Browser):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -108,7 +108,7 @@ class EdgeBrowser(Browser):
# TODO(ato): This only indicates the server is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -107,7 +107,7 @@ class EdgeChromiumBrowser(Browser):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -64,7 +64,7 @@ class InternetExplorerBrowser(Browser):
# TODO(ato): This only indicates the server is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -93,7 +93,7 @@ class OperaBrowser(Browser):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -79,7 +79,7 @@ class SafariBrowser(Browser):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -101,7 +101,7 @@ class WebKitBrowser(Browser):
# TODO(ato): This only indicates the driver is alive,
# and doesn't say anything about whether a browser session
# is active.
return self.server.is_alive
return self.server.is_alive()
def cleanup(self):
self.stop()
......
......@@ -170,7 +170,7 @@ class TimedRunner(object):
elif self.result[1] is None:
# We didn't get any data back from the test, so check if the
# browser is still responsive
if self.protocol.is_alive:
if self.protocol.is_alive():
self.result = False, ("INTERNAL-ERROR", None)
else:
self.logger.info("Browser not responding, setting status to CRASH")
......@@ -512,7 +512,7 @@ class WdspecExecutor(TestExecutor):
self.protocol = self.protocol_cls(self, browser)
def is_alive(self):
return self.protocol.is_alive
return self.protocol.is_alive()
def on_environment_change(self, new_environment):
pass
......@@ -638,10 +638,9 @@ class WebDriverProtocol(Protocol):
pass
def teardown(self):
if self.server is not None and self.server.is_alive:
if self.server is not None and self.server.is_alive():
self.server.stop()
@property
def is_alive(self):
"""Test that the connection is still alive.
......
......@@ -592,7 +592,6 @@ class MarionetteProtocol(Protocol):
del self.marionette
super(MarionetteProtocol, self).teardown()
@property
def is_alive(self):
try:
self.marionette.current_window_handle
......@@ -698,7 +697,7 @@ class MarionetteTestharnessExecutor(TestharnessExecutor):
self.protocol.testharness.load_runner(self.last_environment["protocol"])
def is_alive(self):
return self.protocol.is_alive
return self.protocol.is_alive()
def on_environment_change(self, new_environment):
self.protocol.on_environment_change(self.last_environment, new_environment)
......@@ -818,7 +817,7 @@ class MarionetteRefTestExecutor(RefTestExecutor):
self.implementation.reset(**self.implementation_kwargs)
def is_alive(self):
return self.protocol.is_alive
return self.protocol.is_alive()
def on_environment_change(self, new_environment):
self.protocol.on_environment_change(self.last_environment, new_environment)
......@@ -972,7 +971,7 @@ class MarionetteCrashtestExecutor(CrashtestExecutor):
do_delayed_imports()
def is_alive(self):
return self.protocol.is_alive
return self.protocol.is_alive()
def on_environment_change(self, new_environment):
self.protocol.on_environment_change(self.last_environment, new_environment)
......
......@@ -67,10 +67,17 @@ class WebDriverBaseProtocolPart(BaseProtocolPart):
while True:
try:
self.webdriver.execute_async_script("")
except (client.TimeoutException, client.ScriptTimeoutException):
except (client.TimeoutException,
client.ScriptTimeoutException,
client.JavascriptErrorException):
# A JavascriptErrorException will happen when we navigate;
# by ignoring it it's possible to reload the test whilst the
# harness remains paused
pass
except (socket.timeout, client.NoSuchWindowException,
client.UnknownErrorException, IOError):
except (socket.timeout,
client.NoSuchWindowException,
client.UnknownErrorException,
IOError):
break
except Exception as e:
self.logger.error(traceback.format_exc(e))
......
......@@ -32,7 +32,6 @@ class Protocol(object):
""":returns: Current logger"""
return self.executor.logger
@property
def is_alive(self):
"""Is the browser connection still active
......
......@@ -84,14 +84,13 @@ class WebDriverServer(object):
def stop(self, force=False):
self.logger.debug("Stopping WebDriver")
if self.is_alive:
if self.is_alive():
kill_result = self._proc.kill()
if force and kill_result != 0:
return self._proc.kill(9)
return kill_result
return not self.is_alive
return not self.is_alive()
@property
def is_alive(self):
return hasattr(self._proc, "proc") and self._proc.poll() is None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment