OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/cache_storage/cache_storage_manager.h" | 5 #include "content/browser/cache_storage/cache_storage_manager.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 base::Bind(&CacheStorageManagerTest::CacheMatchCallback, | 183 base::Bind(&CacheStorageManagerTest::CacheMatchCallback, |
184 base::Unretained(this), base::Unretained(loop.get()))); | 184 base::Unretained(this), base::Unretained(loop.get()))); |
185 loop->Run(); | 185 loop->Run(); |
186 | 186 |
187 bool error = callback_cache_error_ != CACHE_STORAGE_OK; | 187 bool error = callback_cache_error_ != CACHE_STORAGE_OK; |
188 return !error; | 188 return !error; |
189 } | 189 } |
190 | 190 |
191 bool CachePut(const scoped_refptr<CacheStorageCache>& cache, | 191 bool CachePut(const scoped_refptr<CacheStorageCache>& cache, |
192 const GURL& url) { | 192 const GURL& url) { |
193 scoped_ptr<ServiceWorkerFetchRequest> request( | 193 ServiceWorkerFetchRequest request; |
194 new ServiceWorkerFetchRequest()); | 194 ServiceWorkerResponse response; |
195 scoped_ptr<ServiceWorkerResponse> response(new ServiceWorkerResponse()); | 195 request.url = url; |
196 request->url = url; | 196 response.url = url; |
197 response->url = url; | 197 |
| 198 CacheStorageBatchOperation operation; |
| 199 operation.operation_type = CACHE_STORAGE_CACHE_OPERATION_TYPE_PUT; |
| 200 operation.request = request; |
| 201 operation.response = response; |
| 202 |
198 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); | 203 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); |
199 cache->Put( | 204 cache->BatchOperation( |
200 request.Pass(), response.Pass(), | 205 std::vector<CacheStorageBatchOperation>(1, operation), |
201 base::Bind(&CacheStorageManagerTest::CachePutCallback, | 206 base::Bind(&CacheStorageManagerTest::CachePutCallback, |
202 base::Unretained(this), base::Unretained(loop.get()))); | 207 base::Unretained(this), base::Unretained(loop.get()))); |
203 loop->Run(); | 208 loop->Run(); |
204 | 209 |
205 bool error = callback_cache_error_ != CACHE_STORAGE_OK; | 210 bool error = callback_cache_error_ != CACHE_STORAGE_OK; |
206 return !error; | 211 return !error; |
207 } | 212 } |
208 | 213 |
209 bool CacheMatch(const scoped_refptr<CacheStorageCache>& cache, | 214 bool CacheMatch(const scoped_refptr<CacheStorageCache>& cache, |
210 const GURL& url) { | 215 const GURL& url) { |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 | 798 |
794 INSTANTIATE_TEST_CASE_P(CacheStorageManagerTests, | 799 INSTANTIATE_TEST_CASE_P(CacheStorageManagerTests, |
795 CacheStorageManagerTestP, | 800 CacheStorageManagerTestP, |
796 ::testing::Values(false, true)); | 801 ::testing::Values(false, true)); |
797 | 802 |
798 INSTANTIATE_TEST_CASE_P(CacheStorageQuotaClientTests, | 803 INSTANTIATE_TEST_CASE_P(CacheStorageQuotaClientTests, |
799 CacheStorageQuotaClientTestP, | 804 CacheStorageQuotaClientTestP, |
800 ::testing::Values(false, true)); | 805 ::testing::Values(false, true)); |
801 | 806 |
802 } // namespace content | 807 } // namespace content |
OLD | NEW |