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

Unified Diff: content/test/data/background_sync/background_sync_test_helpers.js

Issue 1358063004: Use mojo to connect to BackgroundSyncManager object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make platform impl control cleanup of main thread provider Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/test/data/background_sync/background_sync_test_helpers.js
diff --git a/content/test/data/background_sync/background_sync_test_helpers.js b/content/test/data/background_sync/background_sync_test_helpers.js
index ac175df9fd816f8033359308dec41bfc81a89aad..6d5f65eb47d362c855f5c700bbe9e9d1ff58af64 100644
--- a/content/test/data/background_sync/background_sync_test_helpers.js
+++ b/content/test/data/background_sync/background_sync_test_helpers.js
@@ -43,6 +43,15 @@ function registerOneShot(tag) {
.catch(sendErrorToTest);
}
+function registerOneShotFromServiceWorker(tag) {
+ navigator.serviceWorker.ready
+ .then(function(swRegistration) {
+ swRegistration.active.postMessage({action: 'registerOneShot', tag: tag});
+ sendResultToTest('ok - ' + tag + ' register sent to SW');
+ })
+ .catch(sendErrorToTest);
+}
+
function unregisterOneShot(tag) {
navigator.serviceWorker.ready
.then(function(swRegistration) {
@@ -97,6 +106,16 @@ function getRegistrationOneShot(tag) {
.catch(sendErrorToTest);
}
+function getRegistrationOneShotFromServiceWorker(tag) {
+ navigator.serviceWorker.ready
+ .then(function(swRegistration) {
+ swRegistration.active.postMessage(
+ {action: 'getRegistrationOneShot', tag: tag});
jkarlin 2015/10/08 15:43:14 4 space indent for the argument to the function ca
+ sendResultToTest('ok - getRegistration sent to SW');
+ })
+ .catch(sendErrorToTest);
+}
+
function getRegistrationsOneShot(tag) {
navigator.serviceWorker.ready
.then(function(swRegistration) {
@@ -111,6 +130,15 @@ function getRegistrationsOneShot(tag) {
.catch(sendErrorToTest);
}
+function getRegistrationsOneShotFromServiceWorker() {
+ navigator.serviceWorker.ready
+ .then(function(swRegistration) {
+ swRegistration.active.postMessage({action: 'getRegistrationsOneShot'});
+ sendResultToTest('ok - getRegistrations sent to SW');
+ })
+ .catch(sendErrorToTest);
+}
+
function completeDelayedOneShot() {
navigator.serviceWorker.ready
.then(function(swRegistration) {
@@ -203,6 +231,6 @@ ResultQueue.prototype.popImmediately = function() {
navigator.serviceWorker.addEventListener('message', function(event) {
var message = event.data;
- if (message.type == 'sync')
+ if (message.type == 'sync' || message.type === 'register')
resultQueue.push(message.data);
-}, false);
+}, false);

Powered by Google App Engine
This is Rietveld 408576698