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') { |