Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / push_messaging / permission-state-granted-in-document.html
blobd5751f327d3e689d96c9ba48cc11f00807ba6a99
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Push API: permissionState resolves with granted when permission is granted</title>
5 <link rel="manifest" href="resources/push_manifest.json">
6 <script src="../resources/testharness.js"></script>
7 <script src="../resources/testharnessreport.js"></script>
8 <script src="../serviceworker/resources/test-helpers.js"></script>
9 </head>
10 <body>
11 <script>
12 async_test(function(test) {
13 var workerUrl = 'resources/empty_worker.js';
14 var workerScope = 'resources/scope/' + location.pathname;
15 service_worker_unregister_and_register(test, workerUrl, workerScope)
16 .then(function(serviceWorkerRegistration) {
17 // If running manually, grant permission when prompted.
18 if (window.testRunner)
19 testRunner.setPermission('push-messaging', 'granted', location.origin, location.origin);
20 return serviceWorkerRegistration.pushManager.permissionState({userVisibleOnly: true});
22 .then(function(permissionStatus) {
23 assert_equals(permissionStatus, 'granted');
24 return service_worker_unregister_and_done(test, workerScope);
26 .catch(unreached_rejection(test));
27 }, 'Push API: permissionState resolves with granted when permission is granted');
28 </script>
29 </body>
30 </html>