Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 if (self.importScripts) { | 1 if (self.importScripts) { |
| 2 importScripts('/resources/testharness.js'); | 2 importScripts('/resources/testharness.js'); |
| 3 importScripts('../resources/test-helpers.js'); | 3 importScripts('../resources/test-helpers.js'); |
| 4 } | 4 } |
| 5 | 5 |
| 6 cache_test(cache => { | 6 cache_test(cache => { |
| 7 return cache.keys() | 7 return cache.keys() |
| 8 .then(requests => { | 8 .then(requests => { |
| 9 assert_equals( | 9 assert_equals( |
| 10 requests.length, 0, | 10 requests.length, 0, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 [ | 77 [ |
| 78 entries.a.request, | 78 entries.a.request, |
| 79 entries.a_with_query.request | 79 entries.a_with_query.request |
| 80 ], | 80 ], |
| 81 'Cache.keys with ignoreSearch should ignore the ' + | 81 'Cache.keys with ignoreSearch should ignore the ' + |
| 82 'search parameters of request.'); | 82 'search parameters of request.'); |
| 83 }); | 83 }); |
| 84 }, | 84 }, |
| 85 'Cache.keys with ignoreSearch option (request with search parameters)'); | 85 'Cache.keys with ignoreSearch option (request with search parameters)'); |
| 86 | 86 |
| 87 cache_test(function(cache) { | |
| 88 var request = new Request('http://example.com/'); | |
| 89 var head_request = new Request('http://example.com/', {method: 'HEAD'}); | |
| 90 var response = new Response('foo'); | |
| 91 return cache.put(request.clone(), response.clone()) | |
| 92 .then(function() { | |
| 93 return cache.keys(head_request.clone()); | |
| 94 }) | |
| 95 .then(function(result) { | |
| 96 assert_request_array_equals( | |
| 97 result, [], | |
| 98 'Cache.keys should resolve with an empty array with a ' + | |
| 99 'mismatched method.'); | |
| 100 return cache.keys(head_request.clone(), | |
| 101 {ignoreMethod: true}); | |
| 102 }) | |
| 103 .then(function(result) { | |
| 104 assert_request_array_equivalent( | |
| 105 result, | |
| 106 [ | |
| 107 request, | |
| 108 ], | |
| 109 'Cache.keys with ignoreMethod should ignore the ' + | |
| 110 'method of request.'); | |
| 111 | |
|
nhiroki
2016/08/18 00:05:43
blank line
jkarlin
2016/08/18 14:08:23
Done.
| |
| 112 }); | |
| 113 }, 'Cache.keys supports ignoreMethod'); | |
| 114 | |
| 115 cache_test(function(cache) { | |
| 116 var vary_request = new Request('http://example.com/c', | |
| 117 {headers: {'Cookies': 'is-for-cookie'}}); | |
| 118 var vary_response = new Response('', {headers: {'Vary': 'Cookies'}}); | |
| 119 var mismatched_vary_request = new Request('http://example.com/c'); | |
| 120 | |
| 121 return cache.put(vary_request.clone(), vary_response.clone()) | |
| 122 .then(function() { | |
| 123 return cache.keys(mismatched_vary_request.clone()); | |
| 124 }) | |
| 125 .then(function(result) { | |
| 126 assert_request_array_equals( | |
| 127 result, [], | |
| 128 'Cache.keys should resolve with an empty array with a ' + | |
| 129 'mismatched vary.'); | |
| 130 return cache.keys(mismatched_vary_request.clone(), | |
| 131 {ignoreVary: true}); | |
| 132 }) | |
| 133 .then(function(result) { | |
| 134 assert_request_array_equivalent( | |
| 135 result, | |
| 136 [ | |
| 137 vary_request, | |
| 138 ], | |
| 139 'Cache.keys with ignoreVary should ignore the ' + | |
| 140 'vary of request.'); | |
| 141 }); | |
| 142 }, 'Cache.keys supports ignoreVary'); | |
| 143 | |
| 87 prepopulated_cache_test(simple_entries, function(cache, entries) { | 144 prepopulated_cache_test(simple_entries, function(cache, entries) { |
| 88 return cache.keys(entries.cat.request.url + '#mouse') | 145 return cache.keys(entries.cat.request.url + '#mouse') |
| 89 .then(function(result) { | 146 .then(function(result) { |
| 90 assert_request_array_equals( | 147 assert_request_array_equals( |
| 91 result, | 148 result, |
| 92 [ | 149 [ |
| 93 entries.cat.request, | 150 entries.cat.request, |
| 94 ], | 151 ], |
| 95 'Cache.keys should ignore URL fragment.'); | 152 'Cache.keys should ignore URL fragment.'); |
| 96 }); | 153 }); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 return cache.keys(new Request(entries.cat.request.url, {method: 'HEAD'})) | 193 return cache.keys(new Request(entries.cat.request.url, {method: 'HEAD'})) |
| 137 .then(function(result) { | 194 .then(function(result) { |
| 138 assert_request_array_equals( | 195 assert_request_array_equals( |
| 139 result, [], | 196 result, [], |
| 140 'Cache.keys should not match HEAD request unless ignoreMethod ' + | 197 'Cache.keys should not match HEAD request unless ignoreMethod ' + |
| 141 'option is set.'); | 198 'option is set.'); |
| 142 }); | 199 }); |
| 143 }, 'Cache.keys with a HEAD Request'); | 200 }, 'Cache.keys with a HEAD Request'); |
| 144 | 201 |
| 145 done(); | 202 done(); |
| OLD | NEW |