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

Side by Side Diff: LayoutTests/http/tests/notifications/request-permission-granted.html

Issue 1100163002: Notifications: stop using notifications specific permission methods in LayoutTests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@notifications_testrunner_setpermission
Patch Set: update 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: Creating notifications should succeed when permission has been granted.</title> 4 <title>Notifications: Creating notifications should succeed when permission has been granted.</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 </head> 7 </head>
8 <body> 8 <body>
9 <script> 9 <script>
10 // Tests that Notification.requestPermission() returns "granted" when 10 // Tests that Notification.requestPermission() returns "granted" when
11 // permission has been granted, causing creation of notifications to 11 // permission has been granted, causing creation of notifications to
12 // succeed. When running this test manually, accept permission 12 // succeed. When running this test manually, accept permission
13 // for displaying notifications prior to running the test. 13 // for displaying notifications prior to running the test.
14 if (window.testRunner)
15 testRunner.clearWebNotificationPermissions();
16
17 async_test(function (test) { 14 async_test(function (test) {
18 testRunner.setPermission('notifications', 'granted', location.origin, location.origin); 15 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
19 testRunner.grantWebNotificationPermission(location.origin, true);
20 Notification.requestPermission(function (status) { 16 Notification.requestPermission(function (status) {
21 assert_equals(status, 'granted'); 17 assert_equals(status, 'granted');
22 18
23 var notification = new Notification('My Notification'); 19 var notification = new Notification('My Notification');
24 notification.addEventListener('show', function() { 20 notification.addEventListener('show', function() {
25 test.done(); 21 test.done();
26 }); 22 });
27 23
28 notification.addEventListener('error', function() { 24 notification.addEventListener('error', function() {
29 assert_unreached('The notification is expected to be shown.'); 25 assert_unreached('The notification is expected to be shown.');
30 }); 26 });
31 }); 27 });
32 28
33 }, 'Notification creation succeeds when permission has been granted.'); 29 }, 'Notification creation succeeds when permission has been granted.');
34 </script> 30 </script>
35 </body> 31 </body>
36 </html> 32 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698