OLD | NEW |
1 importScripts('worker-test-helpers.js'); | 1 importScripts('worker-test-helpers.js'); |
2 | 2 |
3 test(function() { | 3 test(function() { |
4 var headers = new HeaderMap; | 4 var headers = new HeaderMap; |
5 headers.set('Content-Language', 'ja'); | 5 headers.set('User-Agent', 'Mozilla/5.0'); |
6 headers.set('Content-Type', 'text/html; charset=UTF-8'); | 6 headers.set('Accept', 'text/html'); |
7 headers.set('X-ServiceWorker-Test', 'response test field'); | 7 headers.set('X-ServiceWorker-Test', 'request test field'); |
8 | 8 |
9 var response = new Response({ | 9 var request = new Request({ |
10 status: 303, | 10 url: 'https://www.example.com/test.html', |
11 statusText: 'See Other', | 11 method: 'GET', |
12 headers: headers | 12 headers: headers |
13 }); | 13 }); |
14 | 14 |
15 assert_equals(response.status, 303, 'Response.status should match'); | 15 assert_equals(request.url, 'https://www.example.com/test.html', 'Request.url
should match'); |
16 assert_equals(response.statusText, 'See Other', 'Response.statusText should
match'); | 16 assert_equals(request.method, 'GET', 'Request.method should match'); |
17 assert_true(response.headers instanceof HeaderMap, 'Response.headers should
be HeaderMap'); | 17 assert_equals(request.origin, 'https://www.example.com', 'Request.origin sho
uld match'); |
18 assert_equals(response.headers.size, 3, 'Response.headers.size should match'
); | 18 assert_true(request.headers instanceof HeaderMap, 'Request.headers should be
HeaderMap'); |
| 19 assert_equals(request.headers.size, 3, 'Request.headers.size should match'); |
19 // Note: detailed behavioral tests for HeaderMap are in another test, | 20 // Note: detailed behavioral tests for HeaderMap are in another test, |
20 // http/tests/serviceworker/headermap.html. | 21 // http/tests/serviceworker/headermap.html. |
21 | 22 |
22 }, 'Response in ServiceWorkerGlobalScope'); | 23 }, 'Request in ServiceWorkerGlobalScope'); |
OLD | NEW |