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 19 matching lines...) Expand all Loading... |
30 NetTestSuite::~NetTestSuite() {} | 30 NetTestSuite::~NetTestSuite() {} |
31 | 31 |
32 void NetTestSuite::Initialize() { | 32 void NetTestSuite::Initialize() { |
33 TestSuite::Initialize(); | 33 TestSuite::Initialize(); |
34 ::testing::UnitTest::GetInstance()->listeners().Append(new StaticReset()); | 34 ::testing::UnitTest::GetInstance()->listeners().Append(new StaticReset()); |
35 InitializeTestThread(); | 35 InitializeTestThread(); |
36 } | 36 } |
37 | 37 |
38 void NetTestSuite::Shutdown() { | 38 void NetTestSuite::Shutdown() { |
39 #if defined(USE_NSS) | 39 #if defined(USE_NSS) |
40 net::ShutdownOCSP(); | 40 net::ShutdownNssPkixIO(); |
41 #endif | 41 #endif |
42 | 42 |
43 // We want to destroy this here before the TestSuite continues to tear down | 43 // We want to destroy this here before the TestSuite continues to tear down |
44 // the environment. | 44 // the environment. |
45 message_loop_.reset(); | 45 message_loop_.reset(); |
46 | 46 |
47 TestSuite::Shutdown(); | 47 TestSuite::Shutdown(); |
48 } | 48 } |
49 | 49 |
50 void NetTestSuite::InitializeTestThread() { | 50 void NetTestSuite::InitializeTestThread() { |
51 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); | 51 network_change_notifier_.reset(net::NetworkChangeNotifier::CreateMock()); |
52 | 52 |
53 InitializeTestThreadNoNetworkChangeNotifier(); | 53 InitializeTestThreadNoNetworkChangeNotifier(); |
54 } | 54 } |
55 | 55 |
56 void NetTestSuite::InitializeTestThreadNoNetworkChangeNotifier() { | 56 void NetTestSuite::InitializeTestThreadNoNetworkChangeNotifier() { |
57 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); | 57 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); |
58 scoped_host_resolver_proc_.Init(host_resolver_proc_.get()); | 58 scoped_host_resolver_proc_.Init(host_resolver_proc_.get()); |
59 // 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 |
60 // 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 |
61 // the process of running these unit tests. | 61 // the process of running these unit tests. |
62 host_resolver_proc_->AddRule("*", "127.0.0.1"); | 62 host_resolver_proc_->AddRule("*", "127.0.0.1"); |
63 | 63 |
64 message_loop_.reset(new MessageLoopForIO()); | 64 message_loop_.reset(new MessageLoopForIO()); |
65 } | 65 } |
OLD | NEW |