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

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

Issue 1135002: Disk cache" Convert some of the unit tests to the new... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/backend_unittest.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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/time.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/platform_test.h" 11 #include "testing/platform_test.h"
11 12
12 class FilePath; 13 class FilePath;
13 14
14 namespace disk_cache { 15 namespace disk_cache {
15 16
16 class Backend; 17 class Backend;
17 class BackendImpl; 18 class BackendImpl;
19 class Entry;
18 class MemBackendImpl; 20 class MemBackendImpl;
19 21
20 } // namespace disk_cache 22 } // namespace disk_cache
21 23
22 // These tests can use the path service, which uses autoreleased objects on the 24 // These tests can use the path service, which uses autoreleased objects on the
23 // Mac, so this needs to be a PlatformTest. Even tests that do not require a 25 // Mac, so this needs to be a PlatformTest. Even tests that do not require a
24 // cache (and that do not need to be a DiskCacheTestWithCache) are susceptible 26 // cache (and that do not need to be a DiskCacheTestWithCache) are susceptible
25 // to this problem; all such tests should use TEST_F(DiskCacheTest, ...). 27 // to this problem; all such tests should use TEST_F(DiskCacheTest, ...).
26 class DiskCacheTest : public PlatformTest { 28 class DiskCacheTest : public PlatformTest {
27 virtual void TearDown(); 29 virtual void TearDown();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 67 }
66 68
67 void DisableFirstCleanup() { 69 void DisableFirstCleanup() {
68 first_cleanup_ = false; 70 first_cleanup_ = false;
69 } 71 }
70 72
71 void DisableIntegrityCheck() { 73 void DisableIntegrityCheck() {
72 integrity_ = false; 74 integrity_ = false;
73 } 75 }
74 76
77 // Utility methods to access the cache and wait for each operation to finish.
78 int OpenEntry(const std::string& key, disk_cache::Entry** entry);
79 int CreateEntry(const std::string& key, disk_cache::Entry** entry);
80 int DoomEntry(const std::string& key);
81 int DoomAllEntries();
82 int DoomEntriesBetween(const base::Time initial_time,
83 const base::Time end_time);
84 int DoomEntriesSince(const base::Time initial_time);
85 int OpenNextEntry(void** iter, disk_cache::Entry** next_entry);
86
75 // cache_ will always have a valid object, regardless of how the cache was 87 // cache_ will always have a valid object, regardless of how the cache was
76 // initialized. The implementation pointers can be NULL. 88 // initialized. The implementation pointers can be NULL.
77 disk_cache::Backend* cache_; 89 disk_cache::Backend* cache_;
78 disk_cache::BackendImpl* cache_impl_; 90 disk_cache::BackendImpl* cache_impl_;
79 disk_cache::MemBackendImpl* mem_cache_; 91 disk_cache::MemBackendImpl* mem_cache_;
80 92
81 uint32 mask_; 93 uint32 mask_;
82 int size_; 94 int size_;
83 bool memory_only_; 95 bool memory_only_;
84 bool implementation_; 96 bool implementation_;
85 bool force_creation_; 97 bool force_creation_;
86 bool new_eviction_; 98 bool new_eviction_;
87 bool first_cleanup_; 99 bool first_cleanup_;
88 bool integrity_; 100 bool integrity_;
89 // This is intentionally left uninitialized, to be used by any test. 101 // This is intentionally left uninitialized, to be used by any test.
90 bool success_; 102 bool success_;
91 103
92 private: 104 private:
93 void InitMemoryCache(); 105 void InitMemoryCache();
94 void InitDiskCache(); 106 void InitDiskCache();
95 void InitDiskCacheImpl(const FilePath& path); 107 void InitDiskCacheImpl(const FilePath& path);
96 }; 108 };
97 109
98 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ 110 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_
OLDNEW
« no previous file with comments | « net/disk_cache/backend_unittest.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