Index: net/socket/ssl_client_socket_openssl_unittest.cc |
diff --git a/net/socket/ssl_client_socket_openssl_unittest.cc b/net/socket/ssl_client_socket_openssl_unittest.cc |
index 91c9a93aa7eb3c1af8b230436d79c002dd5df4b2..5dfb9806a9942ea8d602ed0949046b681ff9dbbb 100644 |
--- a/net/socket/ssl_client_socket_openssl_unittest.cc |
+++ b/net/socket/ssl_client_socket_openssl_unittest.cc |
@@ -55,7 +55,7 @@ typedef OpenSSLClientKeyStore::ScopedEVP_PKEY ScopedEVP_PKEY; |
// BIO_free is a macro, it can't be used as a template parameter. |
void BIO_free_func(BIO* bio) { |
- BIO_free(bio); |
+ BIO_free(bio); |
} |
typedef crypto::ScopedOpenSSL<BIO, BIO_free_func> ScopedBIO; |
@@ -79,16 +79,16 @@ class FailingServerBoundCertStore : public ServerBoundCertStore { |
base::Time expiration_time, |
const std::string& private_key, |
const std::string& cert) OVERRIDE {} |
- virtual void DeleteServerBoundCert(const std::string& server_identifier, |
- const base::Closure& completion_callback) |
- OVERRIDE {} |
- virtual void DeleteAllCreatedBetween(base::Time delete_begin, |
- base::Time delete_end, |
- const base::Closure& completion_callback) |
- OVERRIDE {} |
+ virtual void DeleteServerBoundCert( |
+ const std::string& server_identifier, |
+ const base::Closure& completion_callback) OVERRIDE {} |
+ virtual void DeleteAllCreatedBetween( |
+ base::Time delete_begin, |
+ base::Time delete_end, |
+ const base::Closure& completion_callback) OVERRIDE {} |
virtual void DeleteAll(const base::Closure& completion_callback) OVERRIDE {} |
- virtual void GetAllServerBoundCerts(const GetCertListCallback& callback) |
- OVERRIDE {} |
+ virtual void GetAllServerBoundCerts( |
+ const GetCertListCallback& callback) OVERRIDE {} |
virtual int GetCertCount() OVERRIDE { return 0; } |
virtual void SetForceKeepSessionState() OVERRIDE {} |
}; |
@@ -97,27 +97,24 @@ class FailingServerBoundCertStore : public ServerBoundCertStore { |
// |filepath| is the private key file path. |
// |*pkey| is reset to the new EVP_PKEY on success, untouched otherwise. |
// Returns true on success, false on failure. |
-bool LoadPrivateKeyOpenSSL( |
- const base::FilePath& filepath, |
- OpenSSLClientKeyStore::ScopedEVP_PKEY* pkey) { |
+bool LoadPrivateKeyOpenSSL(const base::FilePath& filepath, |
+ OpenSSLClientKeyStore::ScopedEVP_PKEY* pkey) { |
std::string data; |
if (!base::ReadFileToString(filepath, &data)) { |
- LOG(ERROR) << "Could not read private key file: " |
- << filepath.value() << ": " << strerror(errno); |
+ LOG(ERROR) << "Could not read private key file: " << filepath.value() |
+ << ": " << strerror(errno); |
return false; |
} |
- ScopedBIO bio( |
- BIO_new_mem_buf( |
- const_cast<char*>(reinterpret_cast<const char*>(data.data())), |
- static_cast<int>(data.size()))); |
+ ScopedBIO bio(BIO_new_mem_buf( |
+ const_cast<char*>(reinterpret_cast<const char*>(data.data())), |
+ static_cast<int>(data.size()))); |
if (!bio.get()) { |
LOG(ERROR) << "Could not allocate BIO for buffer?"; |
return false; |
} |
EVP_PKEY* result = PEM_read_bio_PrivateKey(bio.get(), NULL, NULL, NULL); |
if (result == NULL) { |
- LOG(ERROR) << "Could not decode private key file: " |
- << filepath.value(); |
+ LOG(ERROR) << "Could not decode private key file: " << filepath.value(); |
return false; |
} |
pkey->reset(result); |
@@ -136,9 +133,7 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { |
key_store_ = net::OpenSSLClientKeyStore::GetInstance(); |
} |
- virtual ~SSLClientSocketOpenSSLClientAuthTest() { |
- key_store_->Flush(); |
- } |
+ virtual ~SSLClientSocketOpenSSLClientAuthTest() { key_store_->Flush(); } |
protected: |
void EnabledChannelID() { |
@@ -149,9 +144,8 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { |
} |
void EnabledFailingChannelID() { |
- cert_service_.reset( |
- new ServerBoundCertService(new FailingServerBoundCertStore(), |
- base::MessageLoopProxy::current())); |
+ cert_service_.reset(new ServerBoundCertService( |
+ new FailingServerBoundCertStore(), base::MessageLoopProxy::current())); |
context_.server_bound_cert_service = cert_service_.get(); |
} |
@@ -161,17 +155,14 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { |
const SSLConfig& ssl_config) { |
scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
connection->SetSocket(transport_socket.Pass()); |
- return socket_factory_->CreateSSLClientSocket(connection.Pass(), |
- host_and_port, |
- ssl_config, |
- context_); |
+ return socket_factory_->CreateSSLClientSocket( |
+ connection.Pass(), host_and_port, ssl_config, context_); |
} |
// Connect to a HTTPS test server. |
bool ConnectToTestServer(SpawnedTestServer::SSLOptions& ssl_options) { |
- test_server_.reset(new SpawnedTestServer(SpawnedTestServer::TYPE_HTTPS, |
- ssl_options, |
- base::FilePath())); |
+ test_server_.reset(new SpawnedTestServer( |
+ SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath())); |
if (!test_server_->Start()) { |
LOG(ERROR) << "Could not start SpawnedTestServer"; |
return false; |
@@ -182,10 +173,8 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { |
return false; |
} |
- transport_.reset(new TCPClientSocket( |
- addr_, &log_, NetLog::Source())); |
- int rv = callback_.GetResult( |
- transport_->Connect(callback_.callback())); |
+ transport_.reset(new TCPClientSocket(addr_, &log_, NetLog::Source())); |
+ int rv = callback_.GetResult(transport_->Connect(callback_.callback())); |
if (rv != OK) { |
LOG(ERROR) << "Could not connect to SpawnedTestServer"; |
return false; |
@@ -198,10 +187,9 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { |
// |ssl_config| provides a client certificate. |
// |private_key| must be an EVP_PKEY for the corresponding private key. |
// Returns true on success, false on failure. |
- bool RecordPrivateKey(SSLConfig& ssl_config, |
- EVP_PKEY* private_key) { |
- return key_store_->RecordClientCertPrivateKey( |
- ssl_config.client_cert.get(), private_key); |
+ bool RecordPrivateKey(SSLConfig& ssl_config, EVP_PKEY* private_key) { |
+ return key_store_->RecordClientCertPrivateKey(ssl_config.client_cert.get(), |
+ private_key); |
} |
// Create an SSLClientSocket object and use it to connect to a test |
@@ -212,11 +200,9 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { |
// Returns true on succes, false otherwise. Success means that the socket |
// could be created and its Connect() was called, not that the connection |
// itself was a success. |
- bool CreateAndConnectSSLClientSocket(SSLConfig& ssl_config, |
- int* result) { |
- sock_ = CreateSSLClientSocket(transport_.Pass(), |
- test_server_->host_port_pair(), |
- ssl_config); |
+ bool CreateAndConnectSSLClientSocket(SSLConfig& ssl_config, int* result) { |
+ sock_ = CreateSSLClientSocket( |
+ transport_.Pass(), test_server_->host_port_pair(), ssl_config); |
if (sock_->IsConnected()) { |
LOG(ERROR) << "SSL Socket prematurely connected"; |
@@ -227,7 +213,6 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest { |
return true; |
} |
- |
// Check that the client certificate was sent. |
// Returns true on success. |
bool CheckSSLClientSocketSentCert() { |