| OLD | NEW |
| 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 "net/socket/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <openssl/bio.h> | 10 #include <openssl/bio.h> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( | 156 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( |
| 157 scoped_ptr<StreamSocket> transport_socket, | 157 scoped_ptr<StreamSocket> transport_socket, |
| 158 const HostPortPair& host_and_port, | 158 const HostPortPair& host_and_port, |
| 159 const SSLConfig& ssl_config) { | 159 const SSLConfig& ssl_config) { |
| 160 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 160 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 161 connection->SetSocket(transport_socket.Pass()); | 161 connection->SetSocket(transport_socket.Pass()); |
| 162 return socket_factory_->CreateSSLClientSocket(connection.Pass(), | 162 return socket_factory_->CreateSSLClientSocket(connection.Pass(), |
| 163 host_and_port, | 163 host_and_port, |
| 164 ssl_config, | 164 ssl_config, |
| 165 NULL, |
| 165 context_); | 166 context_); |
| 166 } | 167 } |
| 167 | 168 |
| 168 // Connect to a HTTPS test server. | 169 // Connect to a HTTPS test server. |
| 169 bool ConnectToTestServer(SpawnedTestServer::SSLOptions& ssl_options) { | 170 bool ConnectToTestServer(SpawnedTestServer::SSLOptions& ssl_options) { |
| 170 test_server_.reset(new SpawnedTestServer(SpawnedTestServer::TYPE_HTTPS, | 171 test_server_.reset(new SpawnedTestServer(SpawnedTestServer::TYPE_HTTPS, |
| 171 ssl_options, | 172 ssl_options, |
| 172 base::FilePath())); | 173 base::FilePath())); |
| 173 if (!test_server_->Start()) { | 174 if (!test_server_->Start()) { |
| 174 LOG(ERROR) << "Could not start SpawnedTestServer"; | 175 LOG(ERROR) << "Could not start SpawnedTestServer"; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 357 |
| 357 int rv; | 358 int rv; |
| 358 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); | 359 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); |
| 359 | 360 |
| 360 EXPECT_EQ(ERR_UNEXPECTED, rv); | 361 EXPECT_EQ(ERR_UNEXPECTED, rv); |
| 361 EXPECT_FALSE(sock_->IsConnected()); | 362 EXPECT_FALSE(sock_->IsConnected()); |
| 362 } | 363 } |
| 363 | 364 |
| 364 } // namespace | 365 } // namespace |
| 365 } // namespace net | 366 } // namespace net |
| OLD | NEW |