Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: LayoutTests/http/tests/notifications/service-worker-show-notification-no-permission.html

Issue 787893002: Actually hook up ServiceWorkerRegistration.showNotification() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add missing file Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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-permi ssion',
15 worker_url = 'resources/empty-worker.js';
16
17 if (window.testRunner)
18 testRunner.grantWebNotificationPermission("http://127.0.0.1:8000", false);
19
20 var registration = null;
21 service_worker_unregister_and_register(test, worker_url, scope).then(f unction (serviceWorkerRegistration) {
22 registration = serviceWorkerRegistration;
23 return wait_for_update(test, registration);
24 }).then(function (serviceWorker) {
25 return wait_for_state(test, serviceWorker, 'activating');
26 }).then(function () {
27 assert_inherits(registration, 'showNotification', 'showNotificatio n() must be exposed.');
28 registration.showNotification('Title', {
29 body: 'Hello, world!',
30 icon: '/icon.png'
31 }).then(function() {
32 assert_unreached('showNotification() is expected to reject.');
33 }).catch(function(error) {
34 assert_equals(error.name, 'TypeError');
35 assert_equals(error.message, 'No notification permission has b een granted for this origin.');
36 test.done();
37 });
38
39 }).catch(unreached_rejection(test));
40
41 }, 'showNotification() must reject if no Web Notification permission has b een granted.');
42 </script>
43 </body>
44 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698