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

Side by Side Diff: LayoutTests/http/tests/notifications/serviceworkerregistration-document-close.html

Issue 1097383006: Notifications: use testRunner.setPermission() in addition of grantWebNotificationPermission. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cleanup
Patch Set: fix expectations Created 5 years, 8 months 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
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Notifications: ServiceWorkerRegistration.showNotification().</title> 4 <title>Notifications: ServiceWorkerRegistration.showNotification().</title>
5 <script src="../resources/testharness.js"></script> 5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script> 6 <script src="../resources/testharnessreport.js"></script>
7 <script src="../serviceworker/resources/test-helpers.js"></script> 7 <script src="../serviceworker/resources/test-helpers.js"></script>
8 <script src="resources/test-helpers.js"></script> 8 <script src="resources/test-helpers.js"></script>
9 </head> 9 </head>
10 <body> 10 <body>
11 <script> 11 <script>
12 // Tests that the showNotification() function resolves a promise, that the 12 // Tests that the showNotification() function resolves a promise, that the
13 // notificationclick event gets fired on the Service Worker when we simula te a 13 // notificationclick event gets fired on the Service Worker when we simula te a
14 // click on it, and the notification can then be closed. This test require s 14 // click on it, and the notification can then be closed. This test require s
15 // the test runner. 15 // the test runner.
16 async_test(function(test) { 16 async_test(function(test) {
17 var scope = 'resources/scope/serviceworkerregistration-document-close' , 17 var scope = 'resources/scope/serviceworkerregistration-document-close' ,
18 script = 'resources/instrumentation-service-worker.js'; 18 script = 'resources/instrumentation-service-worker.js';
19 19
20 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
20 testRunner.grantWebNotificationPermission(location.origin, true); 21 testRunner.grantWebNotificationPermission(location.origin, true);
21 22
22 var workerInfo = null; 23 var workerInfo = null;
23 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(info) { 24 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(info) {
24 workerInfo = info; 25 workerInfo = info;
25 26
26 // (1) Display a Web Notification from the document. 27 // (1) Display a Web Notification from the document.
27 assert_inherits(workerInfo.registration, 'showNotification', 'show Notification() must be exposed.'); 28 assert_inherits(workerInfo.registration, 'showNotification', 'show Notification() must be exposed.');
28 return workerInfo.registration.showNotification(scope, { 29 return workerInfo.registration.showNotification(scope, {
29 body: 'ACTION:CLOSE', 30 body: 'ACTION:CLOSE',
(...skipping 17 matching lines...) Expand all
47 // order to verify that this works correctly, we need to suppo rt the 48 // order to verify that this works correctly, we need to suppo rt the
48 // Notification.get() getter, which is not implemented yet. 49 // Notification.get() getter, which is not implemented yet.
49 50
50 test.done(); 51 test.done();
51 }); 52 });
52 }).catch(unreached_rejection(test)); 53 }).catch(unreached_rejection(test));
53 54
54 }, 'Clicking on a notification displayed through showNotification() fires a Service Worker event, and can be closed there.'); 55 }, 'Clicking on a notification displayed through showNotification() fires a Service Worker event, and can be closed there.');
55 </script> 56 </script>
56 </body> 57 </body>
57 </html> 58 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698