Index: chrome/test/data/push_messaging/test.html |
diff --git a/chrome/test/data/push_messaging/test.html b/chrome/test/data/push_messaging/test.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..45c20a20cc96d6324aa616f733fcc91139f045c8 |
--- /dev/null |
+++ b/chrome/test/data/push_messaging/test.html |
@@ -0,0 +1,33 @@ |
+<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.
|
+ <head> |
+ <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
|
+ <script> |
+ function sendResultToTest(result) { |
+ console.log(result); |
+ if (window.domAutomationController) { |
+ domAutomationController.send('' + result); |
+ } |
+ } |
+ |
+ function sendErrorToTest(error) { |
+ sendResultToTest(error.name + ' - ' + error.message); |
+ } |
+ |
+ function registerServiceWorker() { |
+ navigator.serviceWorker.register('sw.js').then(function(swRegistration) { |
+ console.log(swRegistration); |
+ sendResultToTest('ok'); |
+ }, sendErrorToTest); |
+ } |
+ |
+ function registerPush(senderId) { |
+ navigator.serviceWorker.ready.then(function() { |
+ navigator.push.register(senderId).then(function(pushRegistration) { |
+ sendResultToTest(pushRegistration.pushEndpoint + ' - ' + pushRegistration.pushRegistrationId); |
+ }, sendErrorToTest); |
+ }, sendErrorToTest); |
+ } |
+ </script> |
+ </head> |
+ <body>Push API</body> |
+</html> |