Commit 8569349a authored by johnme's avatar johnme Committed by Commit bot

Add tests for notifications infobar on Android

BUG=644050

Review-Url: https://codereview.chromium.org/2316303004
Cr-Commit-Position: refs/heads/master@{#417369}
parent 46984b99
...@@ -5,15 +5,28 @@ ...@@ -5,15 +5,28 @@
<title>Android Web Notifications Instrumentation test-page</title> <title>Android Web Notifications Instrumentation test-page</title>
</head> </head>
<body> <body>
<!-- This page is used by the NotificationUIManagerTest instrumentation test <!-- This page is used by the NotificationPlatformBridgeTest instrumentation
suite on Android. --> test suite on Android. -->
<script src="notification_test_utils.js"></script> <script src="notification_test_utils.js"></script>
<script> <script>
function showNotification(title, options) { function showNotification(title, options) {
GetActivatedServiceWorker('android_test_worker.js', location.pathname) GetActivatedServiceWorker('android_test_worker.js', location.pathname)
.then(function(registration) { .then(registration => registration.showNotification(title, options))
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> </script>
</body> </body>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment