Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/register-link-header.https.html

Issue 2674573004: Upstream Link: rel=serviceworker tests. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/register-link-header.https.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/register-link-header.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/register-link-header.https.html
similarity index 65%
rename from third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/register-link-header.html
rename to third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/register-link-header.https.html
index deacae0a98afb24d3c74253e2cedd7a9df666dd9..dd71c9b892ea4e1c022f6976795f1ee9730c6b94 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/register-link-header.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/register-link-header.https.html
@@ -1,16 +1,23 @@
<!DOCTYPE html>
-<!-- FIXME: Move this test out of chromium/ when PHP is no longer needed
- to set the Link header (crbug.com/347864).
--->
+<title>Service Worker: Registration using Link header</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-<script src="../resources/test-helpers.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
<body>
<script>
+function get_newest_worker(registration) {
+ if (registration.installing)
+ return registration.installing;
+ if (registration.waiting)
+ return registration.waiting;
+ if (registration.active)
+ return registration.active;
+}
+
promise_test(function(t) {
var scope = normalizeURL('resources/blank.html?fetch');
var header = '<empty-worker.js>; rel=serviceworker; scope="' + scope + '"';
- var resource = 'resources/link-header.php?Link=' +
+ var resource = 'resources/link-header.py?Link=' +
encodeURIComponent(header);
return with_iframe(scope)
.then(frame =>
@@ -18,13 +25,16 @@ promise_test(function(t) {
fetch(resource)]))
.then(([registration, response]) => {
assert_equals(registration.scope, scope);
+ assert_equals(get_newest_worker(registration).scriptURL,
+ normalizeURL('resources/empty-worker.js'));
+ return registration.unregister();
});
}, 'fetch can trigger service worker installation');
promise_test(function(t) {
var scope = normalizeURL('resources/blank.html?iframe');
var header = '<empty-worker.js>; rel=serviceworker; scope="' + scope + '"';
- var resource = 'resources/link-header.php?Link=' +
+ var resource = 'resources/link-header.py?Link=' +
encodeURIComponent(header);
return with_iframe(scope)
.then(frame =>
@@ -32,13 +42,16 @@ promise_test(function(t) {
with_iframe(resource)]))
.then(([registration, frame]) => {
assert_equals(registration.scope, scope);
+ assert_equals(get_newest_worker(registration).scriptURL,
+ normalizeURL('resources/empty-worker.js'));
+ return registration.unregister();
});
}, 'An iframe can trigger service worker installation');
promise_test(function(t) {
var scope = normalizeURL('resources/blank.html?css');
var header = '<empty-worker.js>; rel=serviceworker; scope="' + scope + '"';
- var resource = 'resources/link-header.php?Link=' +
+ var resource = 'resources/link-header.py?Link=' +
encodeURIComponent(header);
return with_iframe(scope)
.then(frame => {
@@ -51,6 +64,9 @@ promise_test(function(t) {
})
.then(registration => {
assert_equals(registration.scope, scope);
+ assert_equals(get_newest_worker(registration).scriptURL,
+ normalizeURL('resources/empty-worker.js'));
+ return registration.unregister();
});
}, 'A stylesheet can trigger service worker installation');

Powered by Google App Engine
This is Rietveld 408576698