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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/request-worker.js

Issue 304053003: ServiceWorker: support Request.{url,method,origin,headers} [blink] (1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/serviceworker/resources/request-worker.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/response-worker.js b/LayoutTests/http/tests/serviceworker/resources/request-worker.js
similarity index 26%
copy from LayoutTests/http/tests/serviceworker/resources/response-worker.js
copy to LayoutTests/http/tests/serviceworker/resources/request-worker.js
index a55dba64db4f9ad299827d7a5d3a708309dae0cf..1c69cfd4990bab6ce36a8c11a5e9dfc17d77a122 100644
--- a/LayoutTests/http/tests/serviceworker/resources/response-worker.js
+++ b/LayoutTests/http/tests/serviceworker/resources/request-worker.js
@@ -2,21 +2,22 @@ importScripts('worker-test-helpers.js');
test(function() {
var headers = new HeaderMap;
- headers.set('Content-Language', 'ja');
- headers.set('Content-Type', 'text/html; charset=UTF-8');
- headers.set('X-ServiceWorker-Test', 'response test field');
+ headers.set('User-Agent', 'Mozilla/5.0');
+ headers.set('Accept', 'text/html');
+ headers.set('X-ServiceWorker-Test', 'request test field');
- var response = new Response({
- status: 303,
- statusText: 'See Other',
+ var request = new Request({
+ url: 'https://www.example.com/test.html',
+ method: 'GET',
headers: headers
});
- assert_equals(response.status, 303, 'Response.status should match');
- assert_equals(response.statusText, 'See Other', 'Response.statusText should match');
- assert_true(response.headers instanceof HeaderMap, 'Response.headers should be HeaderMap');
- assert_equals(response.headers.size, 3, 'Response.headers.size should match');
+ assert_equals(request.url, 'https://www.example.com/test.html', 'Request.url should match');
+ assert_equals(request.method, 'GET', 'Request.method should match');
+ assert_equals(request.origin, 'https://www.example.com', 'Request.origin should match');
+ assert_true(request.headers instanceof HeaderMap, 'Request.headers should be HeaderMap');
+ assert_equals(request.headers.size, 3, 'Request.headers.size should match');
// Note: detailed behavioral tests for HeaderMap are in another test,
// http/tests/serviceworker/headermap.html.
-}, 'Response in ServiceWorkerGlobalScope');
+}, 'Request in ServiceWorkerGlobalScope');

Powered by Google App Engine
This is Rietveld 408576698