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

Side by Side Diff: LayoutTests/http/tests/notifications/close-dispatch-asynchronous.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: 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.grantWebNotificationPermission(location.origin, true); 15 testRunner.grantWebNotificationPermission(location.origin, true);
16 }
15 17
16 async_test(function(test) { 18 async_test(function(test) {
17 var eventOrderCounter = 0; 19 var eventOrderCounter = 0;
18 var notification = new Notification('My Notification', { 20 var notification = new Notification('My Notification', {
19 body: 'Hello, world!', 21 body: 'Hello, world!',
20 icon: '/my-icon.png' 22 icon: '/my-icon.png'
21 }); 23 });
22 24
23 notification.addEventListener('show', function() { 25 notification.addEventListener('show', function() {
24 assert_equals(++eventOrderCounter, 2); 26 assert_equals(++eventOrderCounter, 2);
25 notification.close(); 27 notification.close();
26 28
27 assert_equals(++eventOrderCounter, 3); 29 assert_equals(++eventOrderCounter, 3);
28 }); 30 });
29 31
30 notification.addEventListener('close', function() { 32 notification.addEventListener('close', function() {
31 assert_equals(++eventOrderCounter, 4); 33 assert_equals(++eventOrderCounter, 4);
32 34
33 test.done(); 35 test.done();
34 }); 36 });
35 37
36 assert_equals(++eventOrderCounter, 1); 38 assert_equals(++eventOrderCounter, 1);
37 39
38 }, 'The close event should be dispatched asynchronously.'); 40 }, 'The close event should be dispatched asynchronously.');
39 41
40 </script> 42 </script>
41 </body> 43 </body>
42 </html> 44 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698