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

Unified Diff: net/socket/ssl_client_socket_unittest.cc

Issue 988223004: Make SSLClientSocketFalseStartTest.NoSessionResumptionBeforeFinish not a no-op. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sleevi comments, also appease windows Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2390bd59ff68a36c2a2a119b4f44aa828156381b..96435c96cc83d7cff052c84ac761f0f81f2e2717 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -3170,7 +3170,7 @@ TEST_F(SSLClientSocketFalseStartTest, NoSessionResumptionBeforeFinish) {
// Start a handshake up to the server Finished message.
TestCompletionCallback callback;
- FakeBlockingStreamSocket* raw_transport1;
+ FakeBlockingStreamSocket* raw_transport1 = NULL;
scoped_ptr<SSLClientSocket> sock1;
ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived(
client_config, &callback, &raw_transport1, &sock1));
@@ -3178,6 +3178,20 @@ TEST_F(SSLClientSocketFalseStartTest, NoSessionResumptionBeforeFinish) {
// still completes.
EXPECT_EQ(OK, callback.WaitForResult());
+ // Continue to block the client (|sock1|) from processing the Finished
+ // message, but allow it to arrive on the socket. This ensures that, from the
+ // server's point of view, it has completed the handshake and added the
+ // session to its session cache.
+ //
+ // The actual read on |sock1| will not complete until the Finished message is
+ // processed; however, pump the underlying transport so that it is read from
+ // the socket. This still has the potential to race, but is generally unlikely
+ // due to socket buffer sizes.
+ scoped_refptr<IOBuffer> buf(new IOBuffer(4096));
+ int rv = sock1->Read(buf.get(), 4096, callback.callback());
+ EXPECT_EQ(ERR_IO_PENDING, rv);
+ raw_transport1->WaitForReadResult();
+
// Drop the old socket. This is needed because the Python test server can't
// service two sockets in parallel.
sock1.reset();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698