Marked http/tests/xmlhttprequest/workers/methods-async.html as flaky.
[WebKit-https.git] / LayoutTests / http / tests / notifications / legacy / show.html
1 <!DOCTYPE html>
2 <script src="/resources/js-test-pre.js"></script>
3 <script src="/resources/notifications-test-pre.js"></script>
4 <p id="description"></p>
5 <div id="console"></div>
6 <script>
7 if (window.testRunner)
8         testRunner.waitUntilDone();
9
10 description("This test looks for the dispatch of the onshow event handler.");
11
12 var n = null;
13 function part1() {
14         shouldBe("window.webkitNotifications.checkPermission()", "1");
15         shouldThrow("window.webkitNotifications.createNotification('', 'title 1', 'body');");
16         setTimeout(part2, 0);
17 }
18
19 function part2() {
20         debug("Granting permission to " + testURL);
21         testRunner.grantWebNotificationPermission(testURL);
22         shouldBe("window.webkitNotifications.checkPermission()", "0");
23
24         n = window.webkitNotifications.createNotification("", "title 2", "body");
25         n.ondisplay = function() {
26                 testPassed("ondisplay event handler was called");
27                 shouldBe("this.ondisplay", "this.onshow");
28                 setTimeout(part3, 0);
29         };
30         n.onerror = function() {
31                 testFailed("onerror event handler should not be called");
32                 setTimeout(part3, 0);
33         };
34         n.show();
35 }
36
37 function part3() {
38         debug("Denying permission to " + testURL);
39         testRunner.denyWebNotificationPermission(testURL);
40         shouldBe("window.webkitNotifications.checkPermission()", "2");
41         shouldThrow("window.webkitNotifications.createNotification('', 'title 3', 'body');");
42         setTimeout(part4, 0);
43 }
44
45 function part4() {
46         debug("Resetting all permissions");
47         testRunner.removeAllWebNotificationPermissions();
48         shouldBe("window.webkitNotifications.checkPermission()", "1");
49         testCompleted();
50 }
51
52 part1();
53 </script>