Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 importScripts('worker-test-harness.js'); | |
| 2 | |
| 3 promise_test(function() { | |
| 4 var response = new Response('test string'); | |
|
horo
2014/09/09 01:38:50
+2 indent
http://www.chromium.org/blink/servicewor
dmurph
2014/09/09 19:06:02
Done.
| |
| 5 assert_equals( | |
| 6 response.headers.get('Content-Type'), | |
| 7 'text/plain;charset=UTF-8', | |
| 8 'A Response constructed with a string should have a Content-Type.'); | |
| 9 return response.body.asText() | |
| 10 .then(function(text) { | |
| 11 assert_equals(text, 'test string', | |
|
horo
2014/09/09 01:38:50
+2 indent
return response.body.asText()
.th
dmurph
2014/09/09 19:06:02
Done.
| |
| 12 'Response body text should match the string on construction.'); | |
| 13 }); | |
| 14 }, 'Behavior of Response with string content.'); | |
| 15 | |
| 16 promise_test(function() { | |
| 17 var intView = new Int32Array([0, 1, 2, 3, 4, 55, 6, 7, 8, 9]); | |
|
horo
2014/09/09 01:38:50
ditto
dmurph
2014/09/09 19:06:02
Done.
| |
| 18 var buffer = intView.buffer; | |
| 19 | |
| 20 var response = new Response(buffer); | |
| 21 assert_false(response.headers.has('Content-Type'), | |
| 22 'A Response constructed with ArrayBuffer should not have a content type.'); | |
| 23 return response.body.asArrayBuffer() | |
| 24 .then(function(buffer) { | |
| 25 var resultIntView = new Int32Array(buffer); | |
|
horo
2014/09/09 01:38:50
ditto
dmurph
2014/09/09 19:06:02
Done.
| |
| 26 assert_array_equals( | |
| 27 resultIntView, [0, 1, 2, 3, 4, 55, 6, 7, 8, 9], | |
| 28 'Response body ArrayBuffer should match ArrayBuffer ' + | |
| 29 'it was constructed with.'); | |
| 30 }); | |
| 31 }, 'Behavior of Response with arraybuffer content.'); | |
| OLD | NEW |