| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/address_list.h" | 7 #include "net/base/address_list.h" |
| 8 #include "net/base/cert_verifier.h" | 8 #include "net/base/cert_verifier.h" |
| 9 #include "net/base/host_resolver.h" | 9 #include "net/base/host_resolver.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 EXPECT_TRUE(net::LogContainsBeginEvent( | 293 EXPECT_TRUE(net::LogContainsBeginEvent( |
| 294 entries, 5, net::NetLog::TYPE_SSL_CONNECT)); | 294 entries, 5, net::NetLog::TYPE_SSL_CONNECT)); |
| 295 if (rv == net::ERR_IO_PENDING) | 295 if (rv == net::ERR_IO_PENDING) |
| 296 rv = callback.WaitForResult(); | 296 rv = callback.WaitForResult(); |
| 297 | 297 |
| 298 EXPECT_EQ(net::OK, rv); | 298 EXPECT_EQ(net::OK, rv); |
| 299 EXPECT_TRUE(sock->IsConnected()); | 299 EXPECT_TRUE(sock->IsConnected()); |
| 300 log.GetEntries(&entries); | 300 log.GetEntries(&entries); |
| 301 EXPECT_TRUE(LogContainsSSLConnectEndEvent(entries, -1)); | 301 EXPECT_TRUE(LogContainsSSLConnectEndEvent(entries, -1)); |
| 302 | 302 |
| 303 // We responded to the server's certificate request with a Certificate |
| 304 // message with no client certificate in it. ssl_info.client_cert_sent |
| 305 // should be false in this case. |
| 306 net::SSLInfo ssl_info; |
| 307 sock->GetSSLInfo(&ssl_info); |
| 308 EXPECT_FALSE(ssl_info.client_cert_sent); |
| 309 |
| 303 sock->Disconnect(); | 310 sock->Disconnect(); |
| 304 EXPECT_FALSE(sock->IsConnected()); | 311 EXPECT_FALSE(sock->IsConnected()); |
| 305 } | 312 } |
| 306 | 313 |
| 307 // TODO(wtc): Add unit tests for IsConnectedAndIdle: | 314 // TODO(wtc): Add unit tests for IsConnectedAndIdle: |
| 308 // - Server closes an SSL connection (with a close_notify alert message). | 315 // - Server closes an SSL connection (with a close_notify alert message). |
| 309 // - Server closes the underlying TCP connection directly. | 316 // - Server closes the underlying TCP connection directly. |
| 310 // - Server sends data unexpectedly. | 317 // - Server sends data unexpectedly. |
| 311 | 318 |
| 312 TEST_F(SSLClientSocketTest, Read) { | 319 TEST_F(SSLClientSocketTest, Read) { |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 socket_factory_->CreateSSLClientSocket( | 742 socket_factory_->CreateSSLClientSocket( |
| 736 socket_handle, test_server.host_port_pair(), kDefaultSSLConfig, | 743 socket_handle, test_server.host_port_pair(), kDefaultSSLConfig, |
| 737 NULL, context)); | 744 NULL, context)); |
| 738 | 745 |
| 739 EXPECT_FALSE(ssl_socket->IsConnected()); | 746 EXPECT_FALSE(ssl_socket->IsConnected()); |
| 740 rv = ssl_socket->Connect(&callback); | 747 rv = ssl_socket->Connect(&callback); |
| 741 if (rv == net::ERR_IO_PENDING) | 748 if (rv == net::ERR_IO_PENDING) |
| 742 rv = callback.WaitForResult(); | 749 rv = callback.WaitForResult(); |
| 743 EXPECT_EQ(net::OK, rv); | 750 EXPECT_EQ(net::OK, rv); |
| 744 } | 751 } |
| OLD | NEW |