| Index: LayoutTests/http/tests/serviceworker/resources/response-content-worker.js
|
| diff --git a/LayoutTests/http/tests/serviceworker/resources/response-content-worker.js b/LayoutTests/http/tests/serviceworker/resources/response-content-worker.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..755b3c96b5ac01d9cf8cf7e507bc1f6bb57e8e5a
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/serviceworker/resources/response-content-worker.js
|
| @@ -0,0 +1,31 @@
|
| +importScripts('worker-test-harness.js');
|
| +
|
| +promise_test(function() {
|
| + var response = new Response('test string');
|
| + assert_equals(
|
| + response.headers.get('Content-Type'),
|
| + 'text/plain;charset=UTF-8',
|
| + 'A Response constructed with a string should have a Content-Type.');
|
| + return response.body.asText()
|
| + .then(function(text) {
|
| + assert_equals(text, 'test string',
|
| + 'Response body text should match the string on construction.');
|
| + });
|
| + }, 'Behavior of Response with string content.');
|
| +
|
| +promise_test(function() {
|
| + var intView = new Int32Array([0, 1, 2, 3, 4, 55, 6, 7, 8, 9]);
|
| + var buffer = intView.buffer;
|
| +
|
| + var response = new Response(buffer);
|
| + assert_false(response.headers.has('Content-Type'),
|
| + 'A Response constructed with ArrayBuffer should not have a content type.');
|
| + return response.body.asArrayBuffer()
|
| + .then(function(buffer) {
|
| + var resultIntView = new Int32Array(buffer);
|
| + assert_array_equals(
|
| + resultIntView, [0, 1, 2, 3, 4, 55, 6, 7, 8, 9],
|
| + 'Response body ArrayBuffer should match ArrayBuffer ' +
|
| + 'it was constructed with.');
|
| + });
|
| + }, 'Behavior of Response with arraybuffer content.');
|
|
|