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