mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Update web-platform-tests and CSS tests.
- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180. - Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
This commit is contained in:
parent
fb4f421c8b
commit
296fa2512b
21852 changed files with 2080936 additions and 892894 deletions
62
tests/wpt/css-tests/resources/examples/apisample16.html
Normal file
62
tests/wpt/css-tests/resources/examples/apisample16.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Example with a service worker</title>
|
||||
<script src="../testharness.js"></script>
|
||||
<script src="../testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Service Worker Tests</h1>
|
||||
<p>Demonstrates running <tt>testharness</tt> based tests inside a service worker.
|
||||
<p>The test harness should time out due to one of the tests inside the worker timing out.
|
||||
<p>This test assumes that the browser supports <a href="http://www.w3.org/TR/service-workers/">ServiceWorkers</a>.
|
||||
<div id="log"></div>
|
||||
|
||||
<script>
|
||||
test(
|
||||
function(t) {
|
||||
assert_true("serviceWorker" in navigator,
|
||||
"navigator.serviceWorker exists");
|
||||
},
|
||||
"Browser supports ServiceWorker");
|
||||
|
||||
promise_test(
|
||||
function() {
|
||||
// Since the service worker registration could be in an indeterminate
|
||||
// state (due to, for example, a previous test run failing), we start by
|
||||
// unregstering our service worker and then registering it again.
|
||||
var scope = "/service-worker-scope";
|
||||
var worker_url = "apisample-worker.js";
|
||||
|
||||
return navigator.serviceWorker.register(worker_url, {scope: scope})
|
||||
.then(
|
||||
function(registration) {
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(
|
||||
function() {
|
||||
return navigator.serviceWorker.register(worker_url, {scope: scope});
|
||||
})
|
||||
.then(
|
||||
function(registration) {
|
||||
add_completion_callback(
|
||||
function() {
|
||||
registration.unregister();
|
||||
});
|
||||
|
||||
return new Promise(
|
||||
function(resolve) {
|
||||
registration.addEventListener("updatefound",
|
||||
function() {
|
||||
resolve(registration.installing);
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(
|
||||
function(worker) {
|
||||
fetch_tests_from_worker(worker);
|
||||
});
|
||||
},
|
||||
"Register ServiceWorker");
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue