Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / notifications / permission-document.html
blobcb1751a1d15ab1ea6e4b76b1f3ca9f43c01a72de
1 <!doctype html>
2 <html>
3 <head>
4 <title>Notifications: The Notification.permission property reflects the permission status.</title>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <script>
10 // Tests that the Notification.permission property reflects the current
11 // permission level of notifications for the current origin. This test
12 // requires the TestRunner.
13 // This test is doing some hacks to make sure the internal representation
14 // is correctly updated before calling Notification.permission because
15 // testRunner.setPermission() and Notification.permission might end up
16 // in a race given the synchronous aspect of the latter.
17 var notificationsPermissionsTest = async_test("Notification.permission reflects th actual permission.");
19 var testIndex = 0;
20 var tests = [
21 function() {
22 testRunner.setPermission('notifications', 'prompt', location.origin, location.origin);
23 navigator.permissions.query({name:'notifications'}).then(function() {
24 // "default" indicates that no permission request has been answered.
25 assert_equals(Notification.permission, 'default');
27 notificationsPermissionsTest.step(tests[++testIndex]);
28 });
30 function() {
31 testRunner.setPermission('notifications', 'denied', location.origin, location.origin);
32 navigator.permissions.query({name:'notifications'}).then(function() {
33 // "default" indicates that no permission request has been answered.
34 assert_equals(Notification.permission, 'denied');
36 notificationsPermissionsTest.step(tests[++testIndex]);
37 });
39 function () {
40 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
41 navigator.permissions.query({name:'notifications'}).then(function() {
42 // "default" indicates that no permission request has been answered.
43 assert_equals(Notification.permission, 'granted');
45 notificationsPermissionsTest.step(tests[++testIndex]);
46 });
48 function () {
49 notificationsPermissionsTest.done();
53 notificationsPermissionsTest.step(function() {
54 if (!window.testRunner) {
55 assert_unreached('This test requires the TestRunner for working correctly.');
56 return;
58 notificationsPermissionsTest.step(tests[testIndex]);
59 });
60 </script>
61 </body>
62 </html>