Index: LayoutTests/http/tests/serviceworker/notificationclick-can-focus.html |
diff --git a/LayoutTests/http/tests/serviceworker/postmessage-to-client.html b/LayoutTests/http/tests/serviceworker/notificationclick-can-focus.html |
similarity index 62% |
copy from LayoutTests/http/tests/serviceworker/postmessage-to-client.html |
copy to LayoutTests/http/tests/serviceworker/notificationclick-can-focus.html |
index a09bb986822087ad56702433a35367b5b86b5115..d2aa15ef8f46f2ff1817319f6141d6da7908bece 100644 |
--- a/LayoutTests/http/tests/serviceworker/postmessage-to-client.html |
+++ b/LayoutTests/http/tests/serviceworker/notificationclick-can-focus.html |
@@ -1,14 +1,17 @@ |
<!DOCTYPE html> |
-<title>Service Worker: postMessage to Client</title> |
+<title>Service Worker: notificationclick can focus WindowClient</title> |
<script src="../resources/testharness.js"></script> |
<script src="../resources/testharnessreport.js"></script> |
<script src="resources/test-helpers.js"></script> |
<script> |
-var t = async_test('postMessage from ServiceWorker to Client'); |
+if (window.testRunner) |
+ testRunner.grantWebNotificationPermission(location.origin, true); |
+ |
+var t = async_test('notificationclick can focus WindowClient'); |
t.step(function() { |
var scope = 'resources/blank.html' |
service_worker_unregister_and_register( |
- t, 'resources/postmessage-to-client-worker.js', scope) |
+ t, 'resources/notificationclick-can-focus.js', scope) |
.then(function(registration) { |
return wait_for_state(t, registration.installing, 'activated'); |
}) |
@@ -16,12 +19,13 @@ t.step(function() { |
.then(function(frame) { |
var w = frame.contentWindow; |
w.onmessage = t.step_func(onMessage); |
- w.navigator.serviceWorker.controller.postMessage('ping'); |
+ w.navigator.serviceWorker.controller.postMessage('no-click'); |
}) |
.catch(unreached_rejection(t)); |
var result = []; |
- var expected = ['Sending message via clients']; |
+ var expected = ['focus() outside of a notificationclick failed', |
+ ]; |
function onMessage(e) { |
var message = e.data; |
@@ -29,6 +33,9 @@ t.step(function() { |
assert_array_equals(result, expected, |
'Worker should post back expected messages.'); |
service_worker_unregister_and_done(t, scope); |
+ } else if (message === 'click') { |
+ if (window.testRunner) |
+ testRunner.simulateWebNotificationClick('My Notification'); |
} else { |
result.push(message); |
} |