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 var test_url = 'https://example.com/foo'; | 6 var test_url = 'https://example.com/foo'; |
7 | 7 |
8 // Construct a generic Request object. The URL is |test_url|. All other fields | 8 // Construct a generic Request object. The URL is |test_url|. All other fields |
9 // are defaults. | 9 // are defaults. |
10 function new_test_request() { | 10 function new_test_request() { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 assert_false(result, | 110 assert_false(result, |
111 'Cache.delete should resolve with "false" if there ' + | 111 'Cache.delete should resolve with "false" if there ' + |
112 'are no matching entries.'); | 112 'are no matching entries.'); |
113 }); | 113 }); |
114 }, 'Cache.delete with a non-existent entry'); | 114 }, 'Cache.delete with a non-existent entry'); |
115 | 115 |
116 prepopulated_cache_test(simple_entries, function(cache, entries) { | 116 prepopulated_cache_test(simple_entries, function(cache, entries) { |
117 return cache.matchAll(entries.a_with_query.request, | 117 return cache.matchAll(entries.a_with_query.request, |
118 { ignoreSearch: true }) | 118 { ignoreSearch: true }) |
119 .then(function(result) { | 119 .then(function(result) { |
120 assert_response_array_equivalent( | 120 assert_response_array_equals( |
121 result, | 121 result, |
122 [ | 122 [ |
123 entries.a.response, | 123 entries.a.response, |
124 entries.a_with_query.response | 124 entries.a_with_query.response |
125 ]); | 125 ]); |
126 return cache.delete(entries.a_with_query.request, | 126 return cache.delete(entries.a_with_query.request, |
127 { ignoreSearch: true }); | 127 { ignoreSearch: true }); |
128 }) | 128 }) |
129 .then(function(result) { | 129 .then(function(result) { |
130 return cache.matchAll(entries.a_with_query.request, | 130 return cache.matchAll(entries.a_with_query.request, |
131 { ignoreSearch: true }); | 131 { ignoreSearch: true }); |
132 }) | 132 }) |
133 .then(function(result) { | 133 .then(function(result) { |
134 assert_response_array_equivalent(result, []); | 134 assert_response_array_equals(result, []); |
135 }); | 135 }); |
136 }, | 136 }, |
137 'Cache.delete with ignoreSearch option (request with search parameters)'); | 137 'Cache.delete with ignoreSearch option (request with search parameters)'); |
138 | 138 |
139 prepopulated_cache_test(simple_entries, function(cache, entries) { | 139 prepopulated_cache_test(simple_entries, function(cache, entries) { |
140 return cache.matchAll(entries.a_with_query.request, | 140 return cache.matchAll(entries.a_with_query.request, |
141 { ignoreSearch: true }) | 141 { ignoreSearch: true }) |
142 .then(function(result) { | 142 .then(function(result) { |
143 assert_response_array_equivalent( | 143 assert_response_array_equals( |
144 result, | 144 result, |
145 [ | 145 [ |
146 entries.a.response, | 146 entries.a.response, |
147 entries.a_with_query.response | 147 entries.a_with_query.response |
148 ]); | 148 ]); |
149 // cache.delete()'s behavior should be the same if ignoreSearch is | 149 // cache.delete()'s behavior should be the same if ignoreSearch is |
150 // not provided or if ignoreSearch is false. | 150 // not provided or if ignoreSearch is false. |
151 return cache.delete(entries.a_with_query.request, | 151 return cache.delete(entries.a_with_query.request, |
152 { ignoreSearch: false }); | 152 { ignoreSearch: false }); |
153 }) | 153 }) |
154 .then(function(result) { | 154 .then(function(result) { |
155 return cache.matchAll(entries.a_with_query.request, | 155 return cache.matchAll(entries.a_with_query.request, |
156 { ignoreSearch: true }); | 156 { ignoreSearch: true }); |
157 }) | 157 }) |
158 .then(function(result) { | 158 .then(function(result) { |
159 assert_response_array_equivalent(result, [ entries.a.response ]); | 159 assert_response_array_equals(result, [ entries.a.response ]); |
160 }); | 160 }); |
161 }, | 161 }, |
162 'Cache.delete with ignoreSearch option (when it is specified as false)'); | 162 'Cache.delete with ignoreSearch option (when it is specified as false)'); |
163 | 163 |
164 done(); | 164 done(); |
OLD | NEW |