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

Side by Side Diff: net/http/mock_http_cache.h

Issue 1304363013: Add a size estimation mechanism to StoragePartitionHttpCacheDataRemover. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed some spots again. Created 5 years, 3 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
OLDNEW
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 // This is a mock of the http cache and related testing classes. To be fair, it 5 // This is a mock of the http cache and related testing classes. To be fair, it
6 // is not really a mock http cache given that it uses the real implementation of 6 // is not really a mock http cache given that it uses the real implementation of
7 // the http cache, but it has fake implementations of all required components, 7 // the http cache, but it has fake implementations of all required components,
8 // so it is useful for unit tests at the http layer. 8 // so it is useful for unit tests at the http layer.
9 9
10 #ifndef NET_HTTP_MOCK_HTTP_CACHE_H_ 10 #ifndef NET_HTTP_MOCK_HTTP_CACHE_H_
(...skipping 16 matching lines...) Expand all
27 explicit MockDiskEntry(const std::string& key); 27 explicit MockDiskEntry(const std::string& key);
28 28
29 bool is_doomed() const { return doomed_; } 29 bool is_doomed() const { return doomed_; }
30 30
31 void Doom() override; 31 void Doom() override;
32 void Close() override; 32 void Close() override;
33 std::string GetKey() const override; 33 std::string GetKey() const override;
34 base::Time GetLastUsed() const override; 34 base::Time GetLastUsed() const override;
35 base::Time GetLastModified() const override; 35 base::Time GetLastModified() const override;
36 int32 GetDataSize(int index) const override; 36 int32 GetDataSize(int index) const override;
37 int GetEntrySize() const override;
37 int ReadData(int index, 38 int ReadData(int index,
38 int offset, 39 int offset,
39 IOBuffer* buf, 40 IOBuffer* buf,
40 int buf_len, 41 int buf_len,
41 const CompletionCallback& callback) override; 42 const CompletionCallback& callback) override;
42 int WriteData(int index, 43 int WriteData(int index,
43 int offset, 44 int offset,
44 IOBuffer* buf, 45 IOBuffer* buf,
45 int buf_len, 46 int buf_len,
46 const CompletionCallback& callback, 47 const CompletionCallback& callback,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 disk_cache::Entry** entry, 121 disk_cache::Entry** entry,
121 const CompletionCallback& callback) override; 122 const CompletionCallback& callback) override;
122 int DoomEntry(const std::string& key, 123 int DoomEntry(const std::string& key,
123 const CompletionCallback& callback) override; 124 const CompletionCallback& callback) override;
124 int DoomAllEntries(const CompletionCallback& callback) override; 125 int DoomAllEntries(const CompletionCallback& callback) override;
125 int DoomEntriesBetween(base::Time initial_time, 126 int DoomEntriesBetween(base::Time initial_time,
126 base::Time end_time, 127 base::Time end_time,
127 const CompletionCallback& callback) override; 128 const CompletionCallback& callback) override;
128 int DoomEntriesSince(base::Time initial_time, 129 int DoomEntriesSince(base::Time initial_time,
129 const CompletionCallback& callback) override; 130 const CompletionCallback& callback) override;
131 int CalculateSizeOfEntriesBetween(
132 base::Time initial_time,
133 base::Time end_time,
134 const CompletionCallback& callback) override;
130 scoped_ptr<Iterator> CreateIterator() override; 135 scoped_ptr<Iterator> CreateIterator() override;
131 void GetStats(base::StringPairs* stats) override; 136 void GetStats(base::StringPairs* stats) override;
132 void OnExternalCacheHit(const std::string& key) override; 137 void OnExternalCacheHit(const std::string& key) override;
133 138
134 // Returns number of times a cache entry was successfully opened. 139 // Returns number of times a cache entry was successfully opened.
135 int open_count() const { return open_count_; } 140 int open_count() const { return open_count_; }
136 141
137 // Returns number of times a cache entry was successfully created. 142 // Returns number of times a cache entry was successfully created.
138 int create_count() const { return create_count_; } 143 int create_count() const { return create_count_; }
139 144
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 268
264 scoped_ptr<disk_cache::Backend>* backend_; 269 scoped_ptr<disk_cache::Backend>* backend_;
265 CompletionCallback callback_; 270 CompletionCallback callback_;
266 bool block_; 271 bool block_;
267 bool fail_; 272 bool fail_;
268 }; 273 };
269 274
270 } // namespace net 275 } // namespace net
271 276
272 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ 277 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698