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

Unified Diff: net/socket/ssl_client_socket_openssl_unittest.cc

Issue 353713005: Implements new, more robust design for communicating between SSLConnectJobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved tests back to ssl_client_socket_unittest.cc, fixed various other issues. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
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 513188b7d2cec36abc8ff43f0a7b20d3fe33d0fc..f2b6616f35fa742d83eccce7bdbf44a286d41e53 100644
--- a/net/socket/ssl_client_socket_openssl_unittest.cc
+++ b/net/socket/ssl_client_socket_openssl_unittest.cc
@@ -85,10 +85,11 @@ bool LoadPrivateKeyOpenSSL(
class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
public:
SSLClientSocketOpenSSLClientAuthTest()
- : socket_factory_(ClientSocketFactory::GetDefaultFactory()),
- cert_verifier_(new MockCertVerifier),
- transport_security_state_(new TransportSecurityState) {
- cert_verifier_->set_default_result(OK);
+ : socket_factory_(net::ClientSocketFactory::GetDefaultFactory()),
+ cert_verifier_(new net::MockCertVerifier),
+ transport_security_state_(new net::TransportSecurityState),
wtc 2014/07/31 23:05:25 Remove the "net::" on these three lines.
mshelley 2014/08/02 23:59:15 Done.
+ ran_handshake_completion_callback_(false) {
+ cert_verifier_->set_default_result(net::OK);
wtc 2014/07/31 23:05:25 Remove "net::".
mshelley 2014/08/02 23:59:15 Done.
context_.cert_verifier = cert_verifier_.get();
context_.transport_security_state = transport_security_state_.get();
key_store_ = OpenSSLClientKeyStore::GetInstance();
@@ -98,6 +99,8 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
key_store_->Flush();
}
+ void RecordCompletedHandshake() { ran_handshake_completion_callback_ = true; }
+
protected:
scoped_ptr<SSLClientSocket> CreateSSLClientSocket(
scoped_ptr<StreamSocket> transport_socket,
@@ -162,6 +165,10 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
test_server_->host_port_pair(),
ssl_config);
+ sock_->SetHandshakeCompletionCallback(base::Bind(
+ &SSLClientSocketOpenSSLClientAuthTest::RecordCompletedHandshake,
+ base::Unretained(this)));
+
if (sock_->IsConnected()) {
LOG(ERROR) << "SSL Socket prematurely connected";
return false;
@@ -191,6 +198,7 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
CapturingNetLog log_;
scoped_ptr<StreamSocket> transport_;
scoped_ptr<SSLClientSocket> sock_;
+ bool ran_handshake_completion_callback_;
};
// Connect to a server requesting client authentication, do not send
@@ -209,6 +217,7 @@ TEST_F(SSLClientSocketOpenSSLClientAuthTest, NoCert) {
EXPECT_EQ(ERR_SSL_CLIENT_AUTH_CERT_NEEDED, rv);
EXPECT_FALSE(sock_->IsConnected());
+ EXPECT_TRUE(ran_handshake_completion_callback_);
}
// Connect to a server requesting client authentication, and send it
@@ -266,7 +275,9 @@ TEST_F(SSLClientSocketOpenSSLClientAuthTest, SendGoodCert) {
sock_->Disconnect();
EXPECT_FALSE(sock_->IsConnected());
}
+
#endif // defined(USE_OPENSSL_CERTS)
} // namespace
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698