Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/fetch-body-stream.html |
| diff --git a/LayoutTests/http/tests/serviceworker/fetch-body-stream.html b/LayoutTests/http/tests/serviceworker/fetch-body-stream.html |
| index a6d5d7e2da2c8d92fabc4da76235dc4b57ba01d4..88c99998203a96dcf0321db4ead622e00084b931 100644 |
| --- a/LayoutTests/http/tests/serviceworker/fetch-body-stream.html |
| +++ b/LayoutTests/http/tests/serviceworker/fetch-body-stream.html |
| @@ -4,37 +4,39 @@ |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="resources/test-helpers.js"></script> |
| <script> |
| -var test = async_test('Verify FetchBodyStream in a Service Worker'); |
| - |
| -test.step(function() { |
| +async_test(function(t) { |
| var scope = 'resources/blank.html'; |
| service_worker_unregister_and_register( |
| - test, 'resources/fetch-body-stream-worker.js', scope).then(test.step_func(onRegister)); |
| - |
| - function onRegister(worker) { |
| + t, 'resources/fetch-body-stream-worker.js', scope) |
|
falken
2014/08/14 14:23:14
i think you indent an additional 2 space here
nhiroki
2014/08/14 16:37:53
Done.
|
| + .then(function(registration) { |
| + return wait_for_update(t, registration); |
| + }) |
| + .then(function(sw) { |
| var messageChannel = new MessageChannel(); |
| - messageChannel.port1.onmessage = test.step_func(onMessage); |
| - worker.postMessage({port: messageChannel.port2}, [messageChannel.port2]); |
| - } |
| - |
| + messageChannel.port1.onmessage = t.step_func(onMessage); |
| + sw.postMessage({port: messageChannel.port2}, [messageChannel.port2]); |
| + }) |
| + .catch(unreached_rejection(t)); |
| + |
| var result = []; |
| var expected = [ |
| - 'Text: <!DOCTYPE html>\n', |
| - 'JSON: 1 2', |
| - 'JSON: SyntaxError', |
| - 'Blob: 16 : text/html', |
| - 'ArrayBuffer: 16', |
| - '<!DOCTYPE html>\n : TypeError', |
| + 'Text: <!DOCTYPE html>\n', |
| + 'JSON: 1 2', |
| + 'JSON: SyntaxError', |
| + 'Blob: 16 : text/html', |
| + 'ArrayBuffer: 16', |
| + '<!DOCTYPE html>\n : TypeError', |
| ]; |
| function onMessage(e) { |
| - var message = e.data; |
| - if (message == 'quit') { |
| - assert_array_equals(result, expected, 'Worker should post back expected values.'); |
| - service_worker_unregister_and_done(test, scope); |
| - } else { |
| - result.push(message); |
| - } |
| + var message = e.data; |
| + if (message == 'quit') { |
| + assert_array_equals(result, expected, |
| + 'Worker should post back expected values.'); |
| + service_worker_unregister_and_done(t, scope); |
| + } else { |
| + result.push(message); |
| + } |
| } |
| -}); |
| + }, 'Verify FetchBodyStream in a Service Worker'); |
| </script> |