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 origin: 'https://www.example.com/', | |
falken
2014/05/30 02:31:20
origin should be removed, it isn't in the spec's R
horo
2014/05/30 04:04:04
Done.
| |
12 headers: headers | 13 headers: headers |
13 }); | 14 }); |
14 | 15 |
15 assert_equals(response.status, 303, 'Response.status should match'); | 16 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'); | 17 assert_equals(request.method, 'GET', 'Request.method should match'); |
17 assert_true(response.headers instanceof HeaderMap, 'Response.headers should be HeaderMap'); | 18 assert_equals(request.origin, 'https://www.example.com/', 'Request.origin sh ould match'); |
18 assert_equals(response.headers.size, 3, 'Response.headers.size should match' ); | 19 assert_true(request.headers instanceof HeaderMap, 'Request.headers should be HeaderMap'); |
20 assert_equals(request.headers.size, 3, 'Request.headers.size should match'); | |
19 // Note: detailed behavioral tests for HeaderMap are in another test, | 21 // Note: detailed behavioral tests for HeaderMap are in another test, |
20 // http/tests/serviceworker/headermap.html. | 22 // http/tests/serviceworker/headermap.html. |
21 | 23 |
22 }, 'Response in ServiceWorkerGlobalScope'); | 24 }, 'Request in ServiceWorkerGlobalScope'); |
OLD | NEW |