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

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

Issue 1112083002: Use of base::StringPairs appropriately in Mock_Http (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | net/http/mock_http_cache.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) 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_
11 #define NET_HTTP_MOCK_HTTP_CACHE_H_ 11 #define NET_HTTP_MOCK_HTTP_CACHE_H_
12 12
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/strings/string_split.h"
14 #include "net/disk_cache/disk_cache.h" 15 #include "net/disk_cache/disk_cache.h"
15 #include "net/http/http_cache.h" 16 #include "net/http/http_cache.h"
16 #include "net/http/http_transaction_test_util.h" 17 #include "net/http/http_transaction_test_util.h"
17 18
18 namespace net { 19 namespace net {
19 20
20 //----------------------------------------------------------------------------- 21 //-----------------------------------------------------------------------------
21 // Mock disk cache (a very basic memory cache implementation). 22 // Mock disk cache (a very basic memory cache implementation).
22 23
23 class MockDiskEntry : public disk_cache::Entry, 24 class MockDiskEntry : public disk_cache::Entry,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 const CompletionCallback& callback) override; 121 const CompletionCallback& callback) override;
121 int DoomEntry(const std::string& key, 122 int DoomEntry(const std::string& key,
122 const CompletionCallback& callback) override; 123 const CompletionCallback& callback) override;
123 int DoomAllEntries(const CompletionCallback& callback) override; 124 int DoomAllEntries(const CompletionCallback& callback) override;
124 int DoomEntriesBetween(base::Time initial_time, 125 int DoomEntriesBetween(base::Time initial_time,
125 base::Time end_time, 126 base::Time end_time,
126 const CompletionCallback& callback) override; 127 const CompletionCallback& callback) override;
127 int DoomEntriesSince(base::Time initial_time, 128 int DoomEntriesSince(base::Time initial_time,
128 const CompletionCallback& callback) override; 129 const CompletionCallback& callback) override;
129 scoped_ptr<Iterator> CreateIterator() override; 130 scoped_ptr<Iterator> CreateIterator() override;
130 void GetStats( 131 void GetStats(base::StringPairs* stats) override;
131 std::vector<std::pair<std::string, std::string>>* stats) override;
132 void OnExternalCacheHit(const std::string& key) override; 132 void OnExternalCacheHit(const std::string& key) override;
133 133
134 // Returns number of times a cache entry was successfully opened. 134 // Returns number of times a cache entry was successfully opened.
135 int open_count() const { return open_count_; } 135 int open_count() const { return open_count_; }
136 136
137 // Returns number of times a cache entry was successfully created. 137 // Returns number of times a cache entry was successfully created.
138 int create_count() const { return create_count_; } 138 int create_count() const { return create_count_; }
139 139
140 // Fail any subsequent CreateEntry and OpenEntry. 140 // Fail any subsequent CreateEntry and OpenEntry.
141 void set_fail_requests() { fail_requests_ = true; } 141 void set_fail_requests() { fail_requests_ = true; }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 scoped_ptr<disk_cache::Backend>* backend_; 264 scoped_ptr<disk_cache::Backend>* backend_;
265 CompletionCallback callback_; 265 CompletionCallback callback_;
266 bool block_; 266 bool block_;
267 bool fail_; 267 bool fail_;
268 }; 268 };
269 269
270 } // namespace net 270 } // namespace net
271 271
272 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_ 272 #endif // NET_HTTP_MOCK_HTTP_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | net/http/mock_http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698