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

Side by Side Diff: net/socket/ssl_client_socket_openssl_unittest.cc

Issue 1557553002: Global conversion of Pass()→std::move() on OS=android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « net/android/keystore_openssl.cc ('k') | net/ssl/ssl_platform_key_android.cc » ('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 "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>
9
10 #include <openssl/bio.h> 8 #include <openssl/bio.h>
11 #include <openssl/bn.h> 9 #include <openssl/bn.h>
12 #include <openssl/evp.h> 10 #include <openssl/evp.h>
13 #include <openssl/pem.h> 11 #include <openssl/pem.h>
14 #include <openssl/rsa.h> 12 #include <openssl/rsa.h>
13 #include <string.h>
14 #include <utility>
15 15
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "crypto/openssl_util.h" 20 #include "crypto/openssl_util.h"
21 #include "crypto/scoped_openssl_types.h" 21 #include "crypto/scoped_openssl_types.h"
22 #include "net/base/address_list.h" 22 #include "net/base/address_list.h"
23 #include "net/base/io_buffer.h" 23 #include "net/base/io_buffer.h"
24 #include "net/base/net_errors.h" 24 #include "net/base/net_errors.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 ~SSLClientSocketOpenSSLClientAuthTest() override { key_store_->Flush(); } 94 ~SSLClientSocketOpenSSLClientAuthTest() override { key_store_->Flush(); }
95 95
96 protected: 96 protected:
97 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( 97 scoped_ptr<SSLClientSocket> CreateSSLClientSocket(
98 scoped_ptr<StreamSocket> transport_socket, 98 scoped_ptr<StreamSocket> transport_socket,
99 const HostPortPair& host_and_port, 99 const HostPortPair& host_and_port,
100 const SSLConfig& ssl_config) { 100 const SSLConfig& ssl_config) {
101 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); 101 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle);
102 connection->SetSocket(transport_socket.Pass()); 102 connection->SetSocket(std::move(transport_socket));
103 return socket_factory_->CreateSSLClientSocket(connection.Pass(), 103 return socket_factory_->CreateSSLClientSocket(
104 host_and_port, 104 std::move(connection), host_and_port, ssl_config, context_);
105 ssl_config,
106 context_);
107 } 105 }
108 106
109 // Connect to a HTTPS test server. 107 // Connect to a HTTPS test server.
110 bool ConnectToTestServer(SpawnedTestServer::SSLOptions& ssl_options) { 108 bool ConnectToTestServer(SpawnedTestServer::SSLOptions& ssl_options) {
111 test_server_.reset(new SpawnedTestServer(SpawnedTestServer::TYPE_HTTPS, 109 test_server_.reset(new SpawnedTestServer(SpawnedTestServer::TYPE_HTTPS,
112 ssl_options, 110 ssl_options,
113 base::FilePath())); 111 base::FilePath()));
114 if (!test_server_->Start()) { 112 if (!test_server_->Start()) {
115 LOG(ERROR) << "Could not start SpawnedTestServer"; 113 LOG(ERROR) << "Could not start SpawnedTestServer";
116 return false; 114 return false;
(...skipping 29 matching lines...) Expand all
146 // Create an SSLClientSocket object and use it to connect to a test 144 // Create an SSLClientSocket object and use it to connect to a test
147 // server, then wait for connection results. This must be called after 145 // server, then wait for connection results. This must be called after
148 // a succesful ConnectToTestServer() call. 146 // a succesful ConnectToTestServer() call.
149 // |ssl_config| the SSL configuration to use. 147 // |ssl_config| the SSL configuration to use.
150 // |result| will retrieve the ::Connect() result value. 148 // |result| will retrieve the ::Connect() result value.
151 // Returns true on succes, false otherwise. Success means that the socket 149 // Returns true on succes, false otherwise. Success means that the socket
152 // could be created and its Connect() was called, not that the connection 150 // could be created and its Connect() was called, not that the connection
153 // itself was a success. 151 // itself was a success.
154 bool CreateAndConnectSSLClientSocket(const SSLConfig& ssl_config, 152 bool CreateAndConnectSSLClientSocket(const SSLConfig& ssl_config,
155 int* result) { 153 int* result) {
156 sock_ = CreateSSLClientSocket(transport_.Pass(), 154 sock_ = CreateSSLClientSocket(std::move(transport_),
157 test_server_->host_port_pair(), 155 test_server_->host_port_pair(), ssl_config);
158 ssl_config);
159 156
160 if (sock_->IsConnected()) { 157 if (sock_->IsConnected()) {
161 LOG(ERROR) << "SSL Socket prematurely connected"; 158 LOG(ERROR) << "SSL Socket prematurely connected";
162 return false; 159 return false;
163 } 160 }
164 161
165 *result = callback_.GetResult(sock_->Connect(callback_.callback())); 162 *result = callback_.GetResult(sock_->Connect(callback_.callback()));
166 return true; 163 return true;
167 } 164 }
168 165
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 258
262 EXPECT_TRUE(CheckSSLClientSocketSentCert()); 259 EXPECT_TRUE(CheckSSLClientSocketSentCert());
263 260
264 sock_->Disconnect(); 261 sock_->Disconnect();
265 EXPECT_FALSE(sock_->IsConnected()); 262 EXPECT_FALSE(sock_->IsConnected());
266 } 263 }
267 #endif // defined(USE_OPENSSL_CERTS) 264 #endif // defined(USE_OPENSSL_CERTS)
268 265
269 } // namespace 266 } // namespace
270 } // namespace net 267 } // namespace net
OLDNEW
« no previous file with comments | « net/android/keystore_openssl.cc ('k') | net/ssl/ssl_platform_key_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698