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

Side by Side Diff: chrome/test/data/notifications/android_test.html

Issue 2418153002: Hooking up Android N inline notification replies end-to-end (Closed)
Patch Set: Reformat getNotificationReply Created 4 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
1 <!doctype html> 1 <!doctype html>
2 <html lang="en"> 2 <html lang="en">
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <title>Android Web Notifications Instrumentation test-page</title> 5 <title>Android Web Notifications Instrumentation test-page</title>
6 </head> 6 </head>
7 <body> 7 <body>
8 <!-- This page is used by the NotificationPlatformBridgeTest instrumentation 8 <!-- This page is used by the NotificationPlatformBridgeTest instrumentation
9 test suite on Android. --> 9 test suite on Android. -->
10 <script src="notification_test_utils.js"></script> 10 <script src="notification_test_utils.js"></script>
11 <script> 11 <script>
12 function showNotification(title, options) { 12 function showNotification(title, options) {
13 GetActivatedServiceWorker('android_test_worker.js', location.pathname) 13 GetActivatedServiceWorker('android_test_worker.js', location.pathname)
14 .then(registration => registration.showNotification(title, options)) 14 .then(registration => {
15 messagePort.addEventListener('message', function replyListener(e vent) {
16 if (event.data.startsWith('reply: ')) {
17 messagePort.removeEventListener('message', replyListener);
18 sendToTest(event.data);
19 }
20 });
21 return registration.showNotification(title, options);
22 })
15 .catch(sendToTest); 23 .catch(sendToTest);
16 } 24 }
17 25
18 // NotificationPlatformBridgeTest observes changes to the tab title as an 26 // NotificationPlatformBridgeTest observes changes to the tab title as an
19 // asynchronous response mechanism from JavaScript to Java. 27 // asynchronous response mechanism from JavaScript to Java.
20 var errorCounter = 0; 28 var errorCounter = 0;
21 function sendToTest(message) { 29 function sendToTest(message) {
22 // Duplicate messages cannot be detected by the test, don't send them. 30 // Duplicate messages cannot be detected by the test, don't send them.
23 if (message == document.title) { 31 if (message == document.title) {
24 console.log('Duplicate message: ' + message); 32 console.log('Duplicate message: ' + message);
25 message = 33 message =
26 'Error ' + errorCounter + ' - duplicate message: ' + message; 34 'Error ' + errorCounter + ' - duplicate message: ' + message;
27 errorCounter++; 35 errorCounter++;
28 } 36 }
29 document.title = message; 37 document.title = message;
30 } 38 }
31 </script> 39 </script>
32 </body> 40 </body>
33 </html> 41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698