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

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: Updated tests for client sockets to confirm use of completion callback and switched messenger to us… 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 00cf9f35cb4b612841207513f112780a405880df..1f8c7df8a564d575b3993b3f7712cdbc8ce0ed57 100644
--- a/net/socket/ssl_client_socket_openssl_unittest.cc
+++ b/net/socket/ssl_client_socket_openssl_unittest.cc
@@ -98,7 +98,8 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
SSLClientSocketOpenSSLClientAuthTest()
: socket_factory_(net::ClientSocketFactory::GetDefaultFactory()),
cert_verifier_(new net::MockCertVerifier),
- transport_security_state_(new net::TransportSecurityState) {
+ transport_security_state_(new net::TransportSecurityState),
+ ran_completion_callback_(false) {
cert_verifier_->set_default_result(net::OK);
context_.cert_verifier = cert_verifier_.get();
context_.transport_security_state = transport_security_state_.get();
@@ -109,6 +110,8 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
key_store_->Flush();
}
+ void RecordCompletedHandshake() { ran_completion_callback_ = true; }
+
protected:
scoped_ptr<SSLClientSocket> CreateSSLClientSocket(
scoped_ptr<StreamSocket> transport_socket,
@@ -173,6 +176,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;
@@ -202,6 +209,7 @@ class SSLClientSocketOpenSSLClientAuthTest : public PlatformTest {
CapturingNetLog log_;
scoped_ptr<StreamSocket> transport_;
scoped_ptr<SSLClientSocket> sock_;
+ bool ran_completion_callback_;
wtc 2014/07/30 21:56:57 Because of the "TestCompletionCallback callback_"
mshelley 2014/07/31 00:51:21 Done.
};
// Connect to a server requesting client authentication, do not send
@@ -220,6 +228,7 @@ TEST_F(SSLClientSocketOpenSSLClientAuthTest, NoCert) {
EXPECT_EQ(ERR_SSL_CLIENT_AUTH_CERT_NEEDED, rv);
EXPECT_FALSE(sock_->IsConnected());
+ EXPECT_TRUE(ran_completion_callback_);
}
// Connect to a server requesting client authentication, and send it

Powered by Google App Engine
This is Rietveld 408576698