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

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

Issue 1001153003: ServiceWorker: Reenable "ready" for push messaging browsertest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 490febcfad40e27c1f4e906a49ebc3805471a7b8..be99f626758be52981619306697ee0e4d1853747 100644
--- a/chrome/test/data/push_messaging/push_test.js
+++ b/chrome/test/data/push_messaging/push_test.js
@@ -92,23 +92,8 @@ function removeManifest() {
}
}
-// TODO(xiang): Remove this function after "ready" CL landed.
-function getReadyRegistration() {
- return navigator.serviceWorker.getRegistration().then(function(r) {
- if (r.active)
- return r;
- var worker = r.waiting ? r.waiting : r.installing;
- return new Promise(function(resolve) {
- worker.onstatechange = function() {
- if (worker.state === 'activating')
- resolve(r);
- };
- });
- });
-}
-
function registerPush() {
- getReadyRegistration().then(function(swRegistration) {
+ navigator.serviceWorker.ready.then(function(swRegistration) {
var registerMethodName =
swRegistration.pushManager.register ? 'register' : 'subscribe';
return swRegistration.pushManager[registerMethodName]()
@@ -121,7 +106,7 @@ function registerPush() {
}
function hasPermission() {
- getReadyRegistration().then(function(swRegistration) {
+ navigator.serviceWorker.ready.then(function(swRegistration) {
return swRegistration.pushManager.hasPermission()
.then(function(permission) {
sendResultToTest('permission status - ' + permission);
@@ -153,7 +138,7 @@ function unregister() {
}
function hasRegistration() {
- getReadyRegistration().then(function(swRegistration) {
+ navigator.serviceWorker.ready.then(function(swRegistration) {
return swRegistration.pushManager.getSubscription();
}).then(function(subscription) {
sendResultToTest(subscription ? 'true - registered'
« 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