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

Unified 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 side-by-side diff with in-line comments
Download patch
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..407695698f89695224c755778a9469741c1da770
--- /dev/null
+++ b/chrome/test/data/push_messaging/test.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Push API Test</title>
+ <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('service_worker.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 Test</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698