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

Side by Side Diff: LayoutTests/http/tests/cachestorage/script-tests/cache-match.js

Issue 1262773003: CacheStorage: Update test expectations for Cache.matchAll() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 4 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
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 // A set of Request/Response pairs to be used with prepopulated_cache_test(). 7 // A set of Request/Response pairs to be used with prepopulated_cache_test().
8 var simple_entries = [ 8 var simple_entries = [
9 { 9 {
10 name: 'a', 10 name: 'a',
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return cache.match('not-present-in-the-cache') 138 return cache.match('not-present-in-the-cache')
139 .then(function(result) { 139 .then(function(result) {
140 assert_equals(result, undefined, 140 assert_equals(result, undefined,
141 'Cache.match failures should resolve with undefined.'); 141 'Cache.match failures should resolve with undefined.');
142 }); 142 });
143 }, 'Cache.match with no matching entries'); 143 }, 'Cache.match with no matching entries');
144 144
145 prepopulated_cache_test(simple_entries, function(cache, entries) { 145 prepopulated_cache_test(simple_entries, function(cache, entries) {
146 return cache.matchAll(entries.a.request.url) 146 return cache.matchAll(entries.a.request.url)
147 .then(function(result) { 147 .then(function(result) {
148 assert_array_objects_equals(result, [entries.a.response], 148 assert_array_equivalent(result, [entries.a.response],
149 'Cache.matchAll should match by URL.'); 149 'Cache.matchAll should match by URL.');
150 }); 150 });
151 }, 'Cache.matchAll with URL'); 151 }, 'Cache.matchAll with URL');
152 152
153 prepopulated_cache_test(simple_entries, function(cache, entries) { 153 prepopulated_cache_test(simple_entries, function(cache, entries) {
154 return cache.match(entries.a.request.url) 154 return cache.match(entries.a.request.url)
155 .then(function(result) { 155 .then(function(result) {
156 assert_object_equals_fixed(result, entries.a.response, 156 assert_object_equals_fixed(result, entries.a.response,
157 'Cache.match should match by URL.'); 157 'Cache.match should match by URL.');
158 }); 158 });
159 }, 'Cache.match with URL'); 159 }, 'Cache.match with URL');
160 160
161 prepopulated_cache_test(simple_entries, function(cache, entries) { 161 prepopulated_cache_test(simple_entries, function(cache, entries) {
162 return cache.matchAll(entries.a.request) 162 return cache.matchAll(entries.a.request)
163 .then(function(result) { 163 .then(function(result) {
164 assert_array_objects_equals( 164 assert_array_equivalent(result, [entries.a.response],
165 result, [entries.a.response], 165 'Cache.matchAll should match by Request.');
166 'Cache.matchAll should match by Request.');
167 }); 166 });
168 }, 'Cache.matchAll with Request'); 167 }, 'Cache.matchAll with Request');
169 168
170 prepopulated_cache_test(simple_entries, function(cache, entries) { 169 prepopulated_cache_test(simple_entries, function(cache, entries) {
171 return cache.match(entries.a.request) 170 return cache.match(entries.a.request)
172 .then(function(result) { 171 .then(function(result) {
173 assert_object_equals_fixed(result, entries.a.response, 172 assert_object_equals_fixed(result, entries.a.response,
174 'Cache.match should match by Request.'); 173 'Cache.match should match by Request.');
175 }); 174 });
176 }, 'Cache.match with Request'); 175 }, 'Cache.match with Request');
177 176
178 prepopulated_cache_test(simple_entries, function(cache, entries) { 177 prepopulated_cache_test(simple_entries, function(cache, entries) {
179 return cache.matchAll(new Request(entries.a.request.url)) 178 return cache.matchAll(new Request(entries.a.request.url))
180 .then(function(result) { 179 .then(function(result) {
181 assert_array_objects_equals( 180 assert_array_equivalent(result, [entries.a.response],
182 result, [entries.a.response], 181 'Cache.matchAll should match by Request.');
183 'Cache.matchAll should match by Request.');
184 }); 182 });
185 }, 'Cache.matchAll with new Request'); 183 }, 'Cache.matchAll with new Request');
186 184
187 prepopulated_cache_test(simple_entries, function(cache, entries) { 185 prepopulated_cache_test(simple_entries, function(cache, entries) {
188 return cache.match(new Request(entries.a.request.url)) 186 return cache.match(new Request(entries.a.request.url))
189 .then(function(result) { 187 .then(function(result) {
190 assert_object_equals_fixed(result, entries.a.response, 188 assert_object_equals_fixed(result, entries.a.response,
191 'Cache.match should match by Request.'); 189 'Cache.match should match by Request.');
192 }); 190 });
193 }, 'Cache.match with new Request'); 191 }, 'Cache.match with new Request');
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 assert_equals(Object.keys(hash).length, entries.length); 506 assert_equals(Object.keys(hash).length, entries.length);
509 }); 507 });
510 508
511 return p.then(function() { 509 return p.then(function() {
512 return test_function(cache, hash); 510 return test_function(cache, hash);
513 }); 511 });
514 }, description); 512 }, description);
515 } 513 }
516 514
517 done(); 515 done();
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/http/tests/cachestorage/serviceworker/cache-match-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698