| OLD | NEW |
| 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 #include "net/base/net_test_suite.h" | 5 #include "net/base/net_test_suite.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "net/base/network_change_notifier.h" | 8 #include "net/base/network_change_notifier.h" |
| 9 #include "net/http/http_stream_factory.h" | 9 #include "net/http/http_stream_factory.h" |
| 10 #if defined(USE_NSS) | 10 #if defined(USE_NSS) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // We want to destroy this here before the TestSuite continues to tear down | 38 // We want to destroy this here before the TestSuite continues to tear down |
| 39 // the environment. | 39 // the environment. |
| 40 message_loop_.reset(); | 40 message_loop_.reset(); |
| 41 | 41 |
| 42 TestSuite::Shutdown(); | 42 TestSuite::Shutdown(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void NetTestSuite::InitializeTestThread() { | 45 void NetTestSuite::InitializeTestThread() { |
| 46 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); | 46 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); |
| 47 | 47 |
| 48 InitializeTestThreadNoNetworkChangeNotifier(); |
| 49 } |
| 50 |
| 51 void NetTestSuite::InitializeTestThreadNoNetworkChangeNotifier() { |
| 48 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); | 52 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); |
| 49 scoped_host_resolver_proc_.Init(host_resolver_proc_.get()); | 53 scoped_host_resolver_proc_.Init(host_resolver_proc_.get()); |
| 50 // In case any attempts are made to resolve host names, force them all to | 54 // In case any attempts are made to resolve host names, force them all to |
| 51 // be mapped to localhost. This prevents DNS queries from being sent in | 55 // be mapped to localhost. This prevents DNS queries from being sent in |
| 52 // the process of running these unit tests. | 56 // the process of running these unit tests. |
| 53 host_resolver_proc_->AddRule("*", "127.0.0.1"); | 57 host_resolver_proc_->AddRule("*", "127.0.0.1"); |
| 54 | 58 |
| 55 message_loop_.reset(new MessageLoopForIO()); | 59 message_loop_.reset(new MessageLoopForIO()); |
| 56 } | 60 } |
| OLD | NEW |