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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.fetch-event-headers.html

Issue 2836233002: Upstream service worker `fetch` tests to WPT (Closed)
Patch Set: Created 3 years, 7 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 <!-- This test is prefixed with `chromium.` because it asserts a precise list
3 of expected header names, but but such precision is not mandated by the
4 relevant specifications. It should be maintained only to the extent that this
5 precision is relevant to Chromium internals; the Web Platform Tests project
6 includes a relaxed version which allows for additional headers. -->
7 <script src="../resources/testharness.js"></script>
8 <script src="../resources/testharnessreport.js"></script>
9 <script src="resources/test-helpers.js"></script>
10 <body>
11 <script>
12 var worker = 'resources/fetch-event-test-worker.js';
13
14 async_test(function(t) {
Marijn Kruisselbrink 2017/04/27 17:05:23 nit: promise_test?
mike3 2017/04/27 18:27:19 Acknowledged.
15 const scope = 'resources/simple.html?headers';
16 service_worker_unregister_and_register(t, worker, scope)
17 .then(function(reg) {
18 return wait_for_state(t, reg.installing, 'activated');
19 })
20 .then(function() { return with_iframe(scope); })
21 .then(function(frame) {
22 t.add_cleanup(function() { frame.remove(); });
23 // We have this test to prevent unexpected exposure of headers to a
24 // ServiceWorker. Feel free to rebaseline this expectation if it
25 // looks good.
26 const headers = JSON.parse(frame.contentDocument.body.textContent);
27 const header_names = [];
28 for (const [name, value] of headers) {
29 header_names.push(name);
30 }
31 header_names.sort();
32 assert_array_equals(
33 header_names,
34 ["accept", "upgrade-insecure-requests", "user-agent"],
35 'event.request has the expected headers.');
36
37 return service_worker_unregister_and_done(t, scope);
38 })
39 .catch(unreached_rejection(t));
40 }, 'Service Worker headers in the request of a fetch event');
41 </script>
42 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698