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

Unified Diff: chrome/test/data/push_messaging/push_test.js

Issue 1701313002: Partial implementation of subscription restrictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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/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)

Powered by Google App Engine
This is Rietveld 408576698