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

Unified Diff: net/base/host_resolver.h

Issue 18775: Add more unit tests for net/base/host_resolver. (Closed)
Patch Set: add fixes, and actually use previous mapper Created 11 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 | « no previous file | net/base/host_resolver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_resolver.h
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h
index 1f649f84755d09869cbfba35df08c2249d0ecf0e..bfae53cfbfb61306ef9eca7954a7a4130627c4e2 100644
--- a/net/base/host_resolver.h
+++ b/net/base/host_resolver.h
@@ -57,10 +57,24 @@ class HostResolver {
// A helper class used in unit tests to alter hostname mappings. See
// SetHostMapper for details.
-class HostMapper {
+class HostMapper : public base::RefCountedThreadSafe<HostMapper> {
public:
virtual ~HostMapper() {}
virtual std::string Map(const std::string& host) = 0;
+
+ protected:
+ // Ask previous host mapper (if set) for mapping of given host.
+ std::string MapUsingPrevious(const std::string& host);
+
+ private:
+ friend class ScopedHostMapper;
+
+ // Set mapper to ask when this mapper doesn't want to modify the result.
+ void set_previous_mapper(HostMapper* mapper) {
+ previous_mapper_ = mapper;
+ }
+
+ scoped_refptr<HostMapper> previous_mapper_;
};
#ifdef UNIT_TEST
« no previous file with comments | « no previous file | net/base/host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698