Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: LayoutTests/http/tests/serviceworker/fetch-body-stream.html

Issue 466723002: ServiceWorker: Enable ServiceWorkerRegistration and update layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@updatefound
Patch Set: update comments in service-worker-gc.html Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: fetch()</title> 2 <title>Service Worker: fetch()</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script> 5 <script src="resources/test-helpers.js"></script>
6 <script> 6 <script>
7 var test = async_test('Verify FetchBodyStream in a Service Worker'); 7 async_test(function(t) {
8
9 test.step(function() {
10 var scope = 'resources/blank.html'; 8 var scope = 'resources/blank.html';
11 service_worker_unregister_and_register( 9 service_worker_unregister_and_register(
12 test, 'resources/fetch-body-stream-worker.js', scope).then(test.step_fun c(onRegister)); 10 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.
13 11 .then(function(registration) {
14 function onRegister(worker) { 12 return wait_for_update(t, registration);
13 })
14 .then(function(sw) {
15 var messageChannel = new MessageChannel(); 15 var messageChannel = new MessageChannel();
16 messageChannel.port1.onmessage = test.step_func(onMessage); 16 messageChannel.port1.onmessage = t.step_func(onMessage);
17 worker.postMessage({port: messageChannel.port2}, [messageChannel.port2]) ; 17 sw.postMessage({port: messageChannel.port2}, [messageChannel.port2]);
18 } 18 })
19 19 .catch(unreached_rejection(t));
20
20 var result = []; 21 var result = [];
21 var expected = [ 22 var expected = [
22 'Text: <!DOCTYPE html>\n', 23 'Text: <!DOCTYPE html>\n',
23 'JSON: 1 2', 24 'JSON: 1 2',
24 'JSON: SyntaxError', 25 'JSON: SyntaxError',
25 'Blob: 16 : text/html', 26 'Blob: 16 : text/html',
26 'ArrayBuffer: 16', 27 'ArrayBuffer: 16',
27 '<!DOCTYPE html>\n : TypeError', 28 '<!DOCTYPE html>\n : TypeError',
28 ]; 29 ];
29 30
30 function onMessage(e) { 31 function onMessage(e) {
31 var message = e.data; 32 var message = e.data;
32 if (message == 'quit') { 33 if (message == 'quit') {
33 assert_array_equals(result, expected, 'Worker should post back expec ted values.'); 34 assert_array_equals(result, expected,
34 service_worker_unregister_and_done(test, scope); 35 'Worker should post back expected values.');
35 } else { 36 service_worker_unregister_and_done(t, scope);
36 result.push(message); 37 } else {
37 } 38 result.push(message);
39 }
38 } 40 }
39 }); 41 }, 'Verify FetchBodyStream in a Service Worker');
40 </script> 42 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698