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 |
index 755b3c96b5ac01d9cf8cf7e507bc1f6bb57e8e5a..a2d5270a945077b2d6b94e80a5a7c860153b9396 100644 |
--- a/LayoutTests/http/tests/serviceworker/resources/response-content-worker.js |
+++ b/LayoutTests/http/tests/serviceworker/resources/response-content-worker.js |
@@ -14,7 +14,7 @@ promise_test(function() { |
}, 'Behavior of Response with string content.'); |
promise_test(function() { |
- var intView = new Int32Array([0, 1, 2, 3, 4, 55, 6, 7, 8, 9]); |
+ var intView = new Int32Array([0, 1, 2, 3, 4, 55, 6, 7, 8, 9]); |
var buffer = intView.buffer; |
var response = new Response(buffer); |
@@ -28,4 +28,38 @@ promise_test(function() { |
'Response body ArrayBuffer should match ArrayBuffer ' + |
'it was constructed with.'); |
}); |
- }, 'Behavior of Response with arraybuffer content.'); |
+ }, 'Behavior of Response with ArrayBuffer content.'); |
+ |
+promise_test(function() { |
+ var intView = new Int32Array([0, 1, 2, 3, 4, 55, 6, 7, 8, 9]); |
+ |
+ var response = new Response(intView); |
+ assert_false(response.headers.has('Content-Type'), |
+ 'A Response constructed with ArrayBufferView ' + |
+ '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 ArrayBufferView ' + |
+ 'it was constructed with.'); |
+ }); |
+ }, 'Behavior of Response with ArrayBufferView content without a slice.'); |
+ |
+promise_test(function() { |
+ var intView = new Int32Array([0, 1, 2, 3, 4, 55, 6, 7, 8, 9]); |
+ var slice = intView.subarray(1, 4); // Should be [1, 2, 3] |
+ var response = new Response(slice); |
+ assert_false(response.headers.has('Content-Type'), |
+ 'A Response constructed with ArrayBufferView ' + |
+ 'should not have a content type.'); |
+ return response.body.asArrayBuffer() |
+ .then(function(buffer) { |
+ var resultIntView = new Int32Array(buffer); |
+ assert_array_equals( |
+ resultIntView, [1, 2, 3], |
+ 'Response body ArrayBuffer should match ArrayBufferView ' + |
+ 'slice it was constructed with.'); |
+ }); |
+ }, 'Behavior of Response with ArrayBufferView content with a slice.'); |