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

Side by Side Diff: LayoutTests/http/tests/serviceworker/chromium/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: review comments 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/chromium/notificationclick-can-openwindow.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
10 var t = async_test('notificationclick can focus WindowClient');
11 t.step(function() {
12 var scope = 'resources/blank.html'
13 service_worker_unregister_and_register(
14 t, 'resources/notificationclick-can-focus.js', scope)
15 .then(function(registration) {
16 return wait_for_state(t, registration.installing, 'activated');
17 })
18 .then(function() { return with_iframe(scope); })
19 .then(function(frame) {
20 var w = frame.contentWindow;
21 w.onmessage = t.step_func(onMessage);
22 w.navigator.serviceWorker.controller.postMessage('start');
23 })
24 .catch(unreached_rejection(t));
25
26 var result = [];
27 var expected = ['focus() outside of a notificationclick event failed',
28 'focus() in notificationclick outside of waitUntil but in st ack succeeded',
29 'focus() in notificationclick outside of waitUntil not in st ack failed',
30 'focus() in notificationclick\'s waitUntil suceeded',
31 'focus() called twice failed',
32 'focus() failed after timeout',
33 'focus() failed because a window was opened before'];
34
35 function onMessage(e) {
36 var message = e.data;
37
38 if (typeof(message) === 'object') {
39 if (message.type !== 'click')
40 return;
41 if (window.testRunner)
42 testRunner.simulateWebNotificationClick(message.title);
43 return;
44 }
45
46 if (message === 'quit') {
47 assert_array_equals(result, expected,
48 'Worker should post back expected messages.');
49 service_worker_unregister_and_done(t, scope);
50 } else {
51 result.push(message);
52 }
53 }
54 });
55 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/chromium/notificationclick-can-openwindow.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698