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

Unified Diff: chrome/test/data/push_messaging/test.html

Issue 793403002: Implement WebPushProvider.unregister() in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mvan_2
Patch Set: browsertests and override fix 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
Index: chrome/test/data/push_messaging/test.html
diff --git a/chrome/test/data/push_messaging/test.html b/chrome/test/data/push_messaging/test.html
index 66b6e2f615bb890c652e8d8dd4b5ee464712d726..e48d371921428c52e4005aa230b54e20886ebf0e 100644
--- a/chrome/test/data/push_messaging/test.html
+++ b/chrome/test/data/push_messaging/test.html
@@ -5,6 +5,7 @@
<link rel="manifest" href="manifest.json">
<script>
var pushData = new FutureData();
+ var pushRegistration = null;
// Sends data back to the test. This must be in response to an earlier
// request, but it's ok to respond asynchronously. The request blocks until
@@ -88,7 +89,8 @@
navigator.serviceWorker.ready.then(function(swRegistration) {
// TODO(mvanouwerkerk): Cleanup once the final API is exposed.
var pushManager = swRegistration.pushManager || navigator.push;
- pushManager.register().then(function(pushRegistration) {
+ pushManager.register().then(function(registration) {
+ pushRegistration = registration;
sendResultToTest(pushRegistration.pushEndpoint + ' - ' +
pushRegistration.pushRegistrationId);
}, sendErrorToTest);
@@ -113,6 +115,17 @@
}
}
+ function unregister() {
+ if (!pushRegistration) {
+ sendErrorToTest('no registration');
+ return;
+ }
+
+ pushRegistration.unregister().then(function(result) {
+ sendResultToTest('unregister result: ' + result);
+ });
+ }
+
addEventListener('message', function(event) {
var message = JSON.parse(event.data);
if (message.type == 'push') {

Powered by Google App Engine
This is Rietveld 408576698