Chromium Code Reviews| 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 c1fe6aa2edb0638936982fdcb8d1a27fa0770c5a..c639072675874c9fd678dee5621b24f16286920a 100644 |
| --- a/chrome/test/data/push_messaging/push_test.js |
| +++ b/chrome/test/data/push_messaging/push_test.js |
| @@ -7,10 +7,18 @@ |
| var resultQueue = new ResultQueue(); |
| var pushSubscription = null; |
| -var pushSubscriptionOptions = { |
| +var pushSubscriptionOptionsWithoutKey = { |
| userVisibleOnly: true |
| }; |
| +var pushSubscriptionOptions = { |
| + userVisibleOnly: true, |
| + using_public_key: false, |
|
Peter Beverloo
2016/02/17 16:15:35
This boolean is not Web exposed ;-).
harkness
2016/02/18 10:45:14
Done.
|
| + // TODO(harkness) When the validity of the public key is actually checked, |
| + // this value will need to be updated. |
| + appServicePublicKey: new ArrayBuffer("1234567890") |
| +}; |
| + |
| // 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 |
| // the response is sent. |
| @@ -106,6 +114,19 @@ function swapManifestNoSenderId() { |
| } |
| } |
| +// This is the old style of push subscriptions which we are phasing away |
| +// from, where the subscription used a sender ID instead of public key. |
| +function subscribePushWithoutKey() { |
| + navigator.serviceWorker.ready.then(function(swRegistration) { |
| + return swRegistration.pushManager.subscribe( |
| + pushSubscriptionOptionsWithoutKey) |
| + .then(function(subscription) { |
| + pushSubscription = subscription; |
| + sendResultToTest(subscription.endpoint); |
| + }); |
| + }).catch(sendErrorToTest); |
| +} |
| + |
| function subscribePush() { |
| navigator.serviceWorker.ready.then(function(swRegistration) { |
| return swRegistration.pushManager.subscribe(pushSubscriptionOptions) |