Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / cachestorage / script-tests / cache-matchAll.js
blob480109005f48b5f7600db59868437f5e0c83f32c
1 if (self.importScripts) {
2 importScripts('/resources/testharness.js');
3 importScripts('/resources/testharness-helpers.js');
4 importScripts('../resources/test-helpers.js');
7 prepopulated_cache_test(simple_entries, function(cache, entries) {
8 return cache.matchAll('not-present-in-the-cache')
9 .then(function(result) {
10 assert_response_array_equivalent(
11 result, [],
12 'Cache.matchAll should resolve with an empty array on failure.');
13 });
14 }, 'Cache.matchAll with no matching entries');
16 prepopulated_cache_test(simple_entries, function(cache, entries) {
17 return cache.matchAll(entries.a.request.url)
18 .then(function(result) {
19 assert_response_array_equivalent(result, [entries.a.response],
20 'Cache.matchAll should match by URL.');
21 });
22 }, 'Cache.matchAll with URL');
24 prepopulated_cache_test(simple_entries, function(cache, entries) {
25 return cache.matchAll(entries.a.request)
26 .then(function(result) {
27 assert_response_array_equivalent(result, [entries.a.response],
28 'Cache.matchAll should match by Request.');
29 });
30 }, 'Cache.matchAll with Request');
32 prepopulated_cache_test(simple_entries, function(cache, entries) {
33 return cache.matchAll(new Request(entries.a.request.url))
34 .then(function(result) {
35 assert_response_array_equivalent(result, [entries.a.response],
36 'Cache.matchAll should match by Request.');
37 });
38 }, 'Cache.matchAll with new Request');
40 prepopulated_cache_test(simple_entries, function(cache, entries) {
41 return cache.matchAll(entries.a.request,
42 {ignoreSearch: true})
43 .then(function(result) {
44 assert_response_array_equivalent(
45 result,
47 entries.a.response,
48 entries.a_with_query.response
50 'Cache.matchAll with ignoreSearch should ignore the ' +
51 'search parameters of cached request.');
52 });
54 'Cache.matchAll with ignoreSearch option (request with no search ' +
55 'parameters)');
57 prepopulated_cache_test(simple_entries, function(cache, entries) {
58 return cache.matchAll(entries.a_with_query.request,
59 {ignoreSearch: true})
60 .then(function(result) {
61 assert_response_array_equivalent(
62 result,
64 entries.a.response,
65 entries.a_with_query.response
67 'Cache.matchAll with ignoreSearch should ignore the ' +
68 'search parameters of request.');
69 });
71 'Cache.matchAll with ignoreSearch option (request with search parameter)');
73 prepopulated_cache_test(simple_entries, function(cache, entries) {
74 return cache.matchAll(entries.cat.request.url + '#mouse')
75 .then(function(result) {
76 assert_response_array_equivalent(
77 result,
79 entries.cat.response,
81 'Cache.matchAll should ignore URL fragment.');
82 });
83 }, 'Cache.matchAll with URL containing fragment');
85 prepopulated_cache_test(simple_entries, function(cache, entries) {
86 return cache.matchAll('http')
87 .then(function(result) {
88 assert_response_array_equivalent(
89 result, [],
90 'Cache.matchAll should treat query as a URL and not ' +
91 'just a string fragment.');
92 });
93 }, 'Cache.matchAll with string fragment "http" as query');
95 prepopulated_cache_test(simple_entries, function(cache, entries) {
96 return cache.matchAll(entries.secret_cat.request.url)
97 .then(function(result) {
98 assert_response_array_equivalent(
99 result, [entries.secret_cat.response],
100 'Cache.matchAll should not ignore embedded credentials');
102 }, 'Cache.matchAll with URL containing credentials');
104 prepopulated_cache_test(vary_entries, function(cache, entries) {
105 return cache.matchAll('http://example.com/c')
106 .then(function(result) {
107 assert_response_array_equivalent(
108 result,
110 entries.vary_wildcard.response,
111 entries.vary_cookie_absent.response
113 'Cache.matchAll should exclude matches if a vary header is ' +
114 'missing in the query request, but is present in the cached ' +
115 'request.');
118 .then(function() {
119 return cache.matchAll(
120 new Request('http://example.com/c',
121 {headers: {'Cookies': 'none-of-the-above'}}));
123 .then(function(result) {
124 assert_response_array_equivalent(
125 result,
127 entries.vary_wildcard.response
129 'Cache.matchAll should exclude matches if a vary header is ' +
130 'missing in the cached request, but is present in the query ' +
131 'request.');
134 .then(function() {
135 return cache.matchAll(
136 new Request('http://example.com/c',
137 {headers: {'Cookies': 'is-for-cookie'}}));
139 .then(function(result) {
140 assert_response_array_equivalent(
141 result,
142 [entries.vary_cookie_is_cookie.response],
143 'Cache.matchAll should match the entire header if a vary header ' +
144 'is present in both the query and cached requests.');
146 }, 'Cache.matchAll with responses containing "Vary" header');
148 prepopulated_cache_test(vary_entries, function(cache, entries) {
149 return cache.matchAll('http://example.com/c',
150 {ignoreVary: true})
151 .then(function(result) {
152 assert_response_array_equivalent(
153 result,
155 entries.vary_cookie_is_cookie.response,
156 entries.vary_cookie_is_good.response,
157 entries.vary_cookie_absent.response,
158 entries.vary_wildcard.response
160 'Cache.matchAll should honor "ignoreVary" parameter.');
162 }, 'Cache.matchAll with "ignoreVary" parameter');
164 done();