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

Side by Side Diff: LayoutTests/http/tests/serviceworker/chromium/postmessage-after-terminate.html

Issue 695643002: Add terminateServiceWorker method for layout tests - blink side (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 6 years, 1 month 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/chromium/resources/ping-worker.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Tests that postMessage works during and after terminating a service worke r</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../../resources/testharness-helpers.js"></script>
6 <script src="../resources/test-helpers.js"></script>
7 <script>
8
dominicc (has gone to gerrit) 2014/11/20 05:48:08 Delete this and the trailing blank line.
Marijn Kruisselbrink 2014/11/20 19:28:22 Done.
9 function sendPing(worker) {
10 return new Promise(function(resolve) {
11 var channel = new MessageChannel();
12 channel.port1.onmessage = function(message) {
13 resolve(message.data);
14 };
15 worker.postMessage({port: channel.port2}, [channel.port2]);
16 });
17 }
18
19 promise_test(function(test) {
20 var worker = 'resources/ping-worker.js';
21 var scope = 'resources/blank.html';
22 var sw;
23 return service_worker_unregister_and_register(test, worker, scope)
24 .then(function(registration) {
25 return wait_for_update(test, registration);
26 })
27 .then(function(worker) {
28 sw = worker;
29 return sendPing(sw);
30 })
31 .then(function(reply) {
32 assert_equals(reply, 1);
33 return internals.terminateServiceWorker(sw);
34 })
35 .then(function() {
36 return sendPing(sw);
37 })
38 .then(function(reply) {
39 assert_equals(reply, 1);
40 return sendPing(sw);
41 })
42 .then(function(reply) {
43 assert_equals(reply, 2);
44 return service_worker_unregister_and_done(test, scope);
45 });
46 }, 'Terminate terminates the worker.');
47
48 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/chromium/resources/ping-worker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698