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

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

Issue 1437883002: [Background Sync] Align exposed API with spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src@remove-periodic
Patch Set: Rebase Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html b/third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html
index 87663fa605934e6ff869de26d4fa917abeda20db..e2090b943753f1e4c25657725ad3118aa32c0d53 100644
--- a/third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html
+++ b/third_party/WebKit/LayoutTests/http/tests/background_sync/oneshot.html
@@ -6,7 +6,6 @@
<script src="../resources/testharness-helpers.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../serviceworker/resources/test-helpers.js"></script>
-<script src="resources/test-helpers.js"></script>
<script>
promise_test(function(t) {
@@ -15,9 +14,9 @@ promise_test(function(t) {
var sync_manager;
var sync_registration;
- // One-shot syncs can only be registered from a controlled document. This
- // test creates a frame, after the service worker is active, in order to use
- // its service worker registration.
+ // This test verifies that one-shot syncs can be registered from service-
+ // worker-controlled documents. It 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_page) {
return wait_for_state(t, sw_registration_page.installing, 'activated');
@@ -31,21 +30,14 @@ promise_test(function(t) {
})
.then(function(sw_registration_frame) {
sync_manager = sw_registration_frame.sync;
- return clear_registered_syncs(sync_manager);
+ return sync_manager.getTags();
})
- .then(function() { return sync_manager.getRegistrations(); })
- .then(function(registrations) {
- assert_equals(registrations.length, 0, 'One-shot syncs should be ' +
+ .then(function(tags) {
+ assert_equals(tags.length, 0, 'One-shot syncs should be ' +
'cleared at the start of the test.');
- return sync_manager.register({tag: 'abcde'});
+ return sync_manager.register('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.');
+ .then(function() {
return service_worker_unregister(t, scope);
});
}, 'Background Sync API should allow one-shot syncs to be registered from ' +
@@ -57,31 +49,22 @@ promise_test(function(t) {
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.
+ // This test verifies that one-shot syncs can be registered from uncontrolled
+ // documents.
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 ' +
+ .then(function() { return sync_manager.getTags(); })
+ .then(function(tags) {
+ assert_equals(tags.length, 0, 'One-shot syncs should be ' +
'cleared at the start of the test.');
- return sync_manager.register({tag: 'abcde'});
+ return sync_manager.register('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.');
+ .then(function() {
return service_worker_unregister(t, scope);
})
- .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>

Powered by Google App Engine
This is Rietveld 408576698