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..7d6dfce5eba56a0858556cad37b9f2a6e9bdc34b 100644 |
--- a/chrome/test/data/notifications/android_test.html |
+++ b/chrome/test/data/notifications/android_test.html |
@@ -5,15 +5,28 @@ |
<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. |
+ 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> |