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

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

Issue 648623003: PushMessagingBrowserTest for registration success and failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Move profile setter. Created 6 years, 2 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Push API Test</title>
5 <script>
6 function sendResultToTest(result) {
7 console.log(result);
8 if (window.domAutomationController) {
9 domAutomationController.send('' + result);
10 }
11 }
12
13 function sendErrorToTest(error) {
14 sendResultToTest(error.name + ' - ' + error.message);
15 }
16
17 function registerServiceWorker() {
18 navigator.serviceWorker.register('service_worker.js').then(function(swRegi stration) {
19 console.log(swRegistration);
20 sendResultToTest('ok');
21 }, sendErrorToTest);
22 }
23
24 function registerPush(senderId) {
25 navigator.serviceWorker.ready.then(function() {
26 navigator.push.register(senderId).then(function(pushRegistration) {
27 sendResultToTest(pushRegistration.pushEndpoint + ' - ' + pushRegistrat ion.pushRegistrationId);
28 }, sendErrorToTest);
29 }, sendErrorToTest);
30 }
31 </script>
32 </head>
33 <body>Push API Test</body>
34 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698