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) |
11 #include "net/ocsp/nss_ocsp.h" | 11 #include "net/ocsp/nss_ocsp.h" |
12 #endif | 12 #endif |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 class StaticReset : public ::testing::EmptyTestEventListener { | 15 class StaticReset : public ::testing::EmptyTestEventListener { |
16 virtual void OnTestStart(const ::testing::TestInfo& test_info) OVERRIDE { | 16 virtual void OnTestStart(const ::testing::TestInfo& test_info) OVERRIDE { |
17 net::HttpStreamFactory::ResetStaticSettingsToInit(); | 17 net::HttpStreamFactory::ResetStaticSettingsToInit(); |
18 } | 18 } |
19 }; | 19 }; |
20 | 20 |
21 NetTestSuite::NetTestSuite(int argc, char** argv) | 21 NetTestSuite::NetTestSuite(int argc, char** argv) |
22 : TestSuite(argc, argv) { | 22 : TestSuite(argc, argv) { |
23 } | 23 } |
24 | 24 |
| 25 NetTestSuite::NetTestSuite(int argc, char** argv, |
| 26 bool create_at_exit_manager) |
| 27 : TestSuite(argc, argv, create_at_exit_manager) { |
| 28 } |
| 29 |
25 NetTestSuite::~NetTestSuite() {} | 30 NetTestSuite::~NetTestSuite() {} |
26 | 31 |
27 void NetTestSuite::Initialize() { | 32 void NetTestSuite::Initialize() { |
28 TestSuite::Initialize(); | 33 TestSuite::Initialize(); |
29 ::testing::UnitTest::GetInstance()->listeners().Append(new StaticReset()); | 34 ::testing::UnitTest::GetInstance()->listeners().Append(new StaticReset()); |
30 InitializeTestThread(); | 35 InitializeTestThread(); |
31 } | 36 } |
32 | 37 |
33 void NetTestSuite::Shutdown() { | 38 void NetTestSuite::Shutdown() { |
34 #if defined(USE_NSS) | 39 #if defined(USE_NSS) |
(...skipping 16 matching lines...) Expand all Loading... |
51 void NetTestSuite::InitializeTestThreadNoNetworkChangeNotifier() { | 56 void NetTestSuite::InitializeTestThreadNoNetworkChangeNotifier() { |
52 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); | 57 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); |
53 scoped_host_resolver_proc_.Init(host_resolver_proc_.get()); | 58 scoped_host_resolver_proc_.Init(host_resolver_proc_.get()); |
54 // In case any attempts are made to resolve host names, force them all to | 59 // In case any attempts are made to resolve host names, force them all to |
55 // be mapped to localhost. This prevents DNS queries from being sent in | 60 // be mapped to localhost. This prevents DNS queries from being sent in |
56 // the process of running these unit tests. | 61 // the process of running these unit tests. |
57 host_resolver_proc_->AddRule("*", "127.0.0.1"); | 62 host_resolver_proc_->AddRule("*", "127.0.0.1"); |
58 | 63 |
59 message_loop_.reset(new MessageLoopForIO()); | 64 message_loop_.reset(new MessageLoopForIO()); |
60 } | 65 } |
OLD | NEW |