| 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 ed810e1bd39785e4f35d730fbe42d1b95a12ce3b..a02f3aea88cb33d0c9c3a13a5bfa8066daa1d9d1 100644
|
| --- a/chrome/test/data/push_messaging/push_test.js
|
| +++ b/chrome/test/data/push_messaging/push_test.js
|
| @@ -5,6 +5,7 @@
|
| 'use strict';
|
|
|
| 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
|
| @@ -91,7 +92,8 @@ function removeManifest() {
|
| function registerPush() {
|
| navigator.serviceWorker.ready.then(function(swRegistration) {
|
| return swRegistration.pushManager.register()
|
| - .then(function(pushRegistration) {
|
| + .then(function(registration) {
|
| + pushRegistration = registration
|
| sendResultToTest(pushRegistration.endpoint + ' - ' +
|
| pushRegistration.registrationId);
|
| });
|
| @@ -115,6 +117,19 @@ function isControlled() {
|
| }
|
| }
|
|
|
| +function unregister() {
|
| + if (!pushRegistration) {
|
| + sendResultToTest('unregister error: no registration');
|
| + return;
|
| + }
|
| +
|
| + pushRegistration.unregister().then(function(result) {
|
| + sendResultToTest('unregister result: ' + result);
|
| + }, function(error) {
|
| + sendResultToTest('unregister error: ' + error.name + ': ' + error.message);
|
| + });
|
| +}
|
| +
|
| addEventListener('message', function(event) {
|
| var message = JSON.parse(event.data);
|
| if (message.type == 'push') {
|
|
|