| 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 // This test suite uses SSLClientSocket to test the implementation of | 5 // This test suite uses SSLClientSocket to test the implementation of |
| 6 // SSLServerSocket. In order to establish connections between the sockets | 6 // SSLServerSocket. In order to establish connections between the sockets |
| 7 // we need two additional classes: | 7 // we need two additional classes: |
| 8 // 1. FakeSocket | 8 // 1. FakeSocket |
| 9 // Connects SSL socket to FakeDataChannel. This class is just a stub. | 9 // Connects SSL socket to FakeDataChannel. This class is just a stub. |
| 10 // | 10 // |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 server_ret = handshake_callback.GetResult(server_ret); | 542 server_ret = handshake_callback.GetResult(server_ret); |
| 543 | 543 |
| 544 ASSERT_THAT(client_ret, IsOk()); | 544 ASSERT_THAT(client_ret, IsOk()); |
| 545 ASSERT_THAT(server_ret, IsOk()); | 545 ASSERT_THAT(server_ret, IsOk()); |
| 546 | 546 |
| 547 // Make sure the cert status is expected. | 547 // Make sure the cert status is expected. |
| 548 SSLInfo ssl_info; | 548 SSLInfo ssl_info; |
| 549 ASSERT_TRUE(client_socket_->GetSSLInfo(&ssl_info)); | 549 ASSERT_TRUE(client_socket_->GetSSLInfo(&ssl_info)); |
| 550 EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, ssl_info.cert_status); | 550 EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, ssl_info.cert_status); |
| 551 | 551 |
| 552 // The default cipher suite should be ECDHE and, unless on NSS and the | 552 // The default cipher suite should be ECDHE and an AEAD. |
| 553 // platform doesn't support it, an AEAD. | |
| 554 uint16_t cipher_suite = | 553 uint16_t cipher_suite = |
| 555 SSLConnectionStatusToCipherSuite(ssl_info.connection_status); | 554 SSLConnectionStatusToCipherSuite(ssl_info.connection_status); |
| 556 const char* key_exchange; | 555 const char* key_exchange; |
| 557 const char* cipher; | 556 const char* cipher; |
| 558 const char* mac; | 557 const char* mac; |
| 559 bool is_aead; | 558 bool is_aead; |
| 560 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, cipher_suite); | 559 bool is_tls13; |
| 560 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13, |
| 561 cipher_suite); |
| 562 EXPECT_TRUE(is_aead); |
| 563 ASSERT_FALSE(is_tls13); |
| 561 EXPECT_STREQ("ECDHE_RSA", key_exchange); | 564 EXPECT_STREQ("ECDHE_RSA", key_exchange); |
| 562 EXPECT_TRUE(is_aead); | |
| 563 } | 565 } |
| 564 | 566 |
| 565 // This test makes sure the session cache is working. | 567 // This test makes sure the session cache is working. |
| 566 TEST_F(SSLServerSocketTest, HandshakeCached) { | 568 TEST_F(SSLServerSocketTest, HandshakeCached) { |
| 567 ASSERT_NO_FATAL_FAILURE(CreateContext()); | 569 ASSERT_NO_FATAL_FAILURE(CreateContext()); |
| 568 ASSERT_NO_FATAL_FAILURE(CreateSockets()); | 570 ASSERT_NO_FATAL_FAILURE(CreateSockets()); |
| 569 | 571 |
| 570 TestCompletionCallback handshake_callback; | 572 TestCompletionCallback handshake_callback; |
| 571 int server_ret = server_socket_->Handshake(handshake_callback.callback()); | 573 int server_ret = server_socket_->Handshake(handshake_callback.callback()); |
| 572 | 574 |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 int server_ret = server_socket_->Handshake(handshake_callback.callback()); | 1114 int server_ret = server_socket_->Handshake(handshake_callback.callback()); |
| 1113 | 1115 |
| 1114 client_ret = connect_callback.GetResult(client_ret); | 1116 client_ret = connect_callback.GetResult(client_ret); |
| 1115 server_ret = handshake_callback.GetResult(server_ret); | 1117 server_ret = handshake_callback.GetResult(server_ret); |
| 1116 | 1118 |
| 1117 ASSERT_THAT(client_ret, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH)); | 1119 ASSERT_THAT(client_ret, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH)); |
| 1118 ASSERT_THAT(server_ret, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH)); | 1120 ASSERT_THAT(server_ret, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH)); |
| 1119 } | 1121 } |
| 1120 | 1122 |
| 1121 } // namespace net | 1123 } // namespace net |
| OLD | NEW |