Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / clients-matchall-include-uncontrolled.html
blob1398a878ff0ca24558a819e8a21aaec76587c519
1 <!DOCTYPE html>
2 <title>Service Worker: Clients.matchAll with includeUncontrolled</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 base_url = 'resources/blank.html'; // This is out-of-scope.
8 var scope = base_url + '?clients-matchAll-includeUncontrolled';
10 // Creates 3 iframes, 2 for in-scope and 1 for out-of-scope.
11 // The frame opened for scope + '#2' is returned via a promise.
12 // FIXME: remove iframes when the test finishes.
13 function create_iframes(scope) {
14 return with_iframe(base_url)
15 .then(function(frame0) {
16 return with_iframe(scope + '#1');
18 .then(function(frame1) {
19 return with_iframe(scope + '#2');
20 });
23 var expected_without_include_uncontrolled = [
24 /* visibilityState, focused, url, frameType */
25 ['visible', false, new URL(scope + '#1', location).toString(), 'nested'],
26 ['visible', true, new URL(scope + '#2', location).toString(), 'nested']
29 var expected_with_include_uncontrolled = [
30 /* visibilityState, focused, url, frameType */
31 ['visible', false, new URL(scope + '#1', location).toString(), 'nested'],
32 ['visible', true, new URL(scope + '#2', location).toString(), 'nested'],
33 ['visible', false, new URL(base_url, location).toString(), 'nested'],
34 ['visible', true, location.href, 'top-level']
37 function test_matchall(frame, expected, query_options) {
38 // Make sure we have focus for '#2' frame and its parent window.
39 frame.focus();
40 frame.contentWindow.focus();
41 expected.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; });
42 return new Promise(function(resolve, reject) {
43 var channel = new MessageChannel();
44 channel.port1.onmessage = function(e) {
45 e.data.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; });
46 assert_equals(e.data.length, expected.length);
47 for (var i = 0; i < e.data.length; i++)
48 assert_array_equals(e.data[i], expected[i]);
49 resolve(frame);
51 frame.contentWindow.navigator.serviceWorker.controller.postMessage(
52 {port:channel.port2, options:query_options},
53 [channel.port2]);
54 });
57 // Run clients.matchAll without and with includeUncontrolled=true.
58 // (We want to run the two tests sequentially in the same async_test
59 // so that we can use the same set of iframes without intefering each other.
60 async_test(function(t) {
61 service_worker_unregister_and_register(
62 t, 'resources/clients-matchall-worker.js', scope)
63 .then(function(registration) {
64 return wait_for_state(t, registration.installing, 'activated');
66 .then(function() { return create_iframes(scope); })
67 .then(function(frame) {
68 return test_matchall(frame, expected_without_include_uncontrolled);
70 .then(function(frame) {
71 return test_matchall(frame, expected_with_include_uncontrolled,
72 {includeUncontrolled:true});
74 .then(function() {
75 service_worker_unregister_and_done(t, scope);
77 .catch(unreached_rejection(t));
78 }, 'Verify matchAll() respect includeUncontrolled');
80 </script>