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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/controller-on-reload.html

Issue 2691903005: ServiceWorker: Change base URL for parsing script URL and scope URL (Closed)
Patch Set: Address comments on tests Created 3 years, 10 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: Controller on reload</title> 2 <title>Service Worker: Controller on reload</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 <body> 6 <body>
7 <script> 7 <script>
8 promise_test(function(t) { 8 promise_test(function(t) {
9 var scope = 'resources/blank.html'; 9 var scope = 'resources/blank.html';
10 var frame; 10 var frame;
11 return service_worker_unregister(t, scope) 11 return service_worker_unregister(t, scope)
12 .then(function() { 12 .then(function() {
13 return with_iframe(scope); 13 return with_iframe(scope);
14 }) 14 })
15 .then(function(f) { 15 .then(function(f) {
16 frame = f; 16 frame = f;
17 return frame.contentWindow.navigator.serviceWorker.register( 17 return frame.contentWindow.navigator.serviceWorker.register(
18 'resources/empty-worker.js', {scope: scope}); 18 'empty-worker.js', {scope: 'blank.html'});
19 }) 19 })
20 .then(function(registration) { 20 .then(function(registration) {
21 return wait_for_state(t, registration.installing, 'activated'); 21 return wait_for_state(t, registration.installing, 'activated');
22 }) 22 })
23 .then(function() { 23 .then(function() {
24 var w = frame.contentWindow; 24 var w = frame.contentWindow;
25 assert_equals(w.navigator.serviceWorker.controller, null, 25 assert_equals(w.navigator.serviceWorker.controller, null,
26 'controller should be null until the document is ' + 26 'controller should be null until the document is ' +
27 'reloaded'); 27 'reloaded');
28 return new Promise(function(resolve) { 28 return new Promise(function(resolve) {
29 frame.onload = function() { resolve(); } 29 frame.onload = function() { resolve(); }
30 w.location.reload(); 30 w.location.reload();
31 }); 31 });
32 }) 32 })
33 .then(function() { 33 .then(function() {
34 var w = frame.contentWindow; 34 var w = frame.contentWindow;
35 assert_true( 35 assert_true(
36 w.navigator.serviceWorker.controller instanceof w.ServiceWorker, 36 w.navigator.serviceWorker.controller instanceof w.ServiceWorker,
37 'controller should be a ServiceWorker object upon reload'); 37 'controller should be a ServiceWorker object upon reload');
38 frame.remove(); 38 frame.remove();
39 service_worker_unregister_and_done(t, scope); 39 service_worker_unregister_and_done(t, scope);
40 }); 40 });
41 }, 'controller is set upon reload after registration'); 41 }, 'controller is set upon reload after registration');
42 </script> 42 </script>
43 </body> 43 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698