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

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: Rebase. 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 <html>
Peter Beverloo 2014/10/20 12:45:22 Carry-forward since you did not reply. ===== nit
Michael van Ouwerkerk 2014/10/20 15:30:37 Done.
2 <head>
3 <title>Push API</title>
Peter Beverloo 2014/10/20 12:45:22 Carry-forward since you did not reply. ===== mic
Michael van Ouwerkerk 2014/10/20 15:30:37 It's a test, so I marked it as such now. Not sure
4 <script>
5 function sendResultToTest(result) {
6 console.log(result);
7 if (window.domAutomationController) {
8 domAutomationController.send('' + result);
9 }
10 }
11
12 function sendErrorToTest(error) {
13 sendResultToTest(error.name + ' - ' + error.message);
14 }
15
16 function registerServiceWorker() {
17 navigator.serviceWorker.register('sw.js').then(function(swRegistration) {
18 console.log(swRegistration);
19 sendResultToTest('ok');
20 }, sendErrorToTest);
21 }
22
23 function registerPush(senderId) {
24 navigator.serviceWorker.ready.then(function() {
25 navigator.push.register(senderId).then(function(pushRegistration) {
26 sendResultToTest(pushRegistration.pushEndpoint + ' - ' + pushRegistrat ion.pushRegistrationId);
27 }, sendErrorToTest);
28 }, sendErrorToTest);
29 }
30 </script>
31 </head>
32 <body>Push API</body>
33 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698