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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/clients-matchall.https.html

Issue 2415873002: Import w3c tests for the service workers (Closed)
Patch Set: Rebase Created 4 years, 2 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: Clients.matchAll</title>
3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.sub.js"></script>
6 <script>
7 var scope = 'resources/blank.html?clients-matchAll';
8 var t = async_test('Test Clients.matchAll()');
9 var frames = [];
10 t.step(function() {
11 service_worker_unregister_and_register(
12 t, 'resources/clients-matchall-worker.js', scope)
13 .then(function(registration) {
14 return wait_for_state(t, registration.installing, 'activated');
15 })
16 .then(function() { return with_iframe(scope + '#1'); })
17 .then(function(frame1) {
18 frames.push(frame1);
19 frame1.focus();
20 return with_iframe(scope + '#2');
21 })
22 .then(function(frame2) {
23 frames.push(frame2);
24 var channel = new MessageChannel();
25 channel.port1.onmessage = t.step_func(onMessage);
26 frame2.contentWindow.navigator.serviceWorker.controller.postMessage(
27 {port:channel.port2}, [channel.port2]);
28 })
29 .catch(unreached_rejection(t));
30 });
31
32 var expected = [
33 /* visibilityState, focused, url, frameType */
34 ['visible', true, new URL(scope + '#1', location).toString(), 'nested'],
35 ['visible', false, new URL(scope + '#2', location).toString(), 'nested']
36 ];
37
38 function onMessage(e) {
39 assert_equals(e.data.length, 2);
40 assert_array_equals(e.data[0], expected[0]);
41 assert_array_equals(e.data[1], expected[1]);
42 frames.forEach(function(f) { f.remove(); });
43 service_worker_unregister_and_done(t, scope);
44 }
45 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698