OLD | NEW |
---|---|
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 NotificationUIManagerTest instrumentation test | 8 <!-- This page is used by the NotificationPlatformBridgeTest instrumentation |
9 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(function(registration) { | 14 .then(registration => registration.showNotification(title, options)) |
15 registration.showNotification(title, options); | 15 .catch(sendToTest); |
16 }); | 16 } |
17 | |
18 // NotificationPlatformBridgeTest observes changes to the tab title as an | |
19 // asynchronous response mechanism from JavaScript to Java. | |
20 // TODO(mvanouwerkerk): Use DomAutomationController - crbug.com/562487 | |
Peter Beverloo
2016/09/08 17:26:01
Delete, I don't think this is particularly useful,
johnme
2016/09/08 18:34:37
Done.
| |
21 var errorCounter = 0; | |
22 function sendToTest(message) { | |
23 // Duplicate messages cannot be detected by the test, don't send them. | |
24 if (message == document.title) { | |
25 console.log('Duplicate message: ' + message); | |
26 message = | |
27 'Error ' + errorCounter + ' - duplicate message: ' + message; | |
28 errorCounter++; | |
29 } | |
30 document.title = message; | |
17 } | 31 } |
18 </script> | 32 </script> |
19 </body> | 33 </body> |
20 </html> | 34 </html> |
OLD | NEW |