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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/controller-on-load.https.html

Issue 2778223003: Upstream service worker `controller` tests to WPT (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/controller-on-load.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Service Worker: Controller on load</title> 2 <title>Service Worker: Controller on load</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.sub.js"></script> 5 <script src="resources/test-helpers.sub.js"></script>
6 <body> 6 <body>
7 <script> 7 <script>
8 var t = async_test('controller is set for a controlled document'); 8 var t = async_test('controller is set for a controlled document');
9 t.step(function() { 9 t.step(function() {
10 var url = 'resources/empty-worker.js'; 10 var url = 'resources/empty-worker.js';
11 var scope = 'resources/blank.html'; 11 var scope = 'resources/blank.html';
12 var registration; 12 var registration;
13 var controller; 13 var controller;
14 var frame; 14 var frame;
15 service_worker_unregister_and_register(t, url, scope) 15 service_worker_unregister_and_register(t, url, scope)
16 .then(t.step_func(function(swr) { 16 .then(t.step_func(function(swr) {
17 registration = swr; 17 registration = swr;
18 return wait_for_state(t, registration.installing, 'activated'); 18 return wait_for_state(t, registration.installing, 'activated');
19 })) 19 }))
20 .then(t.step_func(function() { 20 .then(t.step_func(function() {
21 return with_iframe(scope) 21 return with_iframe(scope);
22 })) 22 }))
23 .then(t.step_func(function(f) { 23 .then(t.step_func(function(f) {
24 frame = f; 24 frame = f;
25 var w = frame.contentWindow; 25 var w = frame.contentWindow;
26 controller = w.navigator.serviceWorker.controller; 26 controller = w.navigator.serviceWorker.controller;
27 assert_true(controller instanceof w.ServiceWorker, 27 assert_true(controller instanceof w.ServiceWorker,
28 'controller should be a ServiceWorker object'); 28 'controller should be a ServiceWorker object');
29 assert_equals(controller.scriptURL, normalizeURL(url)); 29 assert_equals(controller.scriptURL, normalizeURL(url));
30 30
31 // objects from different windows should not be equal 31 // objects from different windows should not be equal
32 assert_not_equals(controller, registration.active); 32 assert_not_equals(controller, registration.active);
33 33
34 return w.navigator.serviceWorker.getRegistration(); 34 return w.navigator.serviceWorker.getRegistration();
35 })) 35 }))
36 .then(t.step_func(function(frameRegistration) { 36 .then(t.step_func(function(frameRegistration) {
37 // SW objects from same window should be equal 37 // SW objects from same window should be equal
38 assert_equals(frameRegistration.active, controller); 38 assert_equals(frameRegistration.active, controller);
39 frame.remove(); 39 frame.remove();
40 service_worker_unregister_and_done(t, scope); 40 service_worker_unregister_and_done(t, scope);
41 })) 41 }))
42 .catch(unreached_rejection(t)); 42 .catch(unreached_rejection(t));
43 }); 43 });
44 </script> 44 </script>
45 </body> 45 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/controller-on-load.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698