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

Side by Side Diff: LayoutTests/fast/notifications/notification-click-window-focus.html

Issue 186713002: Add new layout tests for the Web Notification API. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p>
8 Tests that it is possible to return focus to the |window| object when a
9 notification has been clicked on when another window is in the foreground.
10 </p>
11 <p>
12 When running this test manually, disable pop-up blocking, grant permission for
13 the notification and reload this page. Click the notification which will b e
14 shown. You should see two PASS messages and this window should be focused.
15 </p>
16 <div id="console"></div>
17 <script>
18 if (window.testRunner) {
19 testRunner.setCanOpenWindows();
20 testRunner.setCloseRemainingWindowsWhenComplete();
21 testRunner.grantWebNotificationPermission("file://", true);
22 testRunner.waitUntilDone();
23 }
24
25 window.addEventListener("focus", function() {
26 testPassed("Focus has been returned to the opening window.");
27 if (window.testRunner)
28 testRunner.notifyDone();
29 });
30
31 var childWindow = window.open("about:blank");
32 childWindow.focus();
33
34 var notification = new Notification("Notification");
35 notification.addEventListener("show", function() {
36 testPassed("notification.onshow() has been called.");
37 if (window.testRunner)
38 testRunner.simulateWebNotificationClick("Notification");
39 });
40
41 notification.addEventListener("click", function() {
42 testPassed("notification.onclick() has been called.");
43 notification.close();
44
45 window.focus();
46 });
47 </script>
48 </body>
49 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698