OLD | NEW |
1 importScripts('worker-testharness.js'); | 1 importScripts('worker-testharness.js'); |
2 importScripts('/resources/testharness-helpers.js'); | 2 importScripts('/resources/testharness-helpers.js'); |
3 importScripts('override_assert_object_equals.js'); | 3 importScripts('override_assert_object_equals.js'); |
4 | 4 |
5 // A set of Request/Response pairs to be used with prepopulated_cache_test(). | 5 // A set of Request/Response pairs to be used with prepopulated_cache_test(). |
6 var simple_entries = [ | 6 var simple_entries = [ |
7 { | 7 { |
8 name: 'a', | 8 name: 'a', |
9 request: new Request('http://example.com/a'), | 9 request: new Request('http://example.com/a'), |
10 response: new Response('') | 10 response: new Response('') |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 prepopulated_cache_test(simple_entries, function(cache, entries) { | 174 prepopulated_cache_test(simple_entries, function(cache, entries) { |
175 return cache.match(new Request(entries.a.request.url)) | 175 return cache.match(new Request(entries.a.request.url)) |
176 .then(function(result) { | 176 .then(function(result) { |
177 assert_object_equals(result, entries.a.response, | 177 assert_object_equals(result, entries.a.response, |
178 'Cache.match should match by Request.'); | 178 'Cache.match should match by Request.'); |
179 }); | 179 }); |
180 }, 'Cache.match with new Request'); | 180 }, 'Cache.match with new Request'); |
181 | 181 |
182 cache_test(function(cache) { | 182 cache_test(function(cache) { |
183 var request = new Request('https://example.com/foo', { | 183 var request = new Request('https://example.com/foo', { |
184 method: 'GET', | 184 method: 'POST', |
185 body: 'Hello world!' | 185 body: 'Hello world!' |
186 }); | 186 }); |
187 var response = new Response('Booyah!', { | 187 var response = new Response('Booyah!', { |
188 status: 200, | 188 status: 200, |
189 headers: {'Content-Type': 'text/plain'} | 189 headers: {'Content-Type': 'text/plain'} |
190 }); | 190 }); |
191 | 191 |
192 return cache.put(request.clone(), response.clone()) | 192 return cache.put(request.clone(), response.clone()) |
193 .then(function() { | 193 .then(function() { |
194 assert_false( | 194 assert_false( |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 }); | 586 }); |
587 p = p.then(function() { | 587 p = p.then(function() { |
588 assert_equals(Object.keys(hash).length, entries.length); | 588 assert_equals(Object.keys(hash).length, entries.length); |
589 }); | 589 }); |
590 | 590 |
591 return p.then(function() { | 591 return p.then(function() { |
592 return test_function(cache, hash); | 592 return test_function(cache, hash); |
593 }); | 593 }); |
594 }, description); | 594 }, description); |
595 } | 595 } |
OLD | NEW |