| 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 2998b199f4601ff712a093575cb8d444c917d8b0..e4fc1c7bbdb80b350bb208579d12314bb96f0cba 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,9 +92,10 @@ function registerPush() {
|
| navigator.serviceWorker.ready.then(function(swRegistration) {
|
| // TODO(mvanouwerkerk): Cleanup once the final API is exposed.
|
| var pushManager = swRegistration.pushManager || navigator.push;
|
| - return pushManager.register().then(function(pushRegistration) {
|
| - sendResultToTest(pushRegistration.pushEndpoint + ' - ' +
|
| - pushRegistration.pushRegistrationId);
|
| + return pushManager.register().then(function(registration) {
|
| + pushRegistration = registration;
|
| + sendResultToTest(registration.pushEndpoint + ' - ' +
|
| + registration.pushRegistrationId);
|
| });
|
| }).catch(sendErrorToTest);
|
| }
|
| @@ -116,6 +118,17 @@ function isControlled() {
|
| }
|
| }
|
|
|
| +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') {
|
|
|