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

Side by Side Diff: chrome/test/data/push_messaging/test.html

Issue 686133003: Reject push registrations when no sender Id has been provided. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 6 years, 1 month 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Push API Test</title> 4 <title>Push API Test</title>
5 <link rel="manifest" href="manifest.json"> 5 <link rel="manifest" href="manifest.json">
6 <script> 6 <script>
7 var pushData = new FutureData(); 7 var pushData = new FutureData();
8 8
9 // Sends data back to the test. This must be in response to an earlier 9 // Sends data back to the test. This must be in response to an earlier
10 // request, but it's ok to respond asynchronously. The request blocks until 10 // request, but it's ok to respond asynchronously. The request blocks until
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 }; 49 };
50 50
51 function registerServiceWorker() { 51 function registerServiceWorker() {
52 navigator.serviceWorker.register('service_worker.js', {scope: './'}).then( 52 navigator.serviceWorker.register('service_worker.js', {scope: './'}).then(
53 function(swRegistration) { 53 function(swRegistration) {
54 sendResultToTest('ok - service worker registered'); 54 sendResultToTest('ok - service worker registered');
55 }, sendErrorToTest); 55 }, sendErrorToTest);
56 } 56 }
57 57
58 function removeManifest() {
59 var element = document.querySelector('link[rel="manifest"]');
60 if (element) {
61 element.parentNode.removeChild(element);
62 sendResultToTest('manifest removed');
63 } else
64 sendResultToTest('unable to find manifest element');
65 }
66
58 function registerPush() { 67 function registerPush() {
59 navigator.serviceWorker.ready.then(function() { 68 navigator.serviceWorker.ready.then(function() {
60 navigator.push.register().then(function(pushRegistration) { 69 navigator.push.register().then(function(pushRegistration) {
61 sendResultToTest(pushRegistration.pushEndpoint + ' - ' + 70 sendResultToTest(pushRegistration.pushEndpoint + ' - ' +
62 pushRegistration.pushRegistrationId); 71 pushRegistration.pushRegistrationId);
63 }, sendErrorToTest); 72 }, sendErrorToTest);
64 }, sendErrorToTest); 73 }, sendErrorToTest);
65 } 74 }
66 75
67 function isControlled() { 76 function isControlled() {
68 if (navigator.serviceWorker.controller) { 77 if (navigator.serviceWorker.controller) {
69 sendResultToTest('true - is controlled'); 78 sendResultToTest('true - is controlled');
70 } else { 79 } else {
71 sendResultToTest('false - is not controlled'); 80 sendResultToTest('false - is not controlled');
72 } 81 }
73 } 82 }
74 83
75 addEventListener('message', function(event) { 84 addEventListener('message', function(event) {
76 var message = JSON.parse(event.data); 85 var message = JSON.parse(event.data);
77 if (message.type == 'push') { 86 if (message.type == 'push') {
78 pushData.set(message.data); 87 pushData.set(message.data);
79 } 88 }
80 }, false); 89 }, false);
81 </script> 90 </script>
82 </head> 91 </head>
83 <body> 92 <body>
84 <h1>Push API Test</h1> 93 <h1>Push API Test</h1>
85 </body> 94 </body>
86 </html> 95 </html>
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/push_messaging_browsertest.cc ('k') | content/public/common/push_messaging_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698