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>
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');