OLD | NEW |
(Empty) | |
| 1 importScripts('../../serviceworker/resources/worker-testharness.js'); |
| 2 importScripts('/resources/testharness-helpers.js'); |
| 3 |
| 4 // var focusSucceeded = false; |
| 5 |
| 6 // function saveFocusResult(r) { |
| 7 // focusSucceeded = r instanceof WindowClient; |
| 8 // } |
| 9 |
| 10 // function fucusSucceeded() { |
| 11 // return focusSucceeded; |
| 12 // } |
| 13 |
| 14 async_test(function(test) { |
| 15 var notification = new Notification('Notification 1'); |
| 16 |
| 17 notification.addEventListener('show', function() { |
| 18 testRunner.simulateWebNotificationClick('Notification 1'); |
| 19 }); |
| 20 |
| 21 notification.addEventListener('click', function() { |
| 22 test.done(); |
| 23 clients.getAll().then(function(clients) { |
| 24 return assert_promise_rejects(clients[0].focus()); |
| 25 }).then(function() { |
| 26 test.done(); |
| 27 }); |
| 28 }); |
| 29 }, ''); |
| 30 |
| 31 // async_test(function(test) { |
| 32 // var notification = new Notification('Notification 2'); |
| 33 // notification.addEventListener('show', function() { |
| 34 // if (testRunner) |
| 35 // testRunner.simulateWebNotificationClick('Notification 2'); |
| 36 // }); |
| 37 |
| 38 // notification.addEventListener('click', function(e) { |
| 39 // e.waitUntil(clients.getAll().then(function(clients) { |
| 40 // return clients[0].focus().then(function() { |
| 41 // test.done(); |
| 42 // }); |
| 43 // })); |
| 44 // }); |
| 45 // }, 'The notificationclick and notificationerror events exist on the global sc
ope.'); |
| 46 |
| 47 // async_test(function(test) { |
| 48 // var notification = new Notification('Notification 2'); |
| 49 // notification.addEventListener('show', function() { |
| 50 // if (testRunner) |
| 51 // testRunner.simulateWebNotificationClick('Notification 2'); |
| 52 // }); |
| 53 |
| 54 // notification.addEventListener('click', function(e) { |
| 55 // e.waitUntil(clients.getAll().then(function(clients) { |
| 56 // return clients[0].focus().then(function() { |
| 57 // return clients[0].focus(); |
| 58 // }).catch(function() { |
| 59 // test.done(); |
| 60 // }); |
| 61 // })); |
| 62 // }); |
| 63 // }, 'The notificationclick and notificationerror events exist on the global sc
ope.'); |
| 64 |
| 65 done(); |
OLD | NEW |