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

Unified Diff: net/base/mock_host_resolver.h

Issue 11885009: Improve performance of proxy resolver by tracing DNS dependencies. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: re-upload due to failure last time Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/capturing_net_log.cc ('k') | net/base/mock_host_resolver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/mock_host_resolver.h
diff --git a/net/base/mock_host_resolver.h b/net/base/mock_host_resolver.h
index 5542a64cf9da942cce34bfb39936a5f7edd40985..ee6f1b5df165b7b381c82c942b1ecc4b77bcc5d4 100644
--- a/net/base/mock_host_resolver.h
+++ b/net/base/mock_host_resolver.h
@@ -94,6 +94,16 @@ class MockHostResolverBase : public HostResolver,
// ResolveAllPending().
bool has_pending_requests() const { return !requests_.empty(); }
+ // The number of times that Resolve() has been called.
+ size_t num_resolve() const {
+ return num_resolve_;
+ }
+
+ // The number of times that ResolveFromCache() has been called.
+ size_t num_resolve_from_cache() const {
+ return num_resolve_from_cache_;
+ }
+
protected:
explicit MockHostResolverBase(bool use_caching);
@@ -117,6 +127,9 @@ class MockHostResolverBase : public HostResolver,
RequestMap requests_;
size_t next_request_id_;
+ size_t num_resolve_;
+ size_t num_resolve_from_cache_;
+
DISALLOW_COPY_AND_ASSIGN(MockHostResolverBase);
};
@@ -158,8 +171,10 @@ class RuleBasedHostResolverProc : public HostResolverProc {
// Same as AddRule(), but the replacement is expected to be an IPv4 or IPv6
// literal. This can be used in place of AddRule() to bypass the system's
// host resolver (the address list will be constructed manually).
- // If |canonical-name| is non-empty, it is copied to the resulting AddressList
+ // If |canonical_name| is non-empty, it is copied to the resulting AddressList
// but does not impact DNS resolution.
+ // |ip_literal| can be a single IP address like "192.168.1.1" or a comma
+ // separated list of IP addresses, like "::1,192:168.1.2".
void AddIPLiteralRule(const std::string& host_pattern,
const std::string& ip_literal,
const std::string& canonical_name);
@@ -175,6 +190,9 @@ class RuleBasedHostResolverProc : public HostResolverProc {
// Simulate a lookup failure for |host| (it also can be a pattern).
void AddSimulatedFailure(const std::string& host);
+ // Deletes all the rules that have been added.
+ void ClearRules();
+
// HostResolverProc methods:
virtual int Resolve(const std::string& host,
AddressFamily address_family,
« no previous file with comments | « net/base/capturing_net_log.cc ('k') | net/base/mock_host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698