OLD | NEW |
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('/resources/testharness.js'); | 2 importScripts('/resources/testharness.js'); |
3 importScripts('worker-helpers.js'); | 3 importScripts('worker-helpers.js'); |
4 } | 4 } |
5 | 5 |
6 async_test(function(test) { | 6 async_test(function(test) { |
7 if (Notification.permission != 'granted') { | 7 if (Notification.permission != 'granted') { |
8 assert_unreached('No permission has been granted for displaying notifica
tions.'); | 8 assert_unreached('No permission has been granted for displaying notifica
tions.'); |
9 return; | 9 return; |
10 } | 10 } |
11 | 11 |
12 var notification = new Notification('My Notification'); | 12 var notification = new Notification('My Notification'); |
13 notification.addEventListener('show', function() { | 13 notification.addEventListener('show', function() { |
14 if (testRunner) | 14 if (testRunner) |
15 testRunner.simulateWebNotificationClick('My Notification'); | 15 testRunner.simulateWebNotificationClick('My Notification', -1 /* act
ion_index */); |
16 }); | 16 }); |
17 | 17 |
18 notification.addEventListener('click', function() { | 18 notification.addEventListener('click', function() { |
19 test.done(); | 19 test.done(); |
20 }); | 20 }); |
21 | 21 |
22 notification.addEventListener('error', function() { | 22 notification.addEventListener('error', function() { |
23 assert_unreached('The error event should not be thrown.'); | 23 assert_unreached('The error event should not be thrown.'); |
24 }); | 24 }); |
25 | 25 |
26 }, 'Simulating a click on the notification should fire the onclick() event.'); | 26 }, 'Simulating a click on the notification should fire the onclick() event.'); |
27 | 27 |
28 if (isDedicatedOrSharedWorker()) | 28 if (isDedicatedOrSharedWorker()) |
29 done(); | 29 done(); |
OLD | NEW |