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

Unified Diff: LayoutTests/http/tests/notifications/resources/serviceworker-click-can-focus.js

Issue 896043004: Tests for WaitUntilObserver and focus/openining windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sw_client_focus_cleanup
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698