Index: LayoutTests/http/tests/notifications/resources/serviceworker-click-can-focus.js |
diff --git a/LayoutTests/http/tests/notifications/resources/serviceworker-click-can-focus.js b/LayoutTests/http/tests/notifications/resources/serviceworker-click-can-focus.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..79be636ec805941646e3dceef312108b4eb4ce5f |
--- /dev/null |
+++ b/LayoutTests/http/tests/notifications/resources/serviceworker-click-can-focus.js |
@@ -0,0 +1,65 @@ |
+importScripts('../../serviceworker/resources/worker-testharness.js'); |
+importScripts('/resources/testharness-helpers.js'); |
+ |
+// var focusSucceeded = false; |
+ |
+// function saveFocusResult(r) { |
+// focusSucceeded = r instanceof WindowClient; |
+// } |
+ |
+// function fucusSucceeded() { |
+// return focusSucceeded; |
+// } |
+ |
+async_test(function(test) { |
+ var notification = new Notification('Notification 1'); |
+ |
+ notification.addEventListener('show', function() { |
+ testRunner.simulateWebNotificationClick('Notification 1'); |
+ }); |
+ |
+ notification.addEventListener('click', function() { |
+ test.done(); |
+ clients.getAll().then(function(clients) { |
+ return assert_promise_rejects(clients[0].focus()); |
+ }).then(function() { |
+ test.done(); |
+ }); |
+ }); |
+}, ''); |
+ |
+// async_test(function(test) { |
+// var notification = new Notification('Notification 2'); |
+// notification.addEventListener('show', function() { |
+// if (testRunner) |
+// testRunner.simulateWebNotificationClick('Notification 2'); |
+// }); |
+ |
+// notification.addEventListener('click', function(e) { |
+// e.waitUntil(clients.getAll().then(function(clients) { |
+// return clients[0].focus().then(function() { |
+// test.done(); |
+// }); |
+// })); |
+// }); |
+// }, 'The notificationclick and notificationerror events exist on the global scope.'); |
+ |
+// async_test(function(test) { |
+// var notification = new Notification('Notification 2'); |
+// notification.addEventListener('show', function() { |
+// if (testRunner) |
+// testRunner.simulateWebNotificationClick('Notification 2'); |
+// }); |
+ |
+// notification.addEventListener('click', function(e) { |
+// e.waitUntil(clients.getAll().then(function(clients) { |
+// return clients[0].focus().then(function() { |
+// return clients[0].focus(); |
+// }).catch(function() { |
+// test.done(); |
+// }); |
+// })); |
+// }); |
+// }, 'The notificationclick and notificationerror events exist on the global scope.'); |
+ |
+done(); |