Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3171 // Start a handshake up to the server Finished message. | 3171 // Start a handshake up to the server Finished message. |
| 3172 TestCompletionCallback callback; | 3172 TestCompletionCallback callback; |
| 3173 FakeBlockingStreamSocket* raw_transport1; | 3173 FakeBlockingStreamSocket* raw_transport1; |
| 3174 scoped_ptr<SSLClientSocket> sock1; | 3174 scoped_ptr<SSLClientSocket> sock1; |
| 3175 ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived( | 3175 ASSERT_NO_FATAL_FAILURE(CreateAndConnectUntilServerFinishedReceived( |
| 3176 client_config, &callback, &raw_transport1, &sock1)); | 3176 client_config, &callback, &raw_transport1, &sock1)); |
| 3177 // Although raw_transport1 has the server Finished blocked, the handshake | 3177 // Although raw_transport1 has the server Finished blocked, the handshake |
| 3178 // still completes. | 3178 // still completes. |
| 3179 EXPECT_EQ(OK, callback.WaitForResult()); | 3179 EXPECT_EQ(OK, callback.WaitForResult()); |
| 3180 | 3180 |
| 3181 // Leave the server Finished blocked, but wait for it to arrive. This ensures | |
| 3182 // the server has completed the handshake and added the session to its session | |
| 3183 // cache. | |
|
Ryan Sleevi
2015/03/09 21:56:12
Suggested reword:
// Continue to block the client
davidben
2015/03/09 22:01:13
Done.
| |
| 3184 scoped_refptr<IOBuffer> buf(new IOBuffer(4096)); | |
| 3185 int rv = sock1->Read(buf.get(), 4096, callback.callback()); | |
| 3186 EXPECT_EQ(ERR_IO_PENDING, rv); | |
| 3187 raw_transport1->WaitForReadResult(); | |
| 3188 | |
| 3181 // Drop the old socket. This is needed because the Python test server can't | 3189 // Drop the old socket. This is needed because the Python test server can't |
| 3182 // service two sockets in parallel. | 3190 // service two sockets in parallel. |
| 3183 sock1.reset(); | 3191 sock1.reset(); |
| 3184 | 3192 |
| 3185 // Start a second connection. | 3193 // Start a second connection. |
| 3186 scoped_ptr<StreamSocket> transport2( | 3194 scoped_ptr<StreamSocket> transport2( |
| 3187 new TCPClientSocket(addr(), &log_, NetLog::Source())); | 3195 new TCPClientSocket(addr(), &log_, NetLog::Source())); |
| 3188 EXPECT_EQ(OK, callback.GetResult(transport2->Connect(callback.callback()))); | 3196 EXPECT_EQ(OK, callback.GetResult(transport2->Connect(callback.callback()))); |
| 3189 scoped_ptr<SSLClientSocket> sock2 = CreateSSLClientSocket( | 3197 scoped_ptr<SSLClientSocket> sock2 = CreateSSLClientSocket( |
| 3190 transport2.Pass(), test_server()->host_port_pair(), client_config); | 3198 transport2.Pass(), test_server()->host_port_pair(), client_config); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3252 ssl_config.channel_id_enabled = true; | 3260 ssl_config.channel_id_enabled = true; |
| 3253 | 3261 |
| 3254 int rv; | 3262 int rv; |
| 3255 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); | 3263 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); |
| 3256 | 3264 |
| 3257 EXPECT_EQ(ERR_UNEXPECTED, rv); | 3265 EXPECT_EQ(ERR_UNEXPECTED, rv); |
| 3258 EXPECT_FALSE(sock_->IsConnected()); | 3266 EXPECT_FALSE(sock_->IsConnected()); |
| 3259 } | 3267 } |
| 3260 | 3268 |
| 3261 } // namespace net | 3269 } // namespace net |
| OLD | NEW |