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 #ifndef CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
6 #define CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 6 #define CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
11 #include <map> | 11 #include <map> |
| 12 #include <memory> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/callback.h" | 15 #include "base/callback.h" |
15 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "base/memory/scoped_ptr.h" | |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "content/browser/appcache/appcache.h" | 20 #include "content/browser/appcache/appcache.h" |
21 #include "content/browser/appcache/appcache_disk_cache.h" | 21 #include "content/browser/appcache/appcache_disk_cache.h" |
22 #include "content/browser/appcache/appcache_group.h" | 22 #include "content/browser/appcache/appcache_group.h" |
23 #include "content/browser/appcache/appcache_response.h" | 23 #include "content/browser/appcache/appcache_response.h" |
24 #include "content/browser/appcache/appcache_storage.h" | 24 #include "content/browser/appcache/appcache_storage.h" |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 FORWARD_DECLARE_TEST(AppCacheServiceImplTest, DeleteAppCachesForOrigin); | 27 FORWARD_DECLARE_TEST(AppCacheServiceImplTest, DeleteAppCachesForOrigin); |
28 FORWARD_DECLARE_TEST(MockAppCacheStorageTest, BasicFindMainResponse); | 28 FORWARD_DECLARE_TEST(MockAppCacheStorageTest, BasicFindMainResponse); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 void SimulateResponseReader(AppCacheResponseReader* reader) { | 196 void SimulateResponseReader(AppCacheResponseReader* reader) { |
197 simulated_reader_.reset(reader); | 197 simulated_reader_.reset(reader); |
198 } | 198 } |
199 | 199 |
200 StoredCacheMap stored_caches_; | 200 StoredCacheMap stored_caches_; |
201 StoredGroupMap stored_groups_; | 201 StoredGroupMap stored_groups_; |
202 StoredEvictionTimesMap stored_eviction_times_; | 202 StoredEvictionTimesMap stored_eviction_times_; |
203 DoomedResponseIds doomed_response_ids_; | 203 DoomedResponseIds doomed_response_ids_; |
204 scoped_ptr<AppCacheDiskCache> disk_cache_; | 204 std::unique_ptr<AppCacheDiskCache> disk_cache_; |
205 std::deque<base::Closure> pending_tasks_; | 205 std::deque<base::Closure> pending_tasks_; |
206 | 206 |
207 bool simulate_make_group_obsolete_failure_; | 207 bool simulate_make_group_obsolete_failure_; |
208 bool simulate_store_group_and_newest_cache_failure_; | 208 bool simulate_store_group_and_newest_cache_failure_; |
209 | 209 |
210 bool simulate_find_main_resource_; | 210 bool simulate_find_main_resource_; |
211 bool simulate_find_sub_resource_; | 211 bool simulate_find_sub_resource_; |
212 AppCacheEntry simulated_found_entry_; | 212 AppCacheEntry simulated_found_entry_; |
213 AppCacheEntry simulated_found_fallback_entry_; | 213 AppCacheEntry simulated_found_fallback_entry_; |
214 int64_t simulated_found_cache_id_; | 214 int64_t simulated_found_cache_id_; |
215 int64_t simulated_found_group_id_; | 215 int64_t simulated_found_group_id_; |
216 GURL simulated_found_fallback_url_; | 216 GURL simulated_found_fallback_url_; |
217 GURL simulated_found_manifest_url_; | 217 GURL simulated_found_manifest_url_; |
218 bool simulated_found_network_namespace_; | 218 bool simulated_found_network_namespace_; |
219 scoped_refptr<AppCacheInfoCollection> simulated_appcache_info_; | 219 scoped_refptr<AppCacheInfoCollection> simulated_appcache_info_; |
220 scoped_ptr<AppCacheResponseReader> simulated_reader_; | 220 std::unique_ptr<AppCacheResponseReader> simulated_reader_; |
221 | 221 |
222 base::WeakPtrFactory<MockAppCacheStorage> weak_factory_; | 222 base::WeakPtrFactory<MockAppCacheStorage> weak_factory_; |
223 | 223 |
224 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, | 224 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, |
225 BasicFindMainResponse); | 225 BasicFindMainResponse); |
226 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, | 226 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, |
227 BasicFindMainFallbackResponse); | 227 BasicFindMainFallbackResponse); |
228 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, CreateGroup); | 228 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, CreateGroup); |
229 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, | 229 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, |
230 FindMainResponseExclusions); | 230 FindMainResponseExclusions); |
(...skipping 10 matching lines...) Expand all Loading... |
241 StoreExistingGroupExistingCache); | 241 StoreExistingGroupExistingCache); |
242 FRIEND_TEST_ALL_PREFIXES(AppCacheServiceImplTest, | 242 FRIEND_TEST_ALL_PREFIXES(AppCacheServiceImplTest, |
243 DeleteAppCachesForOrigin); | 243 DeleteAppCachesForOrigin); |
244 | 244 |
245 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); | 245 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); |
246 }; | 246 }; |
247 | 247 |
248 } // namespace content | 248 } // namespace content |
249 | 249 |
250 #endif // CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 250 #endif // CONTENT_BROWSER_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
OLD | NEW |