OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 protected: | 39 protected: |
40 DiskCacheTest(); | 40 DiskCacheTest(); |
41 virtual ~DiskCacheTest(); | 41 virtual ~DiskCacheTest(); |
42 | 42 |
43 // Copies a set of cache files from the data folder to the test folder. | 43 // Copies a set of cache files from the data folder to the test folder. |
44 bool CopyTestCache(const std::string& name); | 44 bool CopyTestCache(const std::string& name); |
45 | 45 |
46 // Deletes the contents of |cache_path_|. | 46 // Deletes the contents of |cache_path_|. |
47 bool CleanupCacheDir(); | 47 bool CleanupCacheDir(); |
48 | 48 |
49 virtual void TearDown() OVERRIDE; | 49 virtual void TearDown() override; |
50 | 50 |
51 base::FilePath cache_path_; | 51 base::FilePath cache_path_; |
52 | 52 |
53 private: | 53 private: |
54 base::ScopedTempDir temp_dir_; | 54 base::ScopedTempDir temp_dir_; |
55 scoped_ptr<base::MessageLoop> message_loop_; | 55 scoped_ptr<base::MessageLoop> message_loop_; |
56 }; | 56 }; |
57 | 57 |
58 // Provides basic support for cache related tests. | 58 // Provides basic support for cache related tests. |
59 class DiskCacheTestWithCache : public DiskCacheTest { | 59 class DiskCacheTestWithCache : public DiskCacheTest { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 // Asks the cache to trim an entry from the deleted list. If |empty| is | 148 // Asks the cache to trim an entry from the deleted list. If |empty| is |
149 // true, the whole list is deleted. | 149 // true, the whole list is deleted. |
150 void TrimDeletedListForTest(bool empty); | 150 void TrimDeletedListForTest(bool empty); |
151 | 151 |
152 // Makes sure that some time passes before continuing the test. Time::Now() | 152 // Makes sure that some time passes before continuing the test. Time::Now() |
153 // before and after this method will not be the same. | 153 // before and after this method will not be the same. |
154 void AddDelay(); | 154 void AddDelay(); |
155 | 155 |
156 // DiskCacheTest: | 156 // DiskCacheTest: |
157 virtual void TearDown() OVERRIDE; | 157 virtual void TearDown() override; |
158 | 158 |
159 // cache_ will always have a valid object, regardless of how the cache was | 159 // cache_ will always have a valid object, regardless of how the cache was |
160 // initialized. The implementation pointers can be NULL. | 160 // initialized. The implementation pointers can be NULL. |
161 scoped_ptr<disk_cache::Backend> cache_; | 161 scoped_ptr<disk_cache::Backend> cache_; |
162 disk_cache::BackendImpl* cache_impl_; | 162 disk_cache::BackendImpl* cache_impl_; |
163 disk_cache::SimpleBackendImpl* simple_cache_impl_; | 163 disk_cache::SimpleBackendImpl* simple_cache_impl_; |
164 disk_cache::MemBackendImpl* mem_cache_; | 164 disk_cache::MemBackendImpl* mem_cache_; |
165 | 165 |
166 uint32 mask_; | 166 uint32 mask_; |
167 int size_; | 167 int size_; |
(...skipping 11 matching lines...) Expand all Loading... |
179 | 179 |
180 private: | 180 private: |
181 void InitMemoryCache(); | 181 void InitMemoryCache(); |
182 void InitDiskCache(); | 182 void InitDiskCache(); |
183 | 183 |
184 base::Thread cache_thread_; | 184 base::Thread cache_thread_; |
185 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); | 185 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); |
186 }; | 186 }; |
187 | 187 |
188 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ | 188 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ |
OLD | NEW |