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

Side by Side Diff: LayoutTests/http/tests/serviceworker/registration-events.html

Issue 674133004: [ServiceWorker] Introduce the directory restriction of ServiceWorker scope [1/3 blink] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/scope-default.html 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: registration events</title> 2 <title>Service Worker: registration events</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('Registration: events'); 7 var t = async_test('Registration: events');
8 t.step(function() { 8 t.step(function() {
9 var scope = '/in-scope/'; 9 var scope = 'resources/in-scope/';
10 service_worker_unregister_and_register( 10 service_worker_unregister_and_register(
11 t, 'resources/events-worker.js', scope) 11 t, 'resources/events-worker.js', scope)
12 .then(t.step_func(function(registration) { 12 .then(t.step_func(function(registration) {
13 return wait_for_update(t, registration); 13 return wait_for_update(t, registration);
14 })) 14 }))
15 .then(t.step_func(onRegister)) 15 .then(t.step_func(onRegister))
16 .catch(unreached_rejection(t)); 16 .catch(unreached_rejection(t));
17 17
18 function sendMessagePort(worker, from) { 18 function sendMessagePort(worker, from) {
19 var messageChannel = new MessageChannel(); 19 var messageChannel = new MessageChannel();
20 worker.postMessage({from:from, port:messageChannel.port2}, [messageChann el.port2]); 20 worker.postMessage({from:from, port:messageChannel.port2}, [messageChann el.port2]);
21 return messageChannel.port1; 21 return messageChannel.port1;
22 } 22 }
23 23
24 function onRegister(sw) { 24 function onRegister(sw) {
25 sw.onstatechange = t.step_func(function() { 25 sw.onstatechange = t.step_func(function() {
26 if (sw.state !== 'activated') 26 if (sw.state !== 'activated')
27 return; 27 return;
28 28
29 sendMessagePort(sw, 'registering doc').onmessage = t.step_func(funct ion (e) { 29 sendMessagePort(sw, 'registering doc').onmessage = t.step_func(funct ion (e) {
30 assert_array_equals(e.data.events, 30 assert_array_equals(e.data.events,
31 ['install', 'activate'], 31 ['install', 'activate'],
32 'Worker should see install then activate even ts'); 32 'Worker should see install then activate even ts');
33 service_worker_unregister_and_done(t, scope); 33 service_worker_unregister_and_done(t, scope);
34 }); 34 });
35 }); 35 });
36 } 36 }
37 }); 37 });
38 </script> 38 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698