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..92a47cede1799c76666235b52722ea24de92ee2a |
--- /dev/null |
+++ b/LayoutTests/http/tests/serviceworker/resources/response-content-worker.js |
@@ -0,0 +1,21 @@ |
+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'); |
jsbell
2014/09/08 20:32:48
style: wrap to 80 characters
See: http://www.chro
jsbell
2014/09/08 20:32:48
Always have an assertion message; ideally, phrased
dmurph
2014/09/08 20:59:29
Done.
dmurph
2014/09/08 20:59:30
Done.
|
+ return response.body.asText().then(function(text) { |
jsbell
2014/09/08 20:32:48
style: wrap before .then
dmurph
2014/09/08 20:59:30
Done.
|
+ assert_equals(text, "test string"); |
jsbell
2014/09/08 20:32:48
Add message to assertion
dmurph
2014/09/08 20:59:30
Done.
|
+ }); |
+}, 'Behavior of Response with string content.'); |
+ |
+promise_test(function() { |
+ var intView = new Int32Array([0,1,2,3,4,5,6,7,8,9]); |
+ var buffer = intView.buffer; |
+ |
+ var response = new Response(buffer); |
+ assert_false(response.headers.has('Content-Type')); |
jsbell
2014/09/08 20:32:48
Add message to assertion
dmurph
2014/09/08 20:59:29
Done.
|
+ return response.body.asArrayBuffer().then(function(buffer) { |
jsbell
2014/09/08 20:32:48
style: wrap before the .then
dmurph
2014/09/08 20:59:30
Done.
|
+ var resultIntView = new Int32Array(buffer); |
jsbell
2014/09/08 20:32:48
nit: extra space before the =
dmurph
2014/09/08 20:59:29
Done.
|
+ assert_array_equals(resultIntView, [0,1,2,3,4,5,6,7,8,9]); |
jsbell
2014/09/08 20:32:48
Add message to assertion
dmurph
2014/09/08 20:59:30
Done.
|
+ }); |
+}, 'Behavior of Response with arraybuffer content.'); |