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

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: Removed additional arg from GetNextProto (was added in by rebase (?)) and fixed other small bugs. 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..cf8b0adf0d033916ba86e4c5012a5502de8fa4fc 100644
--- a/net/socket/ssl_client_socket_openssl_unittest.cc
+++ b/net/socket/ssl_client_socket_openssl_unittest.cc
@@ -87,7 +87,8 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
SSLClientSocketOpenSSLClientAuthTest()
: socket_factory_(ClientSocketFactory::GetDefaultFactory()),
cert_verifier_(new MockCertVerifier),
- transport_security_state_(new TransportSecurityState) {
+ transport_security_state_(new TransportSecurityState),
+ ran_handshake_completion_callback_(false) {
wtc 2014/08/03 01:49:10 I think you should undo all changes in this file.
mshelley 2014/08/03 23:37:09 Done.
cert_verifier_->set_default_result(OK);
context_.cert_verifier = cert_verifier_.get();
context_.transport_security_state = transport_security_state_.get();
@@ -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