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

Unified Diff: chrome/test/data/push_messaging/push_test.js

Issue 827083004: Push API: handle both register and subscribe in browsertests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/push_messaging/push_test.js
diff --git a/chrome/test/data/push_messaging/push_test.js b/chrome/test/data/push_messaging/push_test.js
index a02f3aea88cb33d0c9c3a13a5bfa8066daa1d9d1..49a73ab69b2a5417f786261fdd2b7f288885df86 100644
--- a/chrome/test/data/push_messaging/push_test.js
+++ b/chrome/test/data/push_messaging/push_test.js
@@ -91,11 +91,13 @@ function removeManifest() {
function registerPush() {
navigator.serviceWorker.ready.then(function(swRegistration) {
- return swRegistration.pushManager.register()
+ var registerMethodName =
+ swRegistration.pushManager.register ? 'register' : 'subscribe';
+ return swRegistration.pushManager[registerMethodName]()
.then(function(registration) {
- pushRegistration = registration
- sendResultToTest(pushRegistration.endpoint + ' - ' +
- pushRegistration.registrationId);
+ pushRegistration = registration;
+ sendResultToTest(registration.endpoint + ' - ' +
+ (registration.registrationId || registration.subscriptionId));
});
}).catch(sendErrorToTest);
}
@@ -123,7 +125,9 @@ function unregister() {
return;
}
- pushRegistration.unregister().then(function(result) {
+ var unregisterMethodName =
+ pushRegistration.unregister ? 'unregister' : 'unsubscribe';
+ pushRegistration[unregisterMethodName]().then(function(result) {
sendResultToTest('unregister result: ' + result);
}, function(error) {
sendResultToTest('unregister error: ' + error.name + ': ' + error.message);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698