| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 5 #ifndef WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
| 6 #define WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 6 #define WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // the behavior of the real implemenation of the AppCacheStorage | 108 // the behavior of the real implemenation of the AppCacheStorage |
| 109 // interface. | 109 // interface. |
| 110 bool ShouldGroupLoadAppearAsync(const AppCacheGroup* group); | 110 bool ShouldGroupLoadAppearAsync(const AppCacheGroup* group); |
| 111 bool ShouldCacheLoadAppearAsync(const AppCache* cache); | 111 bool ShouldCacheLoadAppearAsync(const AppCache* cache); |
| 112 | 112 |
| 113 // Lazily constructed in-memory disk cache. | 113 // Lazily constructed in-memory disk cache. |
| 114 AppCacheDiskCache* disk_cache() { | 114 AppCacheDiskCache* disk_cache() { |
| 115 if (!disk_cache_.get()) { | 115 if (!disk_cache_.get()) { |
| 116 const int kMaxCacheSize = 10 * 1024 * 1024; | 116 const int kMaxCacheSize = 10 * 1024 * 1024; |
| 117 disk_cache_.reset(new AppCacheDiskCache); | 117 disk_cache_.reset(new AppCacheDiskCache); |
| 118 disk_cache_->InitWithMemBackend(kMaxCacheSize, NULL); | 118 disk_cache_->InitWithMemBackend(kMaxCacheSize, net::CompletionCallback()); |
| 119 } | 119 } |
| 120 return disk_cache_.get(); | 120 return disk_cache_.get(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 // Simulate failures for testing. Once set all subsequent calls | 123 // Simulate failures for testing. Once set all subsequent calls |
| 124 // to MakeGroupObsolete or StorageGroupAndNewestCache will fail. | 124 // to MakeGroupObsolete or StorageGroupAndNewestCache will fail. |
| 125 void SimulateMakeGroupObsoleteFailure() { | 125 void SimulateMakeGroupObsoleteFailure() { |
| 126 simulate_make_group_obsolete_failure_ = true; | 126 simulate_make_group_obsolete_failure_ = true; |
| 127 } | 127 } |
| 128 void SimulateStoreGroupAndNewestCacheFailure() { | 128 void SimulateStoreGroupAndNewestCacheFailure() { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, | 209 FRIEND_TEST_ALL_PREFIXES(MockAppCacheStorageTest, |
| 210 StoreExistingGroupExistingCache); | 210 StoreExistingGroupExistingCache); |
| 211 FRIEND_TEST_ALL_PREFIXES(AppCacheServiceTest, DeleteAppCachesForOrigin); | 211 FRIEND_TEST_ALL_PREFIXES(AppCacheServiceTest, DeleteAppCachesForOrigin); |
| 212 | 212 |
| 213 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); | 213 DISALLOW_COPY_AND_ASSIGN(MockAppCacheStorage); |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 } // namespace appcache | 216 } // namespace appcache |
| 217 | 217 |
| 218 #endif // WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ | 218 #endif // WEBKIT_APPCACHE_MOCK_APPCACHE_STORAGE_H_ |
| OLD | NEW |