Update web-platform-tests to revision 386d27678c48bf468b8d374e2ba718e32185a5b7

This commit is contained in:
WPT Sync Bot 2019-04-11 22:38:06 -04:00
parent c24420ddbe
commit dd79cdc697
32 changed files with 336 additions and 167 deletions

View file

@ -1,23 +1,34 @@
<!DOCTYPE html>
<meta charset="utf-8">
<meta charset="utf-8" />
<title>Tests for importScripts: script resource map</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<body>
<script>
// This test registers a worker that imports a script multiple times. The
// script should be stored on the first import and thereafter that stored
// script should be loaded. The worker asserts that the stored script was
// loaded; if the assert fails then registration fails.
promise_test(t => {
const scope = 'resources/import-scripts-resource-map';
return service_worker_unregister(t, scope)
.then(() => {
return navigator.serviceWorker.register(
'resources/import-scripts-resource-map-worker.js', {scope: scope});
})
.then(r => r.unregister());
}, 'import the same script URL multiple times');
</script>
<script>
// This test registers a worker that imports a script multiple times. The
// script should be stored on the first import and thereafter that stored
// script should be loaded. The worker asserts that the stored script was
// loaded; if the assert fails then registration fails.
promise_test(async t => {
const SCOPE = "resources/import-scripts-resource-map";
const SCRIPT = "resources/import-scripts-resource-map-worker.js";
await service_worker_unregister(t, SCOPE);
const registration = await navigator.serviceWorker.register(SCRIPT, {
scope: SCOPE
});
await registration.unregister();
}, "import the same script URL multiple times");
promise_test(async t => {
const SCOPE = "resources/import-scripts-diff-resource-map";
const SCRIPT = "resources/import-scripts-diff-resource-map-worker.js";
await service_worker_unregister(t, SCOPE);
const registration = await navigator.serviceWorker.register(SCRIPT, {
scope: SCOPE
});
await registration.unregister();
}, "call importScripts() with multiple arguments");
</script>
</body>

View file

@ -0,0 +1,10 @@
importScripts('/resources/testharness.js');
let echo1 = null;
let echo2 = null;
let arg1 = 'import-scripts-get.py?output=echo1&msg=test1';
let arg2 = 'import-scripts-get.py?output=echo2&msg=test2';
importScripts(arg1, arg2);
assert_equals(echo1, 'test1');
assert_equals(echo2, 'test2');

View file

@ -0,0 +1,6 @@
def main(req, res):
return ([
('Cache-Control', 'no-cache, must-revalidate'),
('Pragma', 'no-cache'),
('Content-Type', 'application/javascript')],
'%s = "%s";\n' % (req.GET['output'], req.GET['msg']))