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

Side by Side Diff: LayoutTests/http/tests/serviceworker/postmessage-msgport-to-client.html

Issue 1130113006: ServiceWorker: Introduce ServiceWorkerMessageEvent to replace MessageEvent (3/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: make more tests pass Created 5 years, 5 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: postMessage to Client</title> 2 <title>Service Worker: postMessage to Client</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 t = async_test('postMessage MessagePorts from ServiceWorker to Client'); 7 var t = async_test('postMessage MessagePorts from ServiceWorker to Client');
8 t.step(function() { 8 t.step(function() {
9 var scope = 'resources/blank.html' 9 var scope = 'resources/blank.html'
10 service_worker_unregister_and_register( 10 service_worker_unregister_and_register(
11 t, 'resources/postmessage-msgport-to-client-worker.js', scope) 11 t, 'resources/postmessage-msgport-to-client-worker.js', scope)
12 .then(function(registration) { 12 .then(function(registration) {
13 return wait_for_state(t, registration.installing, 'activated'); 13 return wait_for_state(t, registration.installing, 'activated');
14 }) 14 })
15 .then(function() { return with_iframe(scope); }) 15 .then(function() { return with_iframe(scope); })
16 .then(function(frame) { 16 .then(function(frame) {
17 var w = frame.contentWindow; 17 var w = frame.contentWindow;
18 w.onmessage = t.step_func(onMessage); 18 w.navigator.serviceWorker.onmessage = t.step_func(onMessage);
19 w.navigator.serviceWorker.controller.postMessage('ping'); 19 w.navigator.serviceWorker.controller.postMessage('ping');
20 }) 20 })
21 .catch(unreached_rejection(t)); 21 .catch(unreached_rejection(t));
22 22
23 var result = []; 23 var result = [];
24 var expected = [ 24 var expected = [
25 'Acking value: 1', 25 'Acking value: 1',
26 'Acking value: 2', 26 'Acking value: 2',
27 ]; 27 ];
28 28
(...skipping 10 matching lines...) Expand all
39 assert_array_equals( 39 assert_array_equals(
40 result, expected, 40 result, expected,
41 'Worker should post back expected values via MessagePort.'); 41 'Worker should post back expected values via MessagePort.');
42 service_worker_unregister_and_done(t, scope); 42 service_worker_unregister_and_done(t, scope);
43 } else { 43 } else {
44 assert_unreached('Got unexpected message from ServiceWorker'); 44 assert_unreached('Got unexpected message from ServiceWorker');
45 } 45 }
46 } 46 }
47 }); 47 });
48 </script> 48 </script>
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/interfaces.html ('k') | LayoutTests/http/tests/serviceworker/postmessage-to-client.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698