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

Unified Diff: LayoutTests/fast/notifications/notifications-click-event-focus.html

Issue 187323005: Revert of Remove support for legacy WebKit Notifications (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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: LayoutTests/fast/notifications/notifications-click-event-focus.html
diff --git a/LayoutTests/fast/notifications/notifications-click-event-focus.html b/LayoutTests/fast/notifications/notifications-click-event-focus.html
new file mode 100644
index 0000000000000000000000000000000000000000..bb39a0c42a0a4a1018c03f14abdd3a0504082092
--- /dev/null
+++ b/LayoutTests/fast/notifications/notifications-click-event-focus.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script type="text/javascript">
+ function log(message)
+ {
+ document.getElementById("result").innerHTML += message + "<br>";
+ }
+
+ function runTests()
+ {
+ if (window.testRunner) {
+ testRunner.grantWebNotificationPermission("file://");
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ testRunner.setCanOpenWindows();
+ testRunner.setCloseRemainingWindowsWhenComplete();
+ }
+
+ if (!window.webkitNotifications) {
+ log("FAIL: No webkitNotifications interface!");
+ }
+
+ // Open a new window, so we don't have the focus.
+ var W = window.open("about:blank");
+ W.focus();
+
+ window.onfocus = function() { log("PASS: focus event fired."); }
+
+ var N = window.webkitNotifications.createNotification("", "New E-mail", "Meet me tonight at 8!");
+ N.onclick = function() { log("PASS: click event fired."); window.focus(); N.cancel(); }
+ N.show();
+
+ if (window.testRunner) {
+ testRunner.simulateLegacyWebNotificationClick("New E-mail");
+ testRunner.notifyDone();
+ }
+ }
+ </script>
+</head>
+<body>
+<p>Check that window.focus() is not restricted during notification click events.</p>
+
+<p>To exercise manually, disable pop-up blocking, grant notification permissions and load this page, then click on the notification. You should see two "PASS" messages and this window should be focused.</p>
+<div id="result"></div>
+
+<script type="text/javascript">
+runTests();
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698