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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-event.html

Issue 1816473002: Add layout tests to check that a FetchEvent includes the right headers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use const Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-event-test-worker.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-event.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-event.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-event.html
index a27c2b9490fdff21e50bdaec2743070d49166626..496a24028bb63d67cb1e26d9199832def2ff0044 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-event.html
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/fetch-event.html
@@ -7,6 +7,34 @@
var worker = 'resources/fetch-event-test-worker.js';
async_test(function(t) {
+ const scope = 'resources/simple.html?headers';
+ service_worker_unregister_and_register(t, worker, scope)
+ .then(function(reg) {
+ return wait_for_state(t, reg.installing, 'activated');
+ })
+ .then(function() { return with_iframe(scope); })
+ .then(function(frame) {
+ // We have this test to prevent unexpected exposure of headers to a
+ // ServiceWorker. Feel free to rebaseline this expectation if it
+ // looks good.
+ const headers = JSON.parse(frame.contentDocument.body.textContent);
+ const header_names = [];
+ for (const [name, value] of headers) {
+ header_names.push(name);
+ }
+ header_names.sort();
+ assert_array_equals(
+ header_names,
+ ["accept", "upgrade-insecure-requests", "user-agent"],
+ 'event.request has the expected headers.');
+
+ frame.remove();
+ return service_worker_unregister_and_done(t, scope);
+ })
+ .catch(unreached_rejection(t));
+ }, 'Service Worker headers in the request of a fetch event');
+
+async_test(function(t) {
var scope = 'resources/simple.html?string';
service_worker_unregister_and_register(t, worker, scope)
.then(function(reg) {
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-event-test-worker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698