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

Side by Side Diff: content/browser/cache_storage/cache_storage_manager_unittest.cc

Issue 1113303003: CacheStorage: Support multiple batch operations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_responses
Patch Set: Created 5 years, 7 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 // 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 base::Bind(&CacheStorageManagerTest::CacheMatchCallback, 184 base::Bind(&CacheStorageManagerTest::CacheMatchCallback,
185 base::Unretained(this), base::Unretained(loop.get()))); 185 base::Unretained(this), base::Unretained(loop.get())));
186 loop->Run(); 186 loop->Run();
187 187
188 bool error = callback_cache_error_ != CacheStorageCache::ERROR_TYPE_OK; 188 bool error = callback_cache_error_ != CacheStorageCache::ERROR_TYPE_OK;
189 return !error; 189 return !error;
190 } 190 }
191 191
192 bool CachePut(const scoped_refptr<CacheStorageCache>& cache, 192 bool CachePut(const scoped_refptr<CacheStorageCache>& cache,
193 const GURL& url) { 193 const GURL& url) {
194 scoped_ptr<ServiceWorkerFetchRequest> request( 194 ServiceWorkerFetchRequest request;
195 new ServiceWorkerFetchRequest()); 195 ServiceWorkerResponse response;
196 scoped_ptr<ServiceWorkerResponse> response(new ServiceWorkerResponse()); 196 request.url = url;
197 request->url = url; 197 response.url = url;
198 response->url = url; 198
199 CacheStorageBatchOperation operation;
200 operation.operation_type = CACHE_STORAGE_CACHE_OPERATION_TYPE_PUT;
201 operation.request = request;
202 operation.response = response;
203
199 scoped_ptr<base::RunLoop> loop(new base::RunLoop()); 204 scoped_ptr<base::RunLoop> loop(new base::RunLoop());
200 cache->Put( 205 cache->BatchOperation(
201 request.Pass(), response.Pass(), 206 std::vector<CacheStorageBatchOperation>(1, operation),
202 base::Bind(&CacheStorageManagerTest::CachePutCallback, 207 base::Bind(&CacheStorageManagerTest::CachePutCallback,
203 base::Unretained(this), base::Unretained(loop.get()))); 208 base::Unretained(this), base::Unretained(loop.get())));
204 loop->Run(); 209 loop->Run();
205 210
206 bool error = callback_cache_error_ != CacheStorageCache::ERROR_TYPE_OK; 211 bool error = callback_cache_error_ != CacheStorageCache::ERROR_TYPE_OK;
207 return !error; 212 return !error;
208 } 213 }
209 214
210 bool CacheMatch(const scoped_refptr<CacheStorageCache>& cache, 215 bool CacheMatch(const scoped_refptr<CacheStorageCache>& cache,
211 const GURL& url) { 216 const GURL& url) {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 799
795 INSTANTIATE_TEST_CASE_P(CacheStorageManagerTests, 800 INSTANTIATE_TEST_CASE_P(CacheStorageManagerTests,
796 CacheStorageManagerTestP, 801 CacheStorageManagerTestP,
797 ::testing::Values(false, true)); 802 ::testing::Values(false, true));
798 803
799 INSTANTIATE_TEST_CASE_P(CacheStorageQuotaClientTests, 804 INSTANTIATE_TEST_CASE_P(CacheStorageQuotaClientTests,
800 CacheStorageQuotaClientTestP, 805 CacheStorageQuotaClientTestP,
801 ::testing::Values(false, true)); 806 ::testing::Values(false, true));
802 807
803 } // namespace content 808 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698