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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/fetch/referrer/serviceworker-from-origin-only-document.html

Issue 2192743002: Rewrite Fetch API referrer layout tests with service worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 4 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
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <title>Fetch in a document with &quot;referrer origin&quot; policy and controlle d by a ServiceWorker</title> 3 <title>Fetch in a document with &quot;referrer origin&quot; policy and controlle d by a ServiceWorker</title>
4 <body>
4 <script src = "/resources/testharness.js"></script> 5 <script src = "/resources/testharness.js"></script>
5 <script src = "/resources/testharnessreport.js"></script> 6 <script src = "/resources/testharnessreport.js"></script>
7 <script src = "/serviceworker/resources/test-helpers.js"></script>
8 <script src = "/fetch/resources/fetch-test-helpers.js"></script>
9 <script src = "/fetch/resources/fetch-test-options.js"></script>
6 <script> 10 <script>
7 location = 11 const SCRIPT = '/fetch/referrer/resources/simple-onfetch.js';
8 '/fetch/referrer/resources/serviceworker-from-origin-only-document.html'; 12 const SCOPE = '/fetch/referrer/resources/empty-referrer-origin.html';
13
14 const BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php';
15 const OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php';
16 const REFERRER_SOURCE = BASE_ORIGIN + SCOPE;
17
18 const TESTS = [
19 [BASE_URL, 'about:client', '', BASE_ORIGIN + '/'],
20 [BASE_URL, 'about:client', 'no-referrer', '[no-referrer]'],
21 [BASE_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE],
22 [BASE_URL, 'about:client', 'origin', BASE_ORIGIN + '/'],
23 [BASE_URL, 'about:client', 'origin-when-cross-origin', REFERRER_SOURCE],
24 [BASE_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE],
25 [OTHER_URL, 'about:client', '', BASE_ORIGIN + '/'],
26 [OTHER_URL, 'about:client', 'no-referrer', '[no-referrer]'],
27 [OTHER_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE],
28 [OTHER_URL, 'about:client', 'origin', BASE_ORIGIN + '/'],
29 [OTHER_URL, 'about:client', 'origin-when-cross-origin', BASE_ORIGIN + '/'],
30 [OTHER_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE],
31
32 [BASE_URL, '', '', '[no-referrer]'],
33 [BASE_URL, '', 'no-referrer', '[no-referrer]'],
34 [BASE_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'],
35 [BASE_URL, '', 'origin', '[no-referrer]'],
36 [BASE_URL, '', 'origin-when-cross-origin', '[no-referrer]'],
37 [BASE_URL, '', 'unsafe-url', '[no-referrer]'],
38 [OTHER_URL, '', '', '[no-referrer]'],
39 [OTHER_URL, '', 'no-referrer', '[no-referrer]'],
40 [OTHER_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'],
41 [OTHER_URL, '', 'origin', '[no-referrer]'],
42 [OTHER_URL, '', 'origin-when-cross-origin', '[no-referrer]'],
43 [OTHER_URL, '', 'unsafe-url', '[no-referrer]'],
44
45 [BASE_URL, '/foo', '', BASE_ORIGIN + '/'],
46 [BASE_URL, '/foo', 'no-referrer', '[no-referrer]'],
47 [BASE_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'],
48 [BASE_URL, '/foo', 'origin', BASE_ORIGIN + '/'],
49 [BASE_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/foo'],
50 [BASE_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'],
51 [OTHER_URL, '/foo', '', BASE_ORIGIN + '/'],
52 [OTHER_URL, '/foo', 'no-referrer', '[no-referrer]'],
53 [OTHER_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'],
54 [OTHER_URL, '/foo', 'origin', BASE_ORIGIN + '/'],
55 [OTHER_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/'],
56 [OTHER_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'],
57 ];
58
59 promise_test(t => {
60 return service_worker_unregister_and_register(t, SCRIPT, SCOPE).then(r => {
61 add_completion_callback(() => r.unregister());
62 return wait_for_state(t, r.installing, 'activated');
63 }).then(() => {
64 return with_iframe(SCOPE);
65 }).then(frame => {
66 add_completion_callback(() => frame.remove());
67 add_referrer_tests(TESTS, frame.contentWindow);
68 });
69 });
9 </script> 70 </script>
10 </html> 71 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698