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

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: Added testing and integrated previous comments. 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..dd9f5f563f54a940dccf52d6d55d439e8d5b9277 100644
--- a/chrome/test/data/push_messaging/push_test.js
+++ b/chrome/test/data/push_messaging/push_test.js
@@ -7,10 +7,17 @@
var resultQueue = new ResultQueue();
var pushSubscription = null;
-var pushSubscriptionOptions = {
+var pushSubscriptionOptionsWithoutKey = {
userVisibleOnly: true
};
+var pushSubscriptionOptions = {
+ userVisibleOnly: true,
+ // TODO(harkness) When the validity of the public key is actually checked,
+ // this value will need to be updated.
Peter Beverloo 2016/02/23 14:28:28 Which is now? :)
+ 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 +113,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