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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 protected: 59 protected:
60 DiskCacheTestWithCache(); 60 DiskCacheTestWithCache();
61 virtual ~DiskCacheTestWithCache(); 61 virtual ~DiskCacheTestWithCache();
62 62
63 void CreateBackend(uint32 flags, base::Thread* thread); 63 void CreateBackend(uint32 flags, base::Thread* thread);
64 64
65 void InitCache(); 65 void InitCache();
66 void SimulateCrash(); 66 void SimulateCrash();
67 void SetTestMode(); 67 void SetTestMode();
68 68
69 void SetMemoryOnlyMode() { 69 void SetMemoryOnlyMode() { memory_only_ = true; }
70 memory_only_ = true;
71 }
72 70
73 void SetSimpleCacheMode() { 71 void SetSimpleCacheMode() { simple_cache_mode_ = true; }
74 simple_cache_mode_ = true;
75 }
76 72
77 void SetMask(uint32 mask) { 73 void SetMask(uint32 mask) { mask_ = mask; }
78 mask_ = mask;
79 }
80 74
81 void SetMaxSize(int size); 75 void SetMaxSize(int size);
82 76
83 // Deletes and re-creates the files on initialization errors. 77 // Deletes and re-creates the files on initialization errors.
84 void SetForceCreation() { 78 void SetForceCreation() { force_creation_ = true; }
85 force_creation_ = true;
86 }
87 79
88 void SetNewEviction() { 80 void SetNewEviction() { new_eviction_ = true; }
89 new_eviction_ = true;
90 }
91 81
92 void DisableSimpleCacheWaitForIndex() { 82 void DisableSimpleCacheWaitForIndex() {
93 simple_cache_wait_for_index_ = false; 83 simple_cache_wait_for_index_ = false;
94 } 84 }
95 85
96 void DisableFirstCleanup() { 86 void DisableFirstCleanup() { first_cleanup_ = false; }
97 first_cleanup_ = false;
98 }
99 87
100 void DisableIntegrityCheck() { 88 void DisableIntegrityCheck() { integrity_ = false; }
101 integrity_ = false;
102 }
103 89
104 void UseCurrentThread() { 90 void UseCurrentThread() { use_current_thread_ = true; }
105 use_current_thread_ = true;
106 }
107 91
108 void SetCacheType(net::CacheType type) { 92 void SetCacheType(net::CacheType type) { type_ = type; }
109 type_ = type;
110 }
111 93
112 // Utility methods to access the cache and wait for each operation to finish. 94 // Utility methods to access the cache and wait for each operation to finish.
113 int OpenEntry(const std::string& key, disk_cache::Entry** entry); 95 int OpenEntry(const std::string& key, disk_cache::Entry** entry);
114 int CreateEntry(const std::string& key, disk_cache::Entry** entry); 96 int CreateEntry(const std::string& key, disk_cache::Entry** entry);
115 int DoomEntry(const std::string& key); 97 int DoomEntry(const std::string& key);
116 int DoomAllEntries(); 98 int DoomAllEntries();
117 int DoomEntriesBetween(const base::Time initial_time, 99 int DoomEntriesBetween(const base::Time initial_time,
118 const base::Time end_time); 100 const base::Time end_time);
119 int DoomEntriesSince(const base::Time initial_time); 101 int DoomEntriesSince(const base::Time initial_time);
120 int OpenNextEntry(void** iter, disk_cache::Entry** next_entry); 102 int OpenNextEntry(void** iter, disk_cache::Entry** next_entry);
121 void FlushQueueForTest(); 103 void FlushQueueForTest();
122 void RunTaskForTest(const base::Closure& closure); 104 void RunTaskForTest(const base::Closure& closure);
123 int ReadData(disk_cache::Entry* entry, int index, int offset, 105 int ReadData(disk_cache::Entry* entry,
124 net::IOBuffer* buf, int len); 106 int index,
125 int WriteData(disk_cache::Entry* entry, int index, int offset, 107 int offset,
126 net::IOBuffer* buf, int len, bool truncate); 108 net::IOBuffer* buf,
127 int ReadSparseData(disk_cache::Entry* entry, int64 offset, net::IOBuffer* buf, 109 int len);
110 int WriteData(disk_cache::Entry* entry,
111 int index,
112 int offset,
113 net::IOBuffer* buf,
114 int len,
115 bool truncate);
116 int ReadSparseData(disk_cache::Entry* entry,
117 int64 offset,
118 net::IOBuffer* buf,
128 int len); 119 int len);
129 int WriteSparseData(disk_cache::Entry* entry, int64 offset, 120 int WriteSparseData(disk_cache::Entry* entry,
130 net::IOBuffer* buf, int len); 121 int64 offset,
122 net::IOBuffer* buf,
123 int len);
131 124
132 // Asks the cache to trim an entry. If |empty| is true, the whole cache is 125 // Asks the cache to trim an entry. If |empty| is true, the whole cache is
133 // deleted. 126 // deleted.
134 void TrimForTest(bool empty); 127 void TrimForTest(bool empty);
135 128
136 // Asks the cache to trim an entry from the deleted list. If |empty| is 129 // Asks the cache to trim an entry from the deleted list. If |empty| is
137 // true, the whole list is deleted. 130 // true, the whole list is deleted.
138 void TrimDeletedListForTest(bool empty); 131 void TrimDeletedListForTest(bool empty);
139 132
140 // Makes sure that some time passes before continuing the test. Time::Now() 133 // Makes sure that some time passes before continuing the test. Time::Now()
(...skipping 26 matching lines...) Expand all
167 160
168 private: 161 private:
169 void InitMemoryCache(); 162 void InitMemoryCache();
170 void InitDiskCache(); 163 void InitDiskCache();
171 164
172 base::Thread cache_thread_; 165 base::Thread cache_thread_;
173 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache); 166 DISALLOW_COPY_AND_ASSIGN(DiskCacheTestWithCache);
174 }; 167 };
175 168
176 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_ 169 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698