Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / notifications / serviceworkerregistration-document-no-permission.html
blobf510251e8acc6b58082abb9f3f31ddb4cd94992f
1 <!doctype html>
2 <html>
3 <head>
4 <title>Notifications: ServiceWorkerRegistration.showNotification().</title>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 <script src="../serviceworker/resources/test-helpers.js"></script>
8 </head>
9 <body>
10 <script>
11 // Tests that the showNotification() function rejects the returned promise with a
12 // TypeError when no permission has been granted for Web Notifications.
13 async_test(function(test) {
14 var scope = 'resources/scope/service-worker-show-notification-no-permission',
15 workerUrl = 'resources/empty-worker.js';
17 if (window.testRunner)
18 testRunner.setPermission('notifications', 'denied', location.origin, location.origin);
20 var registration = null;
21 service_worker_unregister_and_register(test, workerUrl, scope).then(function(swRegistration) {
22 registration = swRegistration;
23 return wait_for_state(test, registration.installing, 'activated');
24 }).then(function() {
25 assert_inherits(registration, 'showNotification', 'showNotification() must be exposed.');
26 registration.showNotification('Title', {
27 body: 'Hello, world!',
28 icon: '/icon.png'
29 }).then(function() {
30 assert_unreached('showNotification() is expected to reject.');
31 }).catch(function(error) {
32 assert_equals(error.name, 'TypeError');
33 assert_equals(error.message, 'No notification permission has been granted for this origin.');
34 test.done();
35 });
37 }).catch(unreached_rejection(test));
39 }, 'showNotification() must reject if no Web Notification permission has been granted.');
40 </script>
41 </body>
42 </html>