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 "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 585 OVERRIDE {} | 585 OVERRIDE {} |
| 586 virtual int GetCertCount() OVERRIDE { return 0; } | 586 virtual int GetCertCount() OVERRIDE { return 0; } |
| 587 virtual void SetForceKeepSessionState() OVERRIDE {} | 587 virtual void SetForceKeepSessionState() OVERRIDE {} |
| 588 }; | 588 }; |
| 589 | 589 |
| 590 class SSLClientSocketTest : public PlatformTest { | 590 class SSLClientSocketTest : public PlatformTest { |
| 591 public: | 591 public: |
| 592 SSLClientSocketTest() | 592 SSLClientSocketTest() |
| 593 : socket_factory_(ClientSocketFactory::GetDefaultFactory()), | 593 : socket_factory_(ClientSocketFactory::GetDefaultFactory()), |
| 594 cert_verifier_(new MockCertVerifier), | 594 cert_verifier_(new MockCertVerifier), |
| 595 transport_security_state_(new TransportSecurityState) { | 595 transport_security_state_(new TransportSecurityState), |
| 596 ran_completion_callback_(false) { | |
| 596 cert_verifier_->set_default_result(OK); | 597 cert_verifier_->set_default_result(OK); |
| 597 context_.cert_verifier = cert_verifier_.get(); | 598 context_.cert_verifier = cert_verifier_.get(); |
| 598 context_.transport_security_state = transport_security_state_.get(); | 599 context_.transport_security_state = transport_security_state_.get(); |
| 599 } | 600 } |
| 600 | 601 |
| 602 void RecordCompletionCallbackRun() { ran_completion_callback_ = true; } | |
|
wtc
2014/07/30 21:56:57
In ssl_client_socket_openssl_unittest.cc, this met
| |
| 603 | |
| 601 protected: | 604 protected: |
| 602 // Sets up a TCP connection to a HTTPS server. To actually do the SSL | 605 // Sets up a TCP connection to a HTTPS server. To actually do the SSL |
| 603 // handshake, follow up with call to CreateAndConnectSSLClientSocket() below. | 606 // handshake, follow up with call to CreateAndConnectSSLClientSocket() below. |
| 604 bool ConnectToTestServer(SpawnedTestServer::SSLOptions& ssl_options) { | 607 bool ConnectToTestServer(SpawnedTestServer::SSLOptions& ssl_options) { |
| 605 test_server_.reset(new SpawnedTestServer( | 608 test_server_.reset(new SpawnedTestServer( |
| 606 SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath())); | 609 SpawnedTestServer::TYPE_HTTPS, ssl_options, base::FilePath())); |
| 607 if (!test_server_->Start()) { | 610 if (!test_server_->Start()) { |
| 608 LOG(ERROR) << "Could not start SpawnedTestServer"; | 611 LOG(ERROR) << "Could not start SpawnedTestServer"; |
| 609 return false; | 612 return false; |
| 610 } | 613 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 653 *result = callback_.GetResult(sock_->Connect(callback_.callback())); | 656 *result = callback_.GetResult(sock_->Connect(callback_.callback())); |
| 654 return true; | 657 return true; |
| 655 } | 658 } |
| 656 | 659 |
| 657 ClientSocketFactory* socket_factory_; | 660 ClientSocketFactory* socket_factory_; |
| 658 scoped_ptr<MockCertVerifier> cert_verifier_; | 661 scoped_ptr<MockCertVerifier> cert_verifier_; |
| 659 scoped_ptr<TransportSecurityState> transport_security_state_; | 662 scoped_ptr<TransportSecurityState> transport_security_state_; |
| 660 SSLClientSocketContext context_; | 663 SSLClientSocketContext context_; |
| 661 scoped_ptr<SSLClientSocket> sock_; | 664 scoped_ptr<SSLClientSocket> sock_; |
| 662 CapturingNetLog log_; | 665 CapturingNetLog log_; |
| 666 bool ran_completion_callback_; | |
|
wtc
2014/07/30 21:56:58
Same here: this member should be renamed "ran_hand
| |
| 663 | 667 |
| 664 private: | 668 private: |
| 665 scoped_ptr<StreamSocket> transport_; | 669 scoped_ptr<StreamSocket> transport_; |
| 666 scoped_ptr<SpawnedTestServer> test_server_; | 670 scoped_ptr<SpawnedTestServer> test_server_; |
| 667 TestCompletionCallback callback_; | 671 TestCompletionCallback callback_; |
| 668 AddressList addr_; | 672 AddressList addr_; |
| 669 }; | 673 }; |
| 670 | 674 |
| 671 // Verifies the correctness of GetSSLCertRequestInfo. | 675 // Verifies the correctness of GetSSLCertRequestInfo. |
| 672 class SSLClientSocketCertRequestInfoTest : public SSLClientSocketTest { | 676 class SSLClientSocketCertRequestInfoTest : public SSLClientSocketTest { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 935 CapturingNetLog log; | 939 CapturingNetLog log; |
| 936 scoped_ptr<StreamSocket> transport( | 940 scoped_ptr<StreamSocket> transport( |
| 937 new TCPClientSocket(addr, &log, NetLog::Source())); | 941 new TCPClientSocket(addr, &log, NetLog::Source())); |
| 938 int rv = transport->Connect(callback.callback()); | 942 int rv = transport->Connect(callback.callback()); |
| 939 if (rv == ERR_IO_PENDING) | 943 if (rv == ERR_IO_PENDING) |
| 940 rv = callback.WaitForResult(); | 944 rv = callback.WaitForResult(); |
| 941 EXPECT_EQ(OK, rv); | 945 EXPECT_EQ(OK, rv); |
| 942 | 946 |
| 943 scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( | 947 scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( |
| 944 transport.Pass(), test_server.host_port_pair(), kDefaultSSLConfig)); | 948 transport.Pass(), test_server.host_port_pair(), kDefaultSSLConfig)); |
| 945 | 949 |
|
wtc
2014/07/30 21:56:58
Why don't you call sock->SetHandshakeCompletionCal
| |
| 946 EXPECT_FALSE(sock->IsConnected()); | |
|
wtc
2014/07/30 21:56:57
Why did you delete this EXPECT_FALSE?
| |
| 947 | |
| 948 rv = sock->Connect(callback.callback()); | 950 rv = sock->Connect(callback.callback()); |
| 949 | 951 |
| 950 CapturingNetLog::CapturedEntryList entries; | 952 CapturingNetLog::CapturedEntryList entries; |
| 951 log.GetEntries(&entries); | 953 log.GetEntries(&entries); |
| 952 EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT)); | 954 EXPECT_TRUE(LogContainsBeginEvent(entries, 5, NetLog::TYPE_SSL_CONNECT)); |
| 953 if (rv == ERR_IO_PENDING) | 955 if (rv == ERR_IO_PENDING) |
| 954 rv = callback.WaitForResult(); | 956 rv = callback.WaitForResult(); |
| 955 | 957 |
| 956 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, rv); | 958 EXPECT_EQ(ERR_CERT_COMMON_NAME_INVALID, rv); |
| 957 | 959 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1160 // Disable TLS False Start to avoid handshake non-determinism. | 1162 // Disable TLS False Start to avoid handshake non-determinism. |
| 1161 SSLConfig ssl_config; | 1163 SSLConfig ssl_config; |
| 1162 ssl_config.false_start_enabled = false; | 1164 ssl_config.false_start_enabled = false; |
| 1163 | 1165 |
| 1164 SynchronousErrorStreamSocket* raw_transport = transport.get(); | 1166 SynchronousErrorStreamSocket* raw_transport = transport.get(); |
| 1165 scoped_ptr<SSLClientSocket> sock( | 1167 scoped_ptr<SSLClientSocket> sock( |
| 1166 CreateSSLClientSocket(transport.PassAs<StreamSocket>(), | 1168 CreateSSLClientSocket(transport.PassAs<StreamSocket>(), |
| 1167 test_server.host_port_pair(), | 1169 test_server.host_port_pair(), |
| 1168 ssl_config)); | 1170 ssl_config)); |
| 1169 | 1171 |
| 1172 #if defined(USE_OPENSSL) | |
| 1173 sock->SetHandshakeCompletionCallback( | |
| 1174 base::Bind(&SSLClientSocketTest::RecordCompletionCallbackRun, | |
| 1175 base::Unretained(this))); | |
| 1176 #endif | |
| 1177 | |
| 1170 rv = callback.GetResult(sock->Connect(callback.callback())); | 1178 rv = callback.GetResult(sock->Connect(callback.callback())); |
| 1171 EXPECT_EQ(OK, rv); | 1179 EXPECT_EQ(OK, rv); |
| 1172 EXPECT_TRUE(sock->IsConnected()); | 1180 EXPECT_TRUE(sock->IsConnected()); |
| 1173 | 1181 |
| 1174 const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; | 1182 const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; |
| 1175 static const int kRequestTextSize = | 1183 static const int kRequestTextSize = |
| 1176 static_cast<int>(arraysize(request_text) - 1); | 1184 static_cast<int>(arraysize(request_text) - 1); |
| 1177 scoped_refptr<IOBuffer> request_buffer(new IOBuffer(kRequestTextSize)); | 1185 scoped_refptr<IOBuffer> request_buffer(new IOBuffer(kRequestTextSize)); |
| 1178 memcpy(request_buffer->data(), request_text, kRequestTextSize); | 1186 memcpy(request_buffer->data(), request_text, kRequestTextSize); |
| 1179 | 1187 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1190 // rv != ERR_IO_PENDING is insufficient, as ERR_IO_PENDING is a legitimate | 1198 // rv != ERR_IO_PENDING is insufficient, as ERR_IO_PENDING is a legitimate |
| 1191 // result when using a dedicated task runner for NSS. | 1199 // result when using a dedicated task runner for NSS. |
| 1192 rv = callback.GetResult(sock->Read(buf.get(), 4096, callback.callback())); | 1200 rv = callback.GetResult(sock->Read(buf.get(), 4096, callback.callback())); |
| 1193 | 1201 |
| 1194 #if !defined(USE_OPENSSL) | 1202 #if !defined(USE_OPENSSL) |
| 1195 // SSLClientSocketNSS records the error exactly | 1203 // SSLClientSocketNSS records the error exactly |
| 1196 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 1204 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
| 1197 #else | 1205 #else |
| 1198 // SSLClientSocketOpenSSL treats any errors as a simple EOF. | 1206 // SSLClientSocketOpenSSL treats any errors as a simple EOF. |
| 1199 EXPECT_EQ(0, rv); | 1207 EXPECT_EQ(0, rv); |
| 1208 EXPECT_TRUE(ran_completion_callback_); | |
| 1200 #endif | 1209 #endif |
| 1201 } | 1210 } |
| 1202 | 1211 |
| 1203 // Tests that the SSLClientSocket properly handles when the underlying transport | 1212 // Tests that the SSLClientSocket properly handles when the underlying transport |
| 1204 // asynchronously returns an error code while writing data - such as if an | 1213 // asynchronously returns an error code while writing data - such as if an |
| 1205 // intermediary terminates the socket connection uncleanly. | 1214 // intermediary terminates the socket connection uncleanly. |
| 1206 // This is a regression test for http://crbug.com/249848 | 1215 // This is a regression test for http://crbug.com/249848 |
| 1207 TEST_F(SSLClientSocketTest, Write_WithSynchronousError) { | 1216 TEST_F(SSLClientSocketTest, Write_WithSynchronousError) { |
| 1208 SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTPS, | 1217 SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTPS, |
| 1209 SpawnedTestServer::kLocalhost, | 1218 SpawnedTestServer::kLocalhost, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1229 | 1238 |
| 1230 // Disable TLS False Start to avoid handshake non-determinism. | 1239 // Disable TLS False Start to avoid handshake non-determinism. |
| 1231 SSLConfig ssl_config; | 1240 SSLConfig ssl_config; |
| 1232 ssl_config.false_start_enabled = false; | 1241 ssl_config.false_start_enabled = false; |
| 1233 | 1242 |
| 1234 scoped_ptr<SSLClientSocket> sock( | 1243 scoped_ptr<SSLClientSocket> sock( |
| 1235 CreateSSLClientSocket(transport.PassAs<StreamSocket>(), | 1244 CreateSSLClientSocket(transport.PassAs<StreamSocket>(), |
| 1236 test_server.host_port_pair(), | 1245 test_server.host_port_pair(), |
| 1237 ssl_config)); | 1246 ssl_config)); |
| 1238 | 1247 |
| 1248 #if defined(USE_OPENSSL) | |
| 1249 sock->SetHandshakeCompletionCallback( | |
| 1250 base::Bind(&SSLClientSocketTest::RecordCompletionCallbackRun, | |
| 1251 base::Unretained(this))); | |
| 1252 #endif | |
| 1253 | |
| 1239 rv = callback.GetResult(sock->Connect(callback.callback())); | 1254 rv = callback.GetResult(sock->Connect(callback.callback())); |
| 1240 EXPECT_EQ(OK, rv); | 1255 EXPECT_EQ(OK, rv); |
| 1241 EXPECT_TRUE(sock->IsConnected()); | 1256 EXPECT_TRUE(sock->IsConnected()); |
| 1242 | 1257 |
| 1243 const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; | 1258 const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; |
| 1244 static const int kRequestTextSize = | 1259 static const int kRequestTextSize = |
| 1245 static_cast<int>(arraysize(request_text) - 1); | 1260 static_cast<int>(arraysize(request_text) - 1); |
| 1246 scoped_refptr<IOBuffer> request_buffer(new IOBuffer(kRequestTextSize)); | 1261 scoped_refptr<IOBuffer> request_buffer(new IOBuffer(kRequestTextSize)); |
| 1247 memcpy(request_buffer->data(), request_text, kRequestTextSize); | 1262 memcpy(request_buffer->data(), request_text, kRequestTextSize); |
| 1248 | 1263 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1271 // checking that rv != ERR_IO_PENDING is insufficient, as ERR_IO_PENDING | 1286 // checking that rv != ERR_IO_PENDING is insufficient, as ERR_IO_PENDING |
| 1272 // is a legitimate result when using a dedicated task runner for NSS. | 1287 // is a legitimate result when using a dedicated task runner for NSS. |
| 1273 rv = callback.GetResult(rv); | 1288 rv = callback.GetResult(rv); |
| 1274 | 1289 |
| 1275 #if !defined(USE_OPENSSL) | 1290 #if !defined(USE_OPENSSL) |
| 1276 // SSLClientSocketNSS records the error exactly | 1291 // SSLClientSocketNSS records the error exactly |
| 1277 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 1292 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
| 1278 #else | 1293 #else |
| 1279 // SSLClientSocketOpenSSL treats any errors as a simple EOF. | 1294 // SSLClientSocketOpenSSL treats any errors as a simple EOF. |
| 1280 EXPECT_EQ(0, rv); | 1295 EXPECT_EQ(0, rv); |
| 1296 EXPECT_TRUE(ran_completion_callback_); | |
| 1281 #endif | 1297 #endif |
| 1282 } | 1298 } |
| 1283 | 1299 |
| 1284 // Test the full duplex mode, with Read and Write pending at the same time. | 1300 // Test the full duplex mode, with Read and Write pending at the same time. |
| 1285 // This test also serves as a regression test for http://crbug.com/29815. | 1301 // This test also serves as a regression test for http://crbug.com/29815. |
| 1286 TEST_F(SSLClientSocketTest, Read_FullDuplex) { | 1302 TEST_F(SSLClientSocketTest, Read_FullDuplex) { |
| 1287 SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTPS, | 1303 SpawnedTestServer test_server(SpawnedTestServer::TYPE_HTTPS, |
| 1288 SpawnedTestServer::kLocalhost, | 1304 SpawnedTestServer::kLocalhost, |
| 1289 base::FilePath()); | 1305 base::FilePath()); |
| 1290 ASSERT_TRUE(test_server.Start()); | 1306 ASSERT_TRUE(test_server.Start()); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1495 | 1511 |
| 1496 // Disable TLS False Start to avoid handshake non-determinism. | 1512 // Disable TLS False Start to avoid handshake non-determinism. |
| 1497 SSLConfig ssl_config; | 1513 SSLConfig ssl_config; |
| 1498 ssl_config.false_start_enabled = false; | 1514 ssl_config.false_start_enabled = false; |
| 1499 | 1515 |
| 1500 scoped_ptr<SSLClientSocket> sock( | 1516 scoped_ptr<SSLClientSocket> sock( |
| 1501 CreateSSLClientSocket(transport.PassAs<StreamSocket>(), | 1517 CreateSSLClientSocket(transport.PassAs<StreamSocket>(), |
| 1502 test_server.host_port_pair(), | 1518 test_server.host_port_pair(), |
| 1503 ssl_config)); | 1519 ssl_config)); |
| 1504 | 1520 |
| 1521 #if defined(USE_OPENSSL) | |
| 1522 sock->SetHandshakeCompletionCallback( | |
| 1523 base::Bind(&SSLClientSocketTest::RecordCompletionCallbackRun, | |
| 1524 base::Unretained(this))); | |
| 1525 #endif | |
| 1526 | |
| 1505 rv = callback.GetResult(sock->Connect(callback.callback())); | 1527 rv = callback.GetResult(sock->Connect(callback.callback())); |
| 1506 EXPECT_EQ(OK, rv); | 1528 EXPECT_EQ(OK, rv); |
| 1507 EXPECT_TRUE(sock->IsConnected()); | 1529 EXPECT_TRUE(sock->IsConnected()); |
| 1508 | 1530 |
| 1509 // Send a request so there is something to read from the socket. | 1531 // Send a request so there is something to read from the socket. |
| 1510 const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; | 1532 const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; |
| 1511 static const int kRequestTextSize = | 1533 static const int kRequestTextSize = |
| 1512 static_cast<int>(arraysize(request_text) - 1); | 1534 static_cast<int>(arraysize(request_text) - 1); |
| 1513 scoped_refptr<IOBuffer> request_buffer(new IOBuffer(kRequestTextSize)); | 1535 scoped_refptr<IOBuffer> request_buffer(new IOBuffer(kRequestTextSize)); |
| 1514 memcpy(request_buffer->data(), request_text, kRequestTextSize); | 1536 memcpy(request_buffer->data(), request_text, kRequestTextSize); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1553 ASSERT_LT(0, long_request_buffer->BytesRemaining()); | 1575 ASSERT_LT(0, long_request_buffer->BytesRemaining()); |
| 1554 } | 1576 } |
| 1555 } while (rv > 0); | 1577 } while (rv > 0); |
| 1556 | 1578 |
| 1557 #if !defined(USE_OPENSSL) | 1579 #if !defined(USE_OPENSSL) |
| 1558 // NSS records the error exactly. | 1580 // NSS records the error exactly. |
| 1559 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 1581 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
| 1560 #else | 1582 #else |
| 1561 // OpenSSL treats the reset as a generic protocol error. | 1583 // OpenSSL treats the reset as a generic protocol error. |
| 1562 EXPECT_EQ(ERR_SSL_PROTOCOL_ERROR, rv); | 1584 EXPECT_EQ(ERR_SSL_PROTOCOL_ERROR, rv); |
| 1585 EXPECT_TRUE(ran_completion_callback_); | |
| 1563 #endif | 1586 #endif |
| 1564 | 1587 |
| 1565 // Release the read. Some bytes should go through. | 1588 // Release the read. Some bytes should go through. |
| 1566 raw_transport->UnblockReadResult(); | 1589 raw_transport->UnblockReadResult(); |
| 1567 rv = read_callback.WaitForResult(); | 1590 rv = read_callback.WaitForResult(); |
| 1568 | 1591 |
| 1569 // Per the fix for http://crbug.com/249848, write failures currently break | 1592 // Per the fix for http://crbug.com/249848, write failures currently break |
| 1570 // reads. Change this assertion if they're changed to not collide. | 1593 // reads. Change this assertion if they're changed to not collide. |
| 1571 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 1594 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
| 1572 } | 1595 } |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1827 scoped_ptr<StreamSocket> transport( | 1850 scoped_ptr<StreamSocket> transport( |
| 1828 new MockTCPClientSocket(addr, NULL, &data)); | 1851 new MockTCPClientSocket(addr, NULL, &data)); |
| 1829 int rv = transport->Connect(callback.callback()); | 1852 int rv = transport->Connect(callback.callback()); |
| 1830 if (rv == ERR_IO_PENDING) | 1853 if (rv == ERR_IO_PENDING) |
| 1831 rv = callback.WaitForResult(); | 1854 rv = callback.WaitForResult(); |
| 1832 EXPECT_EQ(OK, rv); | 1855 EXPECT_EQ(OK, rv); |
| 1833 | 1856 |
| 1834 scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( | 1857 scoped_ptr<SSLClientSocket> sock(CreateSSLClientSocket( |
| 1835 transport.Pass(), test_server.host_port_pair(), kDefaultSSLConfig)); | 1858 transport.Pass(), test_server.host_port_pair(), kDefaultSSLConfig)); |
| 1836 | 1859 |
| 1860 #if defined(USE_OPENSSL) | |
| 1861 sock->SetHandshakeCompletionCallback( | |
| 1862 base::Bind(&SSLClientSocketTest::RecordCompletionCallbackRun, | |
| 1863 base::Unretained(this))); | |
| 1864 #endif | |
| 1865 | |
| 1837 rv = sock->Connect(callback.callback()); | 1866 rv = sock->Connect(callback.callback()); |
| 1838 if (rv == ERR_IO_PENDING) | 1867 if (rv == ERR_IO_PENDING) |
| 1839 rv = callback.WaitForResult(); | 1868 rv = callback.WaitForResult(); |
| 1840 EXPECT_EQ(ERR_SSL_PROTOCOL_ERROR, rv); | 1869 EXPECT_EQ(ERR_SSL_PROTOCOL_ERROR, rv); |
| 1870 #if defined(USE_OPENSSL) | |
| 1871 EXPECT_TRUE(ran_completion_callback_); | |
| 1872 #endif | |
| 1841 } | 1873 } |
| 1842 | 1874 |
| 1843 TEST_F(SSLClientSocketTest, CipherSuiteDisables) { | 1875 TEST_F(SSLClientSocketTest, CipherSuiteDisables) { |
| 1844 // Rather than exhaustively disabling every RC4 ciphersuite defined at | 1876 // Rather than exhaustively disabling every RC4 ciphersuite defined at |
| 1845 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xml, | 1877 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xml, |
| 1846 // only disabling those cipher suites that the test server actually | 1878 // only disabling those cipher suites that the test server actually |
| 1847 // implements. | 1879 // implements. |
| 1848 const uint16 kCiphersToDisable[] = {0x0005, // TLS_RSA_WITH_RC4_128_SHA | 1880 const uint16 kCiphersToDisable[] = {0x0005, // TLS_RSA_WITH_RC4_128_SHA |
| 1849 }; | 1881 }; |
| 1850 | 1882 |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2519 | 2551 |
| 2520 // TODO(haavardm@opera.com): Due to differences in threading, Linux returns | 2552 // TODO(haavardm@opera.com): Due to differences in threading, Linux returns |
| 2521 // ERR_UNEXPECTED while Mac and Windows return ERR_PROTOCOL_ERROR. Accept all | 2553 // ERR_UNEXPECTED while Mac and Windows return ERR_PROTOCOL_ERROR. Accept all |
| 2522 // error codes for now. | 2554 // error codes for now. |
| 2523 // http://crbug.com/373670 | 2555 // http://crbug.com/373670 |
| 2524 EXPECT_NE(OK, rv); | 2556 EXPECT_NE(OK, rv); |
| 2525 EXPECT_FALSE(sock_->IsConnected()); | 2557 EXPECT_FALSE(sock_->IsConnected()); |
| 2526 } | 2558 } |
| 2527 | 2559 |
| 2528 } // namespace net | 2560 } // namespace net |
| OLD | NEW |