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

Unified Diff: net/socket/ssl_client_socket_unittest.cc

Issue 416683002: This CL corrects a bug in which the OnHandshakeComplete callback for an ssl session was never called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@r2
Patch Set: Removed session to callback map from SSLSessionCallback, added unittest Created 6 years, 4 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_unittest.cc
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index cdb268521157f866d6cdf8fc2c3a5583809bb5d5..28083fcf8c0dcbbcd180315597ed4c0dc3f8948e 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -2731,6 +2731,45 @@ TEST_F(SSLClientSocketTest, HandshakeCallbackIsRun_WithSuccess) {
EXPECT_TRUE(ran_handshake_completion_callback_);
}
+// Tests that the completion callback is run with connections
+// that do not cache their session.
+TEST_F(SSLClientSocketTest, HandshakeCallbackIsRun_WithNoneSessionCache) {
+ SpawnedTestServer::SSLOptions ssl_options;
+ ssl_options.none_session_cache = true;
+ SpawnedTestServer test_server(
+ SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath());
+ ASSERT_TRUE(test_server.Start());
+
+ AddressList addr;
+ ASSERT_TRUE(test_server.GetAddressList(&addr));
+
+ scoped_ptr<StreamSocket> transport(
+ new TCPClientSocket(addr, NULL, NetLog::Source()));
+
+ TestCompletionCallback callback;
+ int rv = transport->Connect(callback.callback());
+ if (rv == ERR_IO_PENDING)
+ rv = callback.WaitForResult();
+ EXPECT_EQ(OK, rv);
+
+ SSLConfig ssl_config = kDefaultSSLConfig;
+ ssl_config.false_start_enabled = false;
+
+ scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket(
+ transport.Pass(), test_server.host_port_pair(), ssl_config));
+
+ sock->SetHandshakeCompletionCallback(base::Bind(
+ &SSLClientSocketTest::RecordCompletedHandshake, base::Unretained(this)));
+
+ if (sock->IsConnected())
+ LOG(ERROR) << "SSL Socket prematurely connected";
+
+ rv = callback.GetResult(sock->Connect(callback.callback()));
+
+ EXPECT_EQ(OK, rv);
+ EXPECT_TRUE(sock->IsConnected());
+ EXPECT_TRUE(ran_handshake_completion_callback_);
+}
#endif // defined(USE_OPENSSL)
TEST_F(SSLClientSocketFalseStartTest, FalseStartEnabled) {

Powered by Google App Engine
This is Rietveld 408576698