Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / notifications / click-window-focus-document.html
blobe7d2a649d6db62c60ce95c56ed2a9a387d765f5e
1 <!doctype html>
2 <html>
3 <head>
4 <title>Notifications: Should be able to focus window in onclick event.</title>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 <script src="../resources/permissions-helper.js"></script>
8 </head>
9 <body>
10 <script>
11 // Tests that Document-bound notifications are able to focus a window in
12 // their onclick event. When the test is being run manually, grant
13 // Notification permission and click on the notification.
14 if (window.testRunner) {
15 testRunner.setCanOpenWindows();
16 testRunner.setCloseRemainingWindowsWhenComplete();
19 async_test(function(test) {
20 PermissionsHelper.setPermission('notifications', 'granted').then(test.step_func(function() {
21 if (Notification.permission != 'granted') {
22 assert_unreached('No permission has been granted for displaying notifications.');
23 return;
26 window.addEventListener('focus', test.step_func(function() {
27 test.done();
28 }));
30 var childWindow = window.open('about:blank');
31 childWindow.focus();
33 var notification = new Notification('My Notification');
34 notification.addEventListener('show', test.step_func(function() {
35 if (window.testRunner)
36 testRunner.simulateWebNotificationClick('My Notification');
37 }));
39 notification.addEventListener('click', test.step_func(function() {
40 window.focus();
41 }));
43 notification.addEventListener('error', test.step_func(function() {
44 assert_unreached('The error event should not be thrown.');
45 }));
46 }));
47 }, 'Clicking on a notification enables it to focus the window it was created from.');
48 </script>
49 <script src="resources/click-focus-test.js"></script>
50 </body>
51 </html>