summaryrefslogtreecommitdiffstats
path: root/net/base/run_all_unittests.cc
diff options
context:
space:
mode:
authordarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-24 06:31:34 +0000
committerdarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-24 06:31:34 +0000
commit025517044b4be3ab45efc2f383e5a7b830aa7281 (patch)
treeb43566625f0702e8fa44590a7a82b3c41b56b5cc /net/base/run_all_unittests.cc
parent8943d1c09b155984790847a849e816ffe695a91a (diff)
downloadchromium_src-025517044b4be3ab45efc2f383e5a7b830aa7281.zip
chromium_src-025517044b4be3ab45efc2f383e5a7b830aa7281.tar.gz
chromium_src-025517044b4be3ab45efc2f383e5a7b830aa7281.tar.bz2
Add support for mock DNS queries. This allows us to eliminate
flaky DNS queries from the unit tests. Note: some unit tests still connect to www.google.com. My plan is to resolve those in a subsequent CL. R=wtc BUG=2635 Review URL: http://codereview.chromium.org/4022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/run_all_unittests.cc')
-rw-r--r--net/base/run_all_unittests.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/base/run_all_unittests.cc b/net/base/run_all_unittests.cc
index f5c1419b..de79e68 100644
--- a/net/base/run_all_unittests.cc
+++ b/net/base/run_all_unittests.cc
@@ -29,10 +29,15 @@
#include "base/message_loop.h"
#include "base/test_suite.h"
+#include "net/base/host_resolver_unittest.h"
class NetTestSuite : public TestSuite {
public:
NetTestSuite(int argc, char** argv) : TestSuite(argc, argv) {
+ // In case any attempts are made to resolve host names, force them all to
+ // be mapped to localhost. This prevents DNS queries from being sent in
+ // the process of running these unit tests.
+ host_mapper_.AddRule("*", "127.0.0.1");
}
virtual void Initialize() {
@@ -51,6 +56,7 @@ class NetTestSuite : public TestSuite {
private:
scoped_ptr<MessageLoop> message_loop_;
+ net::ScopedHostMapper host_mapper_;
};
int main(int argc, char** argv) {