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

Side by Side Diff: LayoutTests/http/tests/serviceworker/notificationclick-can-focus.html

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: cleanup up 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Service Worker: notificationclick can focus WindowClient</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <script>
7 if (window.testRunner)
8 testRunner.grantWebNotificationPermission(location.origin, true);
9 if (window.internals)
10 internals.overrideWindowInteractionTimeout(1);
11
12 var t = async_test('notificationclick can focus WindowClient');
13 t.step(function() {
14 var scope = 'resources/blank.html'
15 service_worker_unregister_and_register(
16 t, 'resources/notificationclick-can-focus.js', scope)
17 .then(function(registration) {
18 return wait_for_state(t, registration.installing, 'activated');
19 })
20 .then(function() { return with_iframe(scope); })
21 .then(function(frame) {
22 var w = frame.contentWindow;
23 w.onmessage = t.step_func(onMessage);
24 w.navigator.serviceWorker.controller.postMessage('start');
25 })
26 .catch(unreached_rejection(t));
27
28 var result = [];
29 var expected = ['focus() outside of a Notification click event failed',
30 'focus() in Notification click event succeeded',
31 'focus() called twice failed',
32 'focus() in notificationclick outside of waitUntil but in st ack succeeded',
33 'focus() in notificationclick outside of waitUntil not in st ack failed',
34 'focus() in notificationclick\'s waitUntil suceeded',
35 'focus() called twice failed',
36 'focus() failed after timeout',
37 'focus() failed because a window was opened before'];
38
39 function onMessage(e) {
40 var message = e.data;
41
42 if (typeof(message) === 'object') {
43 if (message.type !== 'click')
44 return;
45 if (window.testRunner)
46 testRunner.simulateWebNotificationClick(message.title);
47 return;
48 }
49
50 if (message === 'quit') {
51 assert_array_equals(result, expected,
52 'Worker should post back expected messages.');
53 service_worker_unregister_and_done(t, scope);
54 } else {
55 result.push(message);
56 }
57 }
58 });
59 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698