Commit 7f78f14b authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

[WPT] Add module version of service-worker/registration-script.https.html

Bug: 1129795
Change-Id: Ibff0827b206b9a0290fcdbcaccb3c57cae2a00da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2413725
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810076}
parent 89b2ad00
This is a testharness.js-based test.
PASS Registering invalid chunked encoding script
PASS Registering invalid chunked encoding script with flush
FAIL Registering script including parse error assert_unreached: Should have rejected: Registration of script including parse error should fail. Reached unreachable code
FAIL Registering script including undefined error assert_unreached: Should have rejected: Registration of script including undefined error should fail. Reached unreachable code
FAIL Registering script including uncaught exception assert_unreached: Should have rejected: Registration of script including uncaught exception should fail. Reached unreachable code
PASS Registering non-existent script
PASS Registering script including caught exception
Harness: the test ran to completion.
<!DOCTYPE html>
<title>Service Worker: Registration (module script)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<script src="resources/registration-tests-script.js"></script>
<script>
registration_tests_script(
(script, options) => navigator.serviceWorker.register(
script,
Object.assign({type: 'module'}, options)),
'module');
</script>
...@@ -5,5 +5,8 @@ ...@@ -5,5 +5,8 @@
<script src="resources/test-helpers.sub.js"></script> <script src="resources/test-helpers.sub.js"></script>
<script src="resources/registration-tests-script.js"></script> <script src="resources/registration-tests-script.js"></script>
<script> <script>
registration_tests_script((script, options) => navigator.serviceWorker.register(script, options)); registration_tests_script(
(script, options) => navigator.serviceWorker.register(script, options),
'classic'
);
</script> </script>
// Registration tests that mostly exercise the service worker script contents or // Registration tests that mostly exercise the service worker script contents or
// response. // response.
function registration_tests_script(register_method) { function registration_tests_script(register_method, type) {
promise_test(function(t) { promise_test(function(t) {
var script = 'resources/invalid-chunked-encoding.py'; var script = 'resources/invalid-chunked-encoding.py';
var scope = 'resources/scope/invalid-chunked-encoding/'; var scope = 'resources/scope/invalid-chunked-encoding/';
...@@ -46,6 +46,7 @@ function registration_tests_script(register_method) { ...@@ -46,6 +46,7 @@ function registration_tests_script(register_method) {
'Registration of script including uncaught exception should fail.'); 'Registration of script including uncaught exception should fail.');
}, 'Registering script including uncaught exception'); }, 'Registering script including uncaught exception');
if (type === 'classic') {
promise_test(function(t) { promise_test(function(t) {
var script = 'resources/malformed-worker.py?import-malformed-script'; var script = 'resources/malformed-worker.py?import-malformed-script';
var scope = 'resources/scope/import-malformed-script'; var scope = 'resources/scope/import-malformed-script';
...@@ -54,6 +55,7 @@ function registration_tests_script(register_method) { ...@@ -54,6 +55,7 @@ function registration_tests_script(register_method) {
register_method(script, {scope: scope}), register_method(script, {scope: scope}),
'Registration of script importing malformed script should fail.'); 'Registration of script importing malformed script should fail.');
}, 'Registering script importing malformed script'); }, 'Registering script importing malformed script');
}
promise_test(function(t) { promise_test(function(t) {
var script = 'resources/no-such-worker.js'; var script = 'resources/no-such-worker.js';
...@@ -64,6 +66,7 @@ function registration_tests_script(register_method) { ...@@ -64,6 +66,7 @@ function registration_tests_script(register_method) {
'Registration of non-existent script should fail.'); 'Registration of non-existent script should fail.');
}, 'Registering non-existent script'); }, 'Registering non-existent script');
if (type === 'classic') {
promise_test(function(t) { promise_test(function(t) {
var script = 'resources/malformed-worker.py?import-no-such-script'; var script = 'resources/malformed-worker.py?import-no-such-script';
var scope = 'resources/scope/import-no-such-script'; var scope = 'resources/scope/import-no-such-script';
...@@ -72,6 +75,7 @@ function registration_tests_script(register_method) { ...@@ -72,6 +75,7 @@ function registration_tests_script(register_method) {
register_method(script, {scope: scope}), register_method(script, {scope: scope}),
'Registration of script importing non-existent script should fail.'); 'Registration of script importing non-existent script should fail.');
}, 'Registering script importing non-existent script'); }, 'Registering script importing non-existent script');
}
promise_test(function(t) { promise_test(function(t) {
var script = 'resources/malformed-worker.py?caught-exception'; var script = 'resources/malformed-worker.py?caught-exception';
......
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