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

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

Issue 930963002: Move the PushMessagingBrowserTest to use SWR.showNotification(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/service_worker.js
diff --git a/chrome/test/data/push_messaging/service_worker.js b/chrome/test/data/push_messaging/service_worker.js
index 3633517343532b8355f70ac6a531a641c5cd041c..5366ce47422c47aee88953c2018f8e2c2c3052b0 100644
--- a/chrome/test/data/push_messaging/service_worker.js
+++ b/chrome/test/data/push_messaging/service_worker.js
@@ -3,18 +3,13 @@
// found in the LICENSE file.
this.onpush = function(event) {
- // TODO(peter): Remove this check once Blink supports PushMessageData.json().
- var data = event.data;
- if (typeof data !== 'string')
- data = data.text();
-
+ var data = event.data.text();
if (data !== 'shownotification') {
sendMessageToClients('push', data);
return;
}
- // TODO(peter): Switch to self.registration.showNotification once implemented.
- event.waitUntil(showLegacyNonPersistentNotification('Push test title', {
+ event.waitUntil(registration.showNotification('Push test title', {
body: 'Push test body',
tag: 'push_test_tag'
}).then(function(notification) {
@@ -37,11 +32,3 @@ function sendMessageToClients(type, data) {
console.log(error);
});
}
-
-function showLegacyNonPersistentNotification(title, options) {
- return new Promise(function(resolve, reject) {
- var notification = new Notification(title, options);
- notification.onshow = function() { resolve(notification); };
- notification.onerror = function() { reject(new Error('Failed to show')); };
- });
-}
« 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