Index: chrome/test/data/notifications/android_test.html |
diff --git a/chrome/test/data/notifications/android_test.html b/chrome/test/data/notifications/android_test.html |
index 08e707fcc057ee4713238c15bb19564370c318f2..8464b7ea591ff0dd62722b3a11865f16fd909362 100644 |
--- a/chrome/test/data/notifications/android_test.html |
+++ b/chrome/test/data/notifications/android_test.html |
@@ -5,15 +5,29 @@ |
<title>Android Web Notifications Instrumentation test-page</title> |
</head> |
<body> |
- <!-- This page is used by the NotificationUIManagerTest instrumentation test |
- suite on Android. --> |
+ <!-- This page is used by the NotificationPlatformBridgeTest instrumentation |
+ test suite on Android. --> |
<script src="notification_test_utils.js"></script> |
<script> |
function showNotification(title, options) { |
GetActivatedServiceWorker('android_test_worker.js', location.pathname) |
- .then(function(registration) { |
- registration.showNotification(title, options); |
- }); |
+ .then(registration => registration.showNotification(title, options)) |
+ .catch(sendToTest); |
+ } |
+ |
+ // NotificationPlatformBridgeTest observes changes to the tab title as an |
+ // asynchronous response mechanism from JavaScript to Java. |
+ // 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.
|
+ var errorCounter = 0; |
+ function sendToTest(message) { |
+ // Duplicate messages cannot be detected by the test, don't send them. |
+ if (message == document.title) { |
+ console.log('Duplicate message: ' + message); |
+ message = |
+ 'Error ' + errorCounter + ' - duplicate message: ' + message; |
+ errorCounter++; |
+ } |
+ document.title = message; |
} |
</script> |
</body> |