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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/register-link-header.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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <!-- FIXME: Move this test out of chromium/ when PHP is no longer needed
3 to set the Link header (crbug.com/347864).
4 -->
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <script src="../resources/test-helpers.js"></script>
8 <body>
9 <script>
10 promise_test(function(t) {
11 var scope = normalizeURL('resources/blank.html?fetch');
12 var header = '<empty-worker.js>; rel=serviceworker; scope="' + scope + '"';
13 var resource = 'resources/link-header.php?Link=' +
14 encodeURIComponent(header);
15 return with_iframe(scope)
16 .then(frame =>
17 Promise.all([frame.contentWindow.navigator.serviceWorker.ready,
18 fetch(resource)]))
19 .then(([registration, response]) => {
20 assert_equals(registration.scope, scope);
21 });
22 }, 'fetch can trigger service worker installation');
23
24 promise_test(function(t) {
25 var scope = normalizeURL('resources/blank.html?iframe');
26 var header = '<empty-worker.js>; rel=serviceworker; scope="' + scope + '"';
27 var resource = 'resources/link-header.php?Link=' +
28 encodeURIComponent(header);
29 return with_iframe(scope)
30 .then(frame =>
31 Promise.all([frame.contentWindow.navigator.serviceWorker.ready,
32 with_iframe(resource)]))
33 .then(([registration, frame]) => {
34 assert_equals(registration.scope, scope);
35 });
36 }, 'An iframe can trigger service worker installation');
37
38 promise_test(function(t) {
39 var scope = normalizeURL('resources/blank.html?css');
40 var header = '<empty-worker.js>; rel=serviceworker; scope="' + scope + '"';
41 var resource = 'resources/link-header.php?Link=' +
42 encodeURIComponent(header);
43 return with_iframe(scope)
44 .then(frame => {
45 var link = document.createElement('link');
46 link.setAttribute('rel', 'stylesheet');
47 link.setAttribute('type', 'text/css');
48 link.setAttribute('href', resource);
49 document.getElementsByTagName('head')[0].appendChild(link);
50 return frame.contentWindow.navigator.serviceWorker.ready;
51 })
52 .then(registration => {
53 assert_equals(registration.scope, scope);
54 });
55 }, 'A stylesheet can trigger service worker installation');
56
57 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698