OLD | NEW |
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('/resources/testharness.js'); | 2 importScripts('/resources/testharness.js'); |
3 importScripts('/resources/testharness-helpers.js'); | 3 importScripts('/resources/testharness-helpers.js'); |
4 importScripts('../resources/test-helpers.js'); | 4 importScripts('../resources/test-helpers.js'); |
5 } | 5 } |
6 | 6 |
7 prepopulated_cache_test(simple_entries, function(cache, entries) { | 7 prepopulated_cache_test(simple_entries, function(cache, entries) { |
8 return cache.matchAll('not-present-in-the-cache') | 8 return cache.matchAll('not-present-in-the-cache') |
9 .then(function(result) { | 9 .then(function(result) { |
10 assert_response_array_equivalent( | 10 assert_response_array_equivalent( |
11 result, [], | 11 result, [], |
12 'Cache.matchAll should resolve with an empty array on failure.'); | 12 'Cache.matchAll should resolve with an empty array on failure.'); |
13 }); | 13 }); |
14 }, 'Cache.matchAll with no matching entries'); | 14 }, 'Cache.matchAll with no matching entries'); |
15 | 15 |
16 prepopulated_cache_test(simple_entries, function(cache, entries) { | 16 prepopulated_cache_test(simple_entries, function(cache, entries) { |
17 return cache.matchAll(entries.a.request.url) | 17 return cache.matchAll(entries.a.request.url) |
18 .then(function(result) { | 18 .then(function(result) { |
19 assert_response_array_equivalent(result, [entries.a.response], | 19 assert_response_array_equals(result, [entries.a.response], |
20 'Cache.matchAll should match by URL.'); | 20 'Cache.matchAll should match by URL.'); |
21 }); | 21 }); |
22 }, 'Cache.matchAll with URL'); | 22 }, 'Cache.matchAll with URL'); |
23 | 23 |
24 prepopulated_cache_test(simple_entries, function(cache, entries) { | 24 prepopulated_cache_test(simple_entries, function(cache, entries) { |
25 return cache.matchAll(entries.a.request) | 25 return cache.matchAll(entries.a.request) |
26 .then(function(result) { | 26 .then(function(result) { |
27 assert_response_array_equivalent(result, [entries.a.response], | 27 assert_response_array_equals( |
28 'Cache.matchAll should match by Request.'); | 28 result, [entries.a.response], |
| 29 'Cache.matchAll should match by Request.'); |
29 }); | 30 }); |
30 }, 'Cache.matchAll with Request'); | 31 }, 'Cache.matchAll with Request'); |
31 | 32 |
32 prepopulated_cache_test(simple_entries, function(cache, entries) { | 33 prepopulated_cache_test(simple_entries, function(cache, entries) { |
33 return cache.matchAll(new Request(entries.a.request.url)) | 34 return cache.matchAll(new Request(entries.a.request.url)) |
34 .then(function(result) { | 35 .then(function(result) { |
35 assert_response_array_equivalent(result, [entries.a.response], | 36 assert_response_array_equals( |
36 'Cache.matchAll should match by Request.'); | 37 result, [entries.a.response], |
| 38 'Cache.matchAll should match by Request.'); |
37 }); | 39 }); |
38 }, 'Cache.matchAll with new Request'); | 40 }, 'Cache.matchAll with new Request'); |
39 | 41 |
40 prepopulated_cache_test(simple_entries, function(cache, entries) { | 42 prepopulated_cache_test(simple_entries, function(cache, entries) { |
41 return cache.matchAll(entries.a.request, | 43 return cache.matchAll(entries.a.request, |
42 {ignoreSearch: true}) | 44 {ignoreSearch: true}) |
43 .then(function(result) { | 45 .then(function(result) { |
44 assert_response_array_equivalent( | 46 assert_response_array_equivalent( |
45 result, | 47 result, |
46 [ | 48 [ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 'Cache.matchAll should not ignore embedded credentials'); | 102 'Cache.matchAll should not ignore embedded credentials'); |
101 }); | 103 }); |
102 }, 'Cache.matchAll with URL containing credentials'); | 104 }, 'Cache.matchAll with URL containing credentials'); |
103 | 105 |
104 prepopulated_cache_test(vary_entries, function(cache, entries) { | 106 prepopulated_cache_test(vary_entries, function(cache, entries) { |
105 return cache.matchAll('http://example.com/c') | 107 return cache.matchAll('http://example.com/c') |
106 .then(function(result) { | 108 .then(function(result) { |
107 assert_response_array_equivalent( | 109 assert_response_array_equivalent( |
108 result, | 110 result, |
109 [ | 111 [ |
110 entries.vary_wildcard.response, | |
111 entries.vary_cookie_absent.response | 112 entries.vary_cookie_absent.response |
112 ], | 113 ], |
113 'Cache.matchAll should exclude matches if a vary header is ' + | 114 'Cache.matchAll should exclude matches if a vary header is ' + |
114 'missing in the query request, but is present in the cached ' + | 115 'missing in the query request, but is present in the cached ' + |
115 'request.'); | 116 'request.'); |
116 }) | 117 }) |
117 | 118 |
118 .then(function() { | 119 .then(function() { |
119 return cache.matchAll( | 120 return cache.matchAll( |
120 new Request('http://example.com/c', | 121 new Request('http://example.com/c', |
121 {headers: {'Cookies': 'none-of-the-above'}})); | 122 {headers: {'Cookies': 'none-of-the-above'}})); |
122 }) | 123 }) |
123 .then(function(result) { | 124 .then(function(result) { |
124 assert_response_array_equivalent( | 125 assert_response_array_equivalent( |
125 result, | 126 result, |
126 [ | 127 [ |
127 entries.vary_wildcard.response | |
128 ], | 128 ], |
129 'Cache.matchAll should exclude matches if a vary header is ' + | 129 'Cache.matchAll should exclude matches if a vary header is ' + |
130 'missing in the cached request, but is present in the query ' + | 130 'missing in the cached request, but is present in the query ' + |
131 'request.'); | 131 'request.'); |
132 }) | 132 }) |
133 | 133 |
134 .then(function() { | 134 .then(function() { |
135 return cache.matchAll( | 135 return cache.matchAll( |
136 new Request('http://example.com/c', | 136 new Request('http://example.com/c', |
137 {headers: {'Cookies': 'is-for-cookie'}})); | 137 {headers: {'Cookies': 'is-for-cookie'}})); |
138 }) | 138 }) |
139 .then(function(result) { | 139 .then(function(result) { |
140 assert_response_array_equivalent( | 140 assert_response_array_equivalent( |
141 result, | 141 result, |
142 [entries.vary_cookie_is_cookie.response], | 142 [entries.vary_cookie_is_cookie.response], |
143 'Cache.matchAll should match the entire header if a vary header ' + | 143 'Cache.matchAll should match the entire header if a vary header ' + |
144 'is present in both the query and cached requests.'); | 144 'is present in both the query and cached requests.'); |
145 }); | 145 }); |
146 }, 'Cache.matchAll with responses containing "Vary" header'); | 146 }, 'Cache.matchAll with responses containing "Vary" header'); |
147 | 147 |
148 prepopulated_cache_test(vary_entries, function(cache, entries) { | 148 prepopulated_cache_test(vary_entries, function(cache, entries) { |
149 return cache.matchAll('http://example.com/c', | 149 return cache.matchAll('http://example.com/c', |
150 {ignoreVary: true}) | 150 {ignoreVary: true}) |
151 .then(function(result) { | 151 .then(function(result) { |
152 assert_response_array_equivalent( | 152 assert_response_array_equivalent( |
153 result, | 153 result, |
154 [ | 154 [ |
155 entries.vary_cookie_is_cookie.response, | 155 entries.vary_cookie_is_cookie.response, |
156 entries.vary_cookie_is_good.response, | 156 entries.vary_cookie_is_good.response, |
157 entries.vary_cookie_absent.response, | 157 entries.vary_cookie_absent.response |
158 entries.vary_wildcard.response | |
159 ], | 158 ], |
160 'Cache.matchAll should honor "ignoreVary" parameter.'); | 159 'Cache.matchAll should honor "ignoreVary" parameter.'); |
161 }); | 160 }); |
162 }, 'Cache.matchAll with "ignoreVary" parameter'); | 161 }, 'Cache.matchAll with "ignoreVary" parameter'); |
163 | 162 |
164 done(); | 163 done(); |
OLD | NEW |