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

Side by Side Diff: LayoutTests/http/tests/notifications/close-dispatch-asynchronous.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: The close event should be dispatched asynchronously.</ title> 4 <title>Notifications: The close event should be dispatched asynchronously.</ 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="resources/test-helpers.js"></script> 7 <script src="resources/test-helpers.js"></script>
8 </head> 8 </head>
9 <body> 9 <body>
10 <script> 10 <script>
11 // Tests that the "close" event on a Notification object will be fired asy nchronously 11 // Tests that the "close" event on a Notification object will be fired asy nchronously
12 // when it's being closed programmatically by the developer. 12 // when it's being closed programmatically by the developer.
13 if (window.testRunner) { 13 if (window.testRunner)
14 testRunner.setPermission('notifications', 'granted', location.origin, location.origin); 14 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
15 testRunner.grantWebNotificationPermission(location.origin, true);
16 }
17 15
18 async_test(function(test) { 16 async_test(function(test) {
19 var eventOrderCounter = 0; 17 var eventOrderCounter = 0;
20 var notification = new Notification('My Notification', { 18 var notification = new Notification('My Notification', {
21 body: 'Hello, world!', 19 body: 'Hello, world!',
22 icon: '/my-icon.png' 20 icon: '/my-icon.png'
23 }); 21 });
24 22
25 notification.addEventListener('show', function() { 23 notification.addEventListener('show', function() {
26 assert_equals(++eventOrderCounter, 2); 24 assert_equals(++eventOrderCounter, 2);
27 notification.close(); 25 notification.close();
28 26
29 assert_equals(++eventOrderCounter, 3); 27 assert_equals(++eventOrderCounter, 3);
30 }); 28 });
31 29
32 notification.addEventListener('close', function() { 30 notification.addEventListener('close', function() {
33 assert_equals(++eventOrderCounter, 4); 31 assert_equals(++eventOrderCounter, 4);
34 32
35 test.done(); 33 test.done();
36 }); 34 });
37 35
38 assert_equals(++eventOrderCounter, 1); 36 assert_equals(++eventOrderCounter, 1);
39 37
40 }, 'The close event should be dispatched asynchronously.'); 38 }, 'The close event should be dispatched asynchronously.');
41 39
42 </script> 40 </script>
43 </body> 41 </body>
44 </html> 42 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698