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

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

Issue 866043005: [ServiceWorker] Tests for WindowClient.focus(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sw_openwindow_tests
Patch Set: review comment 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: WindowClient.focus()</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 var t = async_test('Test WindowClient.focus()');
8 t.step(function() {
9 var scope = 'resources/blank.html'
10 service_worker_unregister_and_register(
11 t, 'resources/client-focus.js', scope)
12 .then(function(registration) {
13 return wait_for_state(t, registration.installing, 'activated');
14 })
15 .then(function() { return with_iframe(scope); })
16 .then(function(frame) {
17 var w = frame.contentWindow;
18 w.onmessage = t.step_func(onMessage);
19 w.navigator.serviceWorker.controller.postMessage('ping');
20 })
21 .catch(unreached_rejection(t));
22
23 var result = [];
24 var expected = ['focus() is present',
25 'focus() failed with InvalidAccessError'];
26
27 function onMessage(e) {
28 var message = e.data;
29 if (message === 'quit') {
30 assert_array_equals(result, expected,
31 'Worker should post back expected messages.');
32 service_worker_unregister_and_done(t, scope);
33 } else {
34 result.push(message);
35 }
36 }
37 });
38 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698