Chromium Code Reviews| Index: LayoutTests/http/tests/background_sync/oneshot.html |
| diff --git a/LayoutTests/http/tests/background_sync/oneshot.html b/LayoutTests/http/tests/background_sync/oneshot.html |
| index fd8f698ab06d77ce7ec838519b1dcd1a44ee2ed2..87663fa605934e6ff869de26d4fa917abeda20db 100644 |
| --- a/LayoutTests/http/tests/background_sync/oneshot.html |
| +++ b/LayoutTests/http/tests/background_sync/oneshot.html |
| @@ -51,10 +51,37 @@ promise_test(function(t) { |
| }, 'Background Sync API should allow one-shot syncs to be registered from ' + |
| 'the Document scope'); |
| -// The test which verified that uncontrolled window clients could not register |
| -// sync events is out-of-date, and so has been removed. Uncontrolled window |
| -// clients should be allowed to register sync events, as long as they have a |
| -// registered service worker. |
| -// TODO(iclelland): Add a test which verifies the correct behaviour, as per |
| -// crbug/518884 |
| +promise_test(function(t) { |
| + var url = 'resources/empty_worker.js'; |
| + var scope = 'resources/scope/background_sync/oneshot-uncontrolled.html'; |
| + var sync_manager; |
| + var sync_registration; |
| + |
| + // One-shot syncs can also be registered from uncontrolled documents. This |
| + // test creates a frame, after the service worker is active, in order to use |
| + // its service worker registration. |
| + return service_worker_unregister_and_register(t, url, scope) |
| + .then(function(sw_registration) { |
| + sync_manager = sw_registration.sync; |
| + return wait_for_state(t, sw_registration.installing, 'activated'); |
| + }) |
| + .then(function() { return clear_registered_syncs(sync_manager); }) |
| + .then(function() { return sync_manager.getRegistrations(); }) |
| + .then(function(registrations) { |
| + assert_equals(registrations.length, 0, 'One-shot syncs should be ' + |
| + 'cleared at the start of the test.'); |
| + return sync_manager.register({tag: 'abcde'}); |
| + }) |
| + .then(function(registration) { |
| + sync_registration = registration; |
| + assert_class_string(sync_registration, 'SyncRegistration', 'One-' + |
| + 'shot sync registrations should have the correct ' + |
| + 'class name.'); |
| + assert_equals('abcde', registration.tag, 'Sync registration tag ' + |
| + 'returned should match the tag registered.'); |
| + 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
|
| + }) |
| + .then(function() { return service_worker_unregister(t, scope); }) |
| + }, 'Background Sync API should allow one-shot syncs to be registered ' + |
| + 'with window clients not currently controlled by service worker'); |
| </script> |