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

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

Issue 1314453003: [Background Sync] Allow sync manager access from uncontrolled clients (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@uncontrolled-windows
Patch Set: Rebase against dependency patchset Created 5 years, 3 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 | public/platform/modules/background_sync/WebSyncProvider.h » ('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 <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/testharness.js"></script> 5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharness-helpers.js"></script> 6 <script src="../resources/testharness-helpers.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 src="resources/test-helpers.js"></script> 9 <script src="resources/test-helpers.js"></script>
10 <script> 10 <script>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 assert_class_string(sync_registration, 'SyncRegistration', 'One-' + 44 assert_class_string(sync_registration, 'SyncRegistration', 'One-' +
45 'shot sync registrations should have the correct ' + 45 'shot sync registrations should have the correct ' +
46 'class name.'); 46 'class name.');
47 assert_equals('abcde', registration.tag, 'Sync registration tag ' + 47 assert_equals('abcde', registration.tag, 'Sync registration tag ' +
48 'returned should match the tag registered.'); 48 'returned should match the tag registered.');
49 return service_worker_unregister(t, scope); 49 return service_worker_unregister(t, scope);
50 }); 50 });
51 }, 'Background Sync API should allow one-shot syncs to be registered from ' + 51 }, 'Background Sync API should allow one-shot syncs to be registered from ' +
52 'the Document scope'); 52 'the Document scope');
53 53
54 // The test which verified that uncontrolled window clients could not register 54 promise_test(function(t) {
55 // sync events is out-of-date, and so has been removed. Uncontrolled window 55 var url = 'resources/empty_worker.js';
56 // clients should be allowed to register sync events, as long as they have a 56 var scope = 'resources/scope/background_sync/oneshot-uncontrolled.html';
57 // registered service worker. 57 var sync_manager;
58 // TODO(iclelland): Add a test which verifies the correct behaviour, as per 58 var sync_registration;
59 // crbug/518884 59
60 // One-shot syncs can also be registered from uncontrolled documents. This
61 // test creates a frame, after the service worker is active, in order to use
62 // its service worker registration.
63 return service_worker_unregister_and_register(t, url, scope)
64 .then(function(sw_registration) {
65 sync_manager = sw_registration.sync;
66 return wait_for_state(t, sw_registration.installing, 'activated');
67 })
68 .then(function() { return clear_registered_syncs(sync_manager); })
69 .then(function() { return sync_manager.getRegistrations(); })
70 .then(function(registrations) {
71 assert_equals(registrations.length, 0, 'One-shot syncs should be ' +
72 'cleared at the start of the test.');
73 return sync_manager.register({tag: 'abcde'});
74 })
75 .then(function(registration) {
76 sync_registration = registration;
77 assert_class_string(sync_registration, 'SyncRegistration', 'One-' +
78 'shot sync registrations should have the correct ' +
79 'class name.');
80 assert_equals('abcde', registration.tag, 'Sync registration tag ' +
81 'returned should match the tag registered.');
82 return service_worker_unregister(t, scope);
jsbell 2015/09/01 16:25:08 Just a sanity check since I haven't been following
iclelland 2015/09/01 16:57:49 Yes, the BackgroundSyncManager is a ServiceWorkerC
83 })
84 .then(function() { return service_worker_unregister(t, scope); })
85 }, 'Background Sync API should allow one-shot syncs to be registered ' +
86 'with window clients not currently controlled by service worker');
60 </script> 87 </script>
OLDNEW
« no previous file with comments | « no previous file | public/platform/modules/background_sync/WebSyncProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698