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

Side by Side Diff: LayoutTests/http/tests/notifications/request-permission-detached-context.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: Requesting notification permission in a detached conte xt should not crash.</title> 4 <title>Notifications: Requesting notification permission in a detached conte xt should not crash.</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 notifications created in a different context do not crash wh en said 11 // Tests that notifications created in a different context do not crash wh en said
12 // context gets detached, and events are still being fired on it. 12 // context gets detached, and events are still being fired on it.
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);
15 testRunner.setCanOpenWindows(); 16 testRunner.setCanOpenWindows();
16 } 17 }
17 18
18 async_test(function (test) { 19 async_test(function (test) {
19 var win = window.open('resources/window-permission-detached-context.ht ml'), 20 var win = window.open('resources/window-permission-detached-context.ht ml'),
20 notificationObj = null; 21 notificationObj = null;
21 22
22 window.addEventListener('message', function (event) { 23 window.addEventListener('message', function (event) {
23 if (event.data == 'opened') { 24 if (event.data == 'opened') {
24 assert_own_property(win, 'Notification'); 25 assert_own_property(win, 'Notification');
25 notificationObj = win.Notification; 26 notificationObj = win.Notification;
26 win.close(); 27 win.close();
27 28
28 } else if (event.data == 'closed') { 29 } else if (event.data == 'closed') {
29 assert_equals(notificationObj.permission, 'granted'); 30 assert_equals(notificationObj.permission, 'granted');
30 notificationObj.requestPermission(function () {}); 31 notificationObj.requestPermission(function () {});
31 32
32 test.done(); 33 test.done();
33 } else { 34 } else {
34 assert_unreached('Unrecognized message from the opened window. '); 35 assert_unreached('Unrecognized message from the opened window. ');
35 } 36 }
36 }); 37 });
37 38
38 }, 'Requesting notification permission in a detached context should not cr ash.'); 39 }, 'Requesting notification permission in a detached context should not cr ash.');
39 </script> 40 </script>
40 </body> 41 </body>
41 </html> 42 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698