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

Unified Diff: chrome/test/data/notifications/android_test.html

Issue 2316303004: Add tests for notifications infobar on Android (Closed)
Patch Set: Created 4 years, 3 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/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>

Powered by Google App Engine
This is Rietveld 408576698