-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
service worker WPT tests: split very big registration tests into mult…
…iple files registration.https.html and link-element-register.https.html do about 70 register calls, most of which result in a service worker starting up. These test files always came close to the test harness timeout, and with the new snapshotting change r496290 which does a lot of work in Debug, started timing out on Debug. The snapshotting change is supposed to be fixed soon, but split them up into smaller files anyway. I verified that no tests were lost by generating the new files then `cat registration-*expected* | sort | uniq` and comparing to the existing test output (and similar for link-element-register*). Bug: 758481 Change-Id: I7e522e3c4e87df11fcb5197da59005e2d9e25f92 Reviewed-on: https://chromium-review.googlesource.com/635065 Commit-Queue: Matt Falkenhagen <[email protected]> Reviewed-by: Hiroki Nakagawa <[email protected]> Cr-Commit-Position: refs/heads/master@{#497717}
- Loading branch information
Showing
21 changed files
with
612 additions
and
34 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
service-workers/service-worker/link-element-register-basic.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Register via link element (basic)</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-basic.js"></script> | ||
<body> | ||
<script> | ||
registration_tests_basic(register_using_link, false); | ||
</script> | ||
</body> |
11 changes: 11 additions & 0 deletions
11
service-workers/service-worker/link-element-register-mime-types.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Register via link element (MIME types)</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-mime-types.js"></script> | ||
<body> | ||
<script> | ||
registration_tests_mime_types(register_using_link, false); | ||
</script> | ||
</body> |
12 changes: 12 additions & 0 deletions
12
service-workers/service-worker/link-element-register-scope.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Register via link element (scope)</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-scope.js"></script> | ||
<body> | ||
<script> | ||
registration_tests_scope(register_using_link, false); | ||
</script> | ||
</body> | ||
|
11 changes: 11 additions & 0 deletions
11
service-workers/service-worker/link-element-register-script-url.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Register via link element (scriptURL)</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-url.js"></script> | ||
<body> | ||
<script> | ||
registration_tests_script_url(register_using_link, false); | ||
</script> | ||
</body> |
11 changes: 11 additions & 0 deletions
11
service-workers/service-worker/link-element-register-script.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Register via link element (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> | ||
<body> | ||
<script> | ||
registration_tests_script(register_using_link, false); | ||
</script> | ||
</body> |
11 changes: 11 additions & 0 deletions
11
service-workers/service-worker/link-element-register-security-error.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Register via link element (SecurityError)</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-security-error.js"></script> | ||
<body> | ||
<script> | ||
registration_tests_security_error(register_using_link, false); | ||
</script> | ||
</body> |
25 changes: 0 additions & 25 deletions
25
service-workers/service-worker/register-link-element.https.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Registration (basic)</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-basic.js"></script> | ||
<script> | ||
registration_tests_basic((script, options) => navigator.serviceWorker.register(script, options), true); | ||
</script> |
9 changes: 9 additions & 0 deletions
9
service-workers/service-worker/registration-mime-types.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Registration (MIME types)</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-mime-types.js"></script> | ||
<script> | ||
registration_tests_mime_types((script, options) => navigator.serviceWorker.register(script, options), true); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Registration (scope)</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-scope.js"></script> | ||
<script> | ||
registration_tests_scope((script, options) => navigator.serviceWorker.register(script, options), true); | ||
</script> |
9 changes: 9 additions & 0 deletions
9
service-workers/service-worker/registration-script-url.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Registration (scriptURL)</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-url.js"></script> | ||
<script> | ||
registration_tests_script_url((script, options) => navigator.serviceWorker.register(script, options), true); | ||
</script> |
9 changes: 9 additions & 0 deletions
9
service-workers/service-worker/registration-script.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Registration (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, options), true); | ||
</script> |
9 changes: 9 additions & 0 deletions
9
service-workers/service-worker/registration-security-error.https.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<title>Service Worker: Registration (SecurityError)</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-security-error.js"></script> | ||
<script> | ||
registration_tests_security_error((script, options) => navigator.serviceWorker.register(script, options), true); | ||
</script> |
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
service-workers/service-worker/resources/registration-tests-basic.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Basic registration tests that succeed. We don't want too many successful | ||
// registration tests in the same file since starting a service worker can be | ||
// slow. | ||
function registration_tests_basic(register_method, check_error_types) { | ||
promise_test(function(t) { | ||
var script = 'resources/registration-worker.js'; | ||
var scope = 'resources/registration/normal'; | ||
return register_method(script, {scope: scope}) | ||
.then(function(registration) { | ||
assert_true( | ||
registration instanceof ServiceWorkerRegistration, | ||
'Successfully registered.'); | ||
return registration.unregister(); | ||
}); | ||
}, 'Registering normal scope'); | ||
|
||
promise_test(function(t) { | ||
var script = 'resources/registration-worker.js'; | ||
var scope = 'resources/registration/scope-with-fragment#ref'; | ||
return register_method(script, {scope: scope}) | ||
.then(function(registration) { | ||
assert_true( | ||
registration instanceof ServiceWorkerRegistration, | ||
'Successfully registered.'); | ||
assert_equals( | ||
registration.scope, | ||
normalizeURL('resources/registration/scope-with-fragment'), | ||
'A fragment should be removed from scope') | ||
return registration.unregister(); | ||
}); | ||
}, 'Registering scope with fragment'); | ||
|
||
promise_test(function(t) { | ||
var script = 'resources/registration-worker.js'; | ||
var scope = 'resources/'; | ||
return register_method(script, {scope: scope}) | ||
.then(function(registration) { | ||
assert_true( | ||
registration instanceof ServiceWorkerRegistration, | ||
'Successfully registered.'); | ||
return registration.unregister(); | ||
}); | ||
}, 'Registering same scope as the script directory'); | ||
} |
86 changes: 86 additions & 0 deletions
86
service-workers/service-worker/resources/registration-tests-mime-types.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Registration tests that mostly verify the MIME type. | ||
// | ||
// This file tests every MIME type so it necessarily starts many service | ||
// workers, so it may be slow. | ||
function registration_tests_mime_types(register_method, check_error_types) { | ||
promise_test(function(t) { | ||
var script = 'resources/mime-type-worker.py'; | ||
var scope = 'resources/scope/no-mime-type-worker/'; | ||
return promise_rejects(t, | ||
check_error_types ? 'SecurityError' : null, | ||
register_method(script, {scope: scope}), | ||
'Registration of no MIME type script should fail.'); | ||
}, 'Registering script with no MIME type'); | ||
|
||
promise_test(function(t) { | ||
var script = 'resources/mime-type-worker.py?mime=text/plain'; | ||
var scope = 'resources/scope/bad-mime-type-worker/'; | ||
return promise_rejects(t, | ||
check_error_types ? 'SecurityError' : null, | ||
register_method(script, {scope: scope}), | ||
'Registration of plain text script should fail.'); | ||
}, 'Registering script with bad MIME type'); | ||
|
||
promise_test(function(t) { | ||
var script = 'resources/import-mime-type-worker.py'; | ||
var scope = 'resources/scope/no-mime-type-worker/'; | ||
return promise_rejects(t, | ||
check_error_types ? 'SecurityError' : null, | ||
register_method(script, {scope: scope}), | ||
'Registration of no MIME type imported script should fail.'); | ||
}, 'Registering script that imports script with no MIME type'); | ||
|
||
promise_test(function(t) { | ||
var script = 'resources/import-mime-type-worker.py?mime=text/plain'; | ||
var scope = 'resources/scope/bad-mime-type-worker/'; | ||
return promise_rejects(t, | ||
check_error_types ? 'SecurityError' : null, | ||
register_method(script, {scope: scope}), | ||
'Registration of plain text imported script should fail.'); | ||
}, 'Registering script that imports script with bad MIME type'); | ||
|
||
const validMimeTypes = [ | ||
'application/ecmascript', | ||
'application/javascript', | ||
'application/x-ecmascript', | ||
'application/x-javascript', | ||
'text/ecmascript', | ||
'text/javascript', | ||
'text/javascript1.0', | ||
'text/javascript1.1', | ||
'text/javascript1.2', | ||
'text/javascript1.3', | ||
'text/javascript1.4', | ||
'text/javascript1.5', | ||
'text/jscript', | ||
'text/livescript', | ||
'text/x-ecmascript', | ||
'text/x-javascript' | ||
]; | ||
|
||
for (const validMimeType of validMimeTypes) { | ||
promise_test(() => { | ||
var script = `resources/mime-type-worker.py?mime=${validMimeType}`; | ||
var scope = 'resources/scope/good-mime-type-worker/'; | ||
|
||
return register_method(script, {scope}).then(registration => { | ||
assert_true( | ||
registration instanceof ServiceWorkerRegistration, | ||
'Successfully registered.'); | ||
return registration.unregister(); | ||
}); | ||
}, `Registering script with good MIME type ${validMimeType}`); | ||
|
||
promise_test(() => { | ||
var script = `resources/import-mime-type-worker.py?mime=${validMimeType}`; | ||
var scope = 'resources/scope/good-mime-type-worker/'; | ||
|
||
return register_method(script, { scope }).then(registration => { | ||
assert_true( | ||
registration instanceof ServiceWorkerRegistration, | ||
'Successfully registered.'); | ||
return registration.unregister(); | ||
}); | ||
}, `Registering script that imports script with good MIME type ${validMimeType}`); | ||
} | ||
} |
Oops, something went wrong.