OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Service Worker: clients.openWindow() tests (using testRunner)</title> | 2 <title>Service Worker: clients.openWindow() tests (using testRunner)</title> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <script src="../resources/test-helpers.js"></script> | 5 <script src="../resources/test-helpers.js"></script> |
6 <script> | 6 <script> |
7 // This test is using testRunner to grant itself the notification permission and | 7 // This test is using testRunner to grant itself the notification permission and |
8 // to simulate a click on a notification. A couple of changes would allow it to | 8 // to simulate a click on a notification. A couple of changes would allow it to |
9 // be run as a manual test by other browser vendors. | 9 // be run as a manual test by other browser vendors. |
10 if (window.testRunner) | 10 if (window.testRunner) { |
| 11 testRunner.setPermission('notifications', 'granted', location.origin, locati
on.origin); |
11 testRunner.grantWebNotificationPermission(location.origin, true); | 12 testRunner.grantWebNotificationPermission(location.origin, true); |
| 13 } |
12 | 14 |
13 var t = async_test('clients.openWindow() behaved as expected'); | 15 var t = async_test('clients.openWindow() behaved as expected'); |
14 t.step(function() { | 16 t.step(function() { |
15 var scope = 'resources/blank.html' | 17 var scope = 'resources/blank.html' |
16 service_worker_unregister_and_register( | 18 service_worker_unregister_and_register( |
17 t, 'resources/clients-openwindow.js', scope) | 19 t, 'resources/clients-openwindow.js', scope) |
18 .then(function(registration) { | 20 .then(function(registration) { |
19 return wait_for_state(t, registration.installing, 'activated'); | 21 return wait_for_state(t, registration.installing, 'activated'); |
20 }) | 22 }) |
21 .then(function() { return with_iframe(scope); }) | 23 .then(function() { return with_iframe(scope); }) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 if (message === 'quit') { | 69 if (message === 'quit') { |
68 assert_array_equals(result, expected, | 70 assert_array_equals(result, expected, |
69 'Worker should post back expected messages.'); | 71 'Worker should post back expected messages.'); |
70 service_worker_unregister_and_done(t, scope); | 72 service_worker_unregister_and_done(t, scope); |
71 } else { | 73 } else { |
72 result.push(message); | 74 result.push(message); |
73 } | 75 } |
74 } | 76 } |
75 }); | 77 }); |
76 </script> | 78 </script> |
OLD | NEW |