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

Side by Side Diff: jingle/notifier/base/chrome_async_socket_unittest.cc

Issue 9476035: Make CertVerifier a pure virtual interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win shared fix Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/shell/shell_url_request_context_getter.cc ('k') | net/base/cert_database.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "jingle/notifier/base/chrome_async_socket.h" 5 #include "jingle/notifier/base/chrome_async_socket.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return net::AddressList::CreateFromIPAddress( 113 return net::AddressList::CreateFromIPAddress(
114 Uint32ToIPAddressNumber(address.ip()), address.port()); 114 Uint32ToIPAddressNumber(address.ip()), address.port());
115 } 115 }
116 116
117 class MockXmppClientSocketFactory : public ResolvingClientSocketFactory { 117 class MockXmppClientSocketFactory : public ResolvingClientSocketFactory {
118 public: 118 public:
119 MockXmppClientSocketFactory( 119 MockXmppClientSocketFactory(
120 net::ClientSocketFactory* mock_client_socket_factory, 120 net::ClientSocketFactory* mock_client_socket_factory,
121 const net::AddressList& address_list) 121 const net::AddressList& address_list)
122 : mock_client_socket_factory_(mock_client_socket_factory), 122 : mock_client_socket_factory_(mock_client_socket_factory),
123 address_list_(address_list) { 123 address_list_(address_list),
124 cert_verifier_(net::CertVerifier::CreateDefault()) {
124 } 125 }
125 126
126 // ResolvingClientSocketFactory implementation. 127 // ResolvingClientSocketFactory implementation.
127 virtual net::StreamSocket* CreateTransportClientSocket( 128 virtual net::StreamSocket* CreateTransportClientSocket(
128 const net::HostPortPair& host_and_port) { 129 const net::HostPortPair& host_and_port) {
129 return mock_client_socket_factory_->CreateTransportClientSocket( 130 return mock_client_socket_factory_->CreateTransportClientSocket(
130 address_list_, NULL, net::NetLog::Source()); 131 address_list_, NULL, net::NetLog::Source());
131 } 132 }
132 133
133 virtual net::SSLClientSocket* CreateSSLClientSocket( 134 virtual net::SSLClientSocket* CreateSSLClientSocket(
134 net::ClientSocketHandle* transport_socket, 135 net::ClientSocketHandle* transport_socket,
135 const net::HostPortPair& host_and_port) { 136 const net::HostPortPair& host_and_port) {
136 net::SSLClientSocketContext context; 137 net::SSLClientSocketContext context;
137 context.cert_verifier = &cert_verifier_; 138 context.cert_verifier = cert_verifier_.get();
138 return mock_client_socket_factory_->CreateSSLClientSocket( 139 return mock_client_socket_factory_->CreateSSLClientSocket(
139 transport_socket, host_and_port, ssl_config_, NULL, context); 140 transport_socket, host_and_port, ssl_config_, NULL, context);
140 } 141 }
141 142
142 private: 143 private:
143 scoped_ptr<net::ClientSocketFactory> mock_client_socket_factory_; 144 scoped_ptr<net::ClientSocketFactory> mock_client_socket_factory_;
144 net::AddressList address_list_; 145 net::AddressList address_list_;
145 net::SSLConfig ssl_config_; 146 net::SSLConfig ssl_config_;
146 net::CertVerifier cert_verifier_; 147 scoped_ptr<net::CertVerifier> cert_verifier_;
147 }; 148 };
148 149
149 class ChromeAsyncSocketTest 150 class ChromeAsyncSocketTest
150 : public testing::Test, 151 : public testing::Test,
151 public sigslot::has_slots<> { 152 public sigslot::has_slots<> {
152 protected: 153 protected:
153 ChromeAsyncSocketTest() 154 ChromeAsyncSocketTest()
154 : ssl_socket_data_provider_(net::ASYNC, net::OK), 155 : ssl_socket_data_provider_(net::ASYNC, net::OK),
155 addr_(0xaabbccdd, 35) {} 156 addr_(0xaabbccdd, 35) {}
156 157
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 message_loop_.RunAllPending(); 1067 message_loop_.RunAllPending();
1067 1068
1068 ExpectNoSignal(); 1069 ExpectNoSignal();
1069 1070
1070 DoSSLCloseOpenedNoError(); 1071 DoSSLCloseOpenedNoError();
1071 } 1072 }
1072 1073
1073 } // namespace 1074 } // namespace
1074 1075
1075 } // namespace notifier 1076 } // namespace notifier
OLDNEW
« no previous file with comments | « content/shell/shell_url_request_context_getter.cc ('k') | net/base/cert_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698