Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / push_messaging / permission-state-exception-in-document.html
blob3b25291baebd2848e0bf6fe600ef2ea52959d5b9
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Push API: permissionState fails with NotSupportedError if userVisibleOnly is not used</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 if (window.testRunner)
14 testRunner.setPermission('push-messaging', 'prompt', location.origin, location.origin);
16 var workerUrl = 'resources/empty_worker.js';
17 var workerScope = 'resources/scope/' + location.pathname;
18 service_worker_unregister_and_register(test, workerUrl, workerScope)
19 .then(function(serviceWorkerRegistration) {
20 // If running manually, clear permissions before running this test.
21 return serviceWorkerRegistration.pushManager.permissionState();
23 .then(function(permissionStatus) {
24 assert_unreached('permissionStatus should have failed with a NotSupported exception');
25 }, function(error) {
26 assert_equals(error.name, 'NotSupportedError');
27 assert_equals(error.message,
28 'Push subscriptions that don\'t enable userVisibleOnly are not supported.');
29 test.done();
30 }).catch(unreached_rejection(test));
31 }, 'Push API: permissionState fails with NotSupportedError if userVisibleOnly is not used');
32 </script>
33 </body>
34 </html>