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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html

Issue 2691903005: ServiceWorker: Change base URL for parsing script URL and scope URL (Closed)
Patch Set: Fix 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 <meta charset="utf-8"> 2 <meta charset="utf-8">
3 <title>Background Sync API: Verifies that the one-shot sync API works 3 <title>Background Sync API: Verifies that the one-shot sync API works
4 correctly.</title> 4 correctly.</title>
5 <script src="../resources/permissions-helper.js"></script> 5 <script src="../resources/permissions-helper.js"></script>
6 <script src="../resources/testharness.js"></script> 6 <script src="../resources/testharness.js"></script>
7 <script src="../resources/testharnessreport.js"></script> 7 <script src="../resources/testharnessreport.js"></script>
8 <script src="../serviceworker/resources/test-helpers.js"></script> 8 <script src="../serviceworker/resources/test-helpers.js"></script>
9 <script> 9 <script>
10 10
11 promise_test(function(t) { 11 promise_test(function(t) {
12 var url = 'resources/empty_worker.js'; 12 var url = 'resources/empty_worker.js';
13 var scope = 'resources/scope/background_sync/oneshot.html'; 13 var scope = 'resources/scope/background_sync/oneshot.html';
14 var sync_manager; 14 var sync_manager;
15 var sync_registration; 15 var sync_registration;
16 16
17 // This test verifies that registration of one-shots fails from an iframe. 17 // This test verifies that registration of one-shots fails from an iframe.
18 return PermissionsHelper.setPermission('background-sync', 'granted') 18 return PermissionsHelper.setPermission('background-sync', 'granted')
19 .then(function() { 19 .then(function() {
20 return service_worker_unregister_and_register(t, url, scope); 20 return service_worker_unregister_and_register(t, url, scope);
21 }) 21 })
22 .then(function(sw_registration_page) { 22 .then(function(sw_registration_page) {
23 return wait_for_state(t, sw_registration_page.installing, 'activated'); 23 return wait_for_state(t, sw_registration_page.installing, 'activated');
24 }) 24 })
25 .then(function() { 25 .then(function() {
26 return with_iframe(scope) 26 return with_iframe(scope)
27 }) 27 })
28 .then(function(frame) { 28 .then(function(frame) {
29 var w = frame.contentWindow; 29 var w = frame.contentWindow;
30 return w.navigator.serviceWorker.getRegistration(scope); 30 return w.navigator.serviceWorker.getRegistration('oneshot.html');
falken 2017/02/24 06:49:27 I prefer to not repeat the 'oneshot.html' string.
jungkees 2017/02/24 12:25:26 Done.
31 }) 31 })
32 .then(function(sw_registration_frame) { 32 .then(function(sw_registration_frame) {
33 sync_manager = sw_registration_frame.sync; 33 sync_manager = sw_registration_frame.sync;
34 return sync_manager.getTags(); 34 return sync_manager.getTags();
35 }) 35 })
36 .then(function(tags) { 36 .then(function(tags) {
37 assert_equals(tags.length, 0, 'One-shot syncs should be ' + 37 assert_equals(tags.length, 0, 'One-shot syncs should be ' +
38 'cleared at the start of the test.'); 38 'cleared at the start of the test.');
39 return sync_manager.register('iframe-oneshot'); 39 return sync_manager.register('iframe-oneshot');
40 }) 40 })
(...skipping 24 matching lines...) Expand all
65 assert_equals(tags.length, 0, 'One-shot syncs should be ' + 65 assert_equals(tags.length, 0, 'One-shot syncs should be ' +
66 'cleared at the start of the test.'); 66 'cleared at the start of the test.');
67 return sync_manager.register('abcde'); 67 return sync_manager.register('abcde');
68 }) 68 })
69 .then(function() { 69 .then(function() {
70 return service_worker_unregister(t, scope); 70 return service_worker_unregister(t, scope);
71 }) 71 })
72 }, 'Background Sync API should allow one-shot syncs to be registered ' + 72 }, 'Background Sync API should allow one-shot syncs to be registered ' +
73 'from an uncontrolled main-frame document'); 73 'from an uncontrolled main-frame document');
74 </script> 74 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698