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

Side by Side Diff: net/disk_cache/disk_cache_test_base.h

Issue 12794003: Initialize the simple cache backend at runtime. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebased to latest, auto-merged net.gyp Created 7 years, 8 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
« no previous file with comments | « net/disk_cache/cache_util.cc ('k') | net/disk_cache/disk_cache_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ 5 #ifndef NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_
6 #define NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ 6 #define NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 base::ScopedTempDir temp_dir_; 52 base::ScopedTempDir temp_dir_;
53 scoped_ptr<MessageLoop> message_loop_; 53 scoped_ptr<MessageLoop> message_loop_;
54 }; 54 };
55 55
56 // Provides basic support for cache related tests. 56 // Provides basic support for cache related tests.
57 class DiskCacheTestWithCache : public DiskCacheTest { 57 class DiskCacheTestWithCache : public DiskCacheTest {
58 protected: 58 protected:
59 DiskCacheTestWithCache(); 59 DiskCacheTestWithCache();
60 virtual ~DiskCacheTestWithCache(); 60 virtual ~DiskCacheTestWithCache();
61 61
62 void CreateBackend(uint32 flags, base::Thread* thread);
63
62 void InitCache(); 64 void InitCache();
65 void InitDefaultCacheViaCreator();
63 void SimulateCrash(); 66 void SimulateCrash();
64 void SetTestMode(); 67 void SetTestMode();
65 68
66 void SetMemoryOnlyMode() { 69 void SetMemoryOnlyMode() {
67 memory_only_ = true; 70 memory_only_ = true;
68 } 71 }
69 72
70 // Use the implementation directly instead of the factory provided object. 73 void SetSimpleCacheMode() {
71 void SetDirectMode() { 74 simple_cache_mode_ = true;
72 implementation_ = true;
73 } 75 }
74 76
75 void SetMask(uint32 mask) { 77 void SetMask(uint32 mask) {
76 mask_ = mask; 78 mask_ = mask;
77 } 79 }
78 80
79 void SetMaxSize(int size); 81 void SetMaxSize(int size);
80 82
81 // Deletes and re-creates the files on initialization errors. 83 // Deletes and re-creates the files on initialization errors.
82 void SetForceCreation() { 84 void SetForceCreation() {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // cache_ will always have a valid object, regardless of how the cache was 143 // cache_ will always have a valid object, regardless of how the cache was
142 // initialized. The implementation pointers can be NULL. 144 // initialized. The implementation pointers can be NULL.
143 disk_cache::Backend* cache_; 145 disk_cache::Backend* cache_;
144 disk_cache::BackendImpl* cache_impl_; 146 disk_cache::BackendImpl* cache_impl_;
145 disk_cache::MemBackendImpl* mem_cache_; 147 disk_cache::MemBackendImpl* mem_cache_;
146 148
147 uint32 mask_; 149 uint32 mask_;
148 int size_; 150 int size_;
149 net::CacheType type_; 151 net::CacheType type_;
150 bool memory_only_; 152 bool memory_only_;
151 bool implementation_; 153 bool simple_cache_mode_;
152 bool force_creation_; 154 bool force_creation_;
153 bool new_eviction_; 155 bool new_eviction_;
154 bool first_cleanup_; 156 bool first_cleanup_;
155 bool integrity_; 157 bool integrity_;
156 bool use_current_thread_; 158 bool use_current_thread_;
157 // This is intentionally left uninitialized, to be used by any test. 159 // This is intentionally left uninitialized, to be used by any test.
158 bool success_; 160 bool success_;
159 161
160 private: 162 private:
161 void InitMemoryCache(); 163 void InitMemoryCache();
162 void InitDiskCache(); 164 void InitDiskCache();
163 void InitDiskCacheImpl();
164 165
165 base::Thread cache_thread_; 166 base::Thread cache_thread_;
166 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); 167 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache);
167 }; 168 };
168 169
169 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ 170 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_
OLDNEW
« no previous file with comments | « net/disk_cache/cache_util.cc ('k') | net/disk_cache/disk_cache_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698