OLD | NEW |
---|---|
1 importScripts('worker-test-harness.js'); | 1 importScripts('worker-test-harness.js'); |
2 importScripts('test-helpers.js'); | 2 importScripts('test-helpers.js'); |
3 | 3 |
4 var URL = 'https://www.example.com/test.html'; | 4 var URL = 'https://www.example.com/test.html'; |
5 | 5 |
6 test(function() { | 6 test(function() { |
7 var headers = new Headers; | 7 var headers = new Headers; |
8 headers.set('User-Agent', 'Mozilla/5.0'); | 8 headers.set('User-Agent', 'Mozilla/5.0'); |
9 headers.set('Accept', 'text/html'); | 9 headers.set('Accept', 'text/html'); |
10 headers.set('X-ServiceWorker-Test', 'request test field'); | 10 headers.set('X-ServiceWorker-Test', 'request test field'); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 } | 337 } |
338 }); | 338 }); |
339 return content_type; | 339 return content_type; |
340 }; | 340 }; |
341 var request = | 341 var request = |
342 new Request(URL, | 342 new Request(URL, |
343 { | 343 { |
344 method: 'POST', | 344 method: 'POST', |
345 body: new Blob(['Test Blob'], {type: 'test/type'}) | 345 body: new Blob(['Test Blob'], {type: 'test/type'}) |
346 }); | 346 }); |
347 var original_request = request; | |
horo
2014/09/29 04:07:40
nit: This file is not related. Remove this.
dmurph
2014/09/29 22:53:24
Done.
| |
347 assert_equals( | 348 assert_equals( |
348 getContentType(request.headers), 'test/type', | 349 getContentType(request.headers), 'test/type', |
349 'ContentType header of Request created with Blob body must be set.'); | 350 'ContentType header of Request created with Blob body must be set.'); |
350 assert_false(request.bodyUsed, | 351 assert_false(request.bodyUsed, |
351 'bodyUsed must be true before calling text()'); | 352 'bodyUsed must be true before calling text()'); |
352 request.text() | 353 request.text() |
353 .then(function(result) { | 354 .then(function(result) { |
354 assert_equals(result, 'Test Blob', | 355 assert_equals(result, 'Test Blob', |
355 'Creating a Request with Blob body should success.'); | 356 'Creating a Request with Blob body should success.'); |
356 | 357 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 result, expected_body, | 423 result, expected_body, |
423 'Creating a Request with FormData body should success.'); | 424 'Creating a Request with FormData body should success.'); |
424 }) | 425 }) |
425 .then(function() { | 426 .then(function() { |
426 t.done(); | 427 t.done(); |
427 }) | 428 }) |
428 .catch(unreached_rejection(t)); | 429 .catch(unreached_rejection(t)); |
429 assert_true(request.bodyUsed, | 430 assert_true(request.bodyUsed, |
430 'bodyUsed must be true after calling text()'); | 431 'bodyUsed must be true after calling text()'); |
431 }, 'Request body test in ServiceWorkerGlobalScope'); | 432 }, 'Request body test in ServiceWorkerGlobalScope'); |
OLD | NEW |