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

Side by Side Diff: chrome/test/data/push_messaging/push_test.js

Issue 1078873004: Address the TODOs in the PushMessagingBrowserTest for the endpoint merge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@push-subscriptionId
Patch Set: rebase Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/push_messaging/push_messaging_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 var resultQueue = new ResultQueue(); 7 var resultQueue = new ResultQueue();
8 var pushSubscription = null; 8 var pushSubscription = null;
9 9
10 // Sends data back to the test. This must be in response to an earlier 10 // Sends data back to the test. This must be in response to an earlier
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } else { 90 } else {
91 sendResultToTest('unable to find manifest element'); 91 sendResultToTest('unable to find manifest element');
92 } 92 }
93 } 93 }
94 94
95 function subscribePush() { 95 function subscribePush() {
96 navigator.serviceWorker.ready.then(function(swRegistration) { 96 navigator.serviceWorker.ready.then(function(swRegistration) {
97 return swRegistration.pushManager.subscribe() 97 return swRegistration.pushManager.subscribe()
98 .then(function(subscription) { 98 .then(function(subscription) {
99 pushSubscription = subscription; 99 pushSubscription = subscription;
100 sendResultToTest( 100 sendResultToTest(subscription.endpoint);
101 subscription.endpoint + ' - ' + subscription.subscriptionId);
102 }); 101 });
103 }).catch(sendErrorToTest); 102 }).catch(sendErrorToTest);
104 } 103 }
105 104
106 function permissionState() { 105 function permissionState() {
107 navigator.serviceWorker.ready.then(function(swRegistration) { 106 navigator.serviceWorker.ready.then(function(swRegistration) {
108 return swRegistration.pushManager.permissionState() 107 return swRegistration.pushManager.permissionState()
109 .then(function(permission) { 108 .then(function(permission) {
110 sendResultToTest('permission status - ' + permission); 109 sendResultToTest('permission status - ' + permission);
111 }); 110 });
(...skipping 28 matching lines...) Expand all
140 sendResultToTest(subscription ? 'true - subscribed' 139 sendResultToTest(subscription ? 'true - subscribed'
141 : 'false - not subscribed'); 140 : 'false - not subscribed');
142 }).catch(sendErrorToTest); 141 }).catch(sendErrorToTest);
143 } 142 }
144 143
145 addEventListener('message', function(event) { 144 addEventListener('message', function(event) {
146 var message = JSON.parse(event.data); 145 var message = JSON.parse(event.data);
147 if (message.type == 'push') 146 if (message.type == 'push')
148 resultQueue.push(message.data); 147 resultQueue.push(message.data);
149 }, false); 148 }, false);
OLDNEW
« no previous file with comments | « chrome/browser/push_messaging/push_messaging_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698