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

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

Issue 805863002: Push API: rename to endpoint and registrationId [1/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years 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 2998b199f4601ff712a093575cb8d444c917d8b0..1076f3fb99dc3a4a96c489b3daf6adb8a7e5bc23 100644
--- a/chrome/test/data/push_messaging/push_test.js
+++ b/chrome/test/data/push_messaging/push_test.js
@@ -83,28 +83,31 @@ function removeManifest() {
if (element) {
element.parentNode.removeChild(element);
sendResultToTest('manifest removed');
- } else
- sendResultToTest('unable to find manifest element');
+ } else {
+ sendResultToTest('unable to find manifest element');
+ }
}
function registerPush() {
navigator.serviceWorker.ready.then(function(swRegistration) {
- // TODO(mvanouwerkerk): Cleanup once the final API is exposed.
- var pushManager = swRegistration.pushManager || navigator.push;
- return pushManager.register().then(function(pushRegistration) {
- sendResultToTest(pushRegistration.pushEndpoint + ' - ' +
- pushRegistration.pushRegistrationId);
- });
+ return swRegistration.pushManager.register()
+ .then(function(pushRegistration) {
+ // TODO: Cleanup once the final API is exposed.
+ var endpoint = pushRegistration.endpoint ||
+ pushRegistration.pushEndpoint;
+ var registrationId = pushRegistration.registrationId ||
+ pushRegistration.pushRegistrationId;
+ sendResultToTest(endpoint + ' - ' + registrationId);
+ });
}).catch(sendErrorToTest);
}
function hasPermission() {
navigator.serviceWorker.ready.then(function(swRegistration) {
- // TODO(mvanouwerkerk): Cleanup once the final API is exposed.
- var pushManager = swRegistration.pushManager || navigator.push;
- return pushManager.hasPermission().then(function(permission) {
- sendResultToTest('permission status - ' + permission);
- });
+ return swRegistration.pushManager.hasPermission()
+ .then(function(permission) {
+ sendResultToTest('permission status - ' + permission);
+ });
}).catch(sendErrorToTest);
}
« 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