OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 | 694 |
695 class SSLStreamAdapterTestDTLSFromPEMStrings : public SSLStreamAdapterTestDTLS { | 695 class SSLStreamAdapterTestDTLSFromPEMStrings : public SSLStreamAdapterTestDTLS { |
696 public: | 696 public: |
697 SSLStreamAdapterTestDTLSFromPEMStrings() : | 697 SSLStreamAdapterTestDTLSFromPEMStrings() : |
698 SSLStreamAdapterTestDTLS(kCERT_PEM, kRSA_PRIVATE_KEY_PEM) { | 698 SSLStreamAdapterTestDTLS(kCERT_PEM, kRSA_PRIVATE_KEY_PEM) { |
699 } | 699 } |
700 }; | 700 }; |
701 | 701 |
702 // Basic tests: TLS | 702 // Basic tests: TLS |
703 | 703 |
| 704 // Test that we cannot read/write if we have not yet handshaked. |
| 705 // This test only applies to NSS because OpenSSL has passthrough |
| 706 // semantics for I/O before the handshake is started. |
| 707 #if SSL_USE_NSS |
| 708 TEST_P(SSLStreamAdapterTestTLS, TestNoReadWriteBeforeConnect) { |
| 709 rtc::StreamResult rv; |
| 710 char block[kBlockSize]; |
| 711 size_t dummy; |
| 712 |
| 713 rv = client_ssl_->Write(block, sizeof(block), &dummy, NULL); |
| 714 ASSERT_EQ(rtc::SR_BLOCK, rv); |
| 715 |
| 716 rv = client_ssl_->Read(block, sizeof(block), &dummy, NULL); |
| 717 ASSERT_EQ(rtc::SR_BLOCK, rv); |
| 718 } |
| 719 #endif |
| 720 |
| 721 |
704 // Test that we can make a handshake work | 722 // Test that we can make a handshake work |
705 TEST_P(SSLStreamAdapterTestTLS, TestTLSConnect) { | 723 TEST_P(SSLStreamAdapterTestTLS, TestTLSConnect) { |
706 TestHandshake(); | 724 TestHandshake(); |
707 }; | 725 }; |
708 | 726 |
709 // Test that closing the connection on one side updates the other side. | 727 // Test that closing the connection on one side updates the other side. |
710 TEST_P(SSLStreamAdapterTestTLS, TestTLSClose) { | 728 TEST_P(SSLStreamAdapterTestTLS, TestTLSClose) { |
711 TestHandshake(); | 729 TestHandshake(); |
712 client_ssl_->Close(); | 730 client_ssl_->Close(); |
713 EXPECT_EQ_WAIT(rtc::SS_CLOSED, server_ssl_->GetState(), handshake_wait_); | 731 EXPECT_EQ_WAIT(rtc::SS_CLOSED, server_ssl_->GetState(), handshake_wait_); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 } | 1051 } |
1034 | 1052 |
1035 INSTANTIATE_TEST_CASE_P(SSLStreamAdapterTestsTLS, | 1053 INSTANTIATE_TEST_CASE_P(SSLStreamAdapterTestsTLS, |
1036 SSLStreamAdapterTestTLS, | 1054 SSLStreamAdapterTestTLS, |
1037 Combine(Values(rtc::KT_RSA, rtc::KT_ECDSA), | 1055 Combine(Values(rtc::KT_RSA, rtc::KT_ECDSA), |
1038 Values(rtc::KT_RSA, rtc::KT_ECDSA))); | 1056 Values(rtc::KT_RSA, rtc::KT_ECDSA))); |
1039 INSTANTIATE_TEST_CASE_P(SSLStreamAdapterTestsDTLS, | 1057 INSTANTIATE_TEST_CASE_P(SSLStreamAdapterTestsDTLS, |
1040 SSLStreamAdapterTestDTLS, | 1058 SSLStreamAdapterTestDTLS, |
1041 Combine(Values(rtc::KT_RSA, rtc::KT_ECDSA), | 1059 Combine(Values(rtc::KT_RSA, rtc::KT_ECDSA), |
1042 Values(rtc::KT_RSA, rtc::KT_ECDSA))); | 1060 Values(rtc::KT_RSA, rtc::KT_ECDSA))); |
OLD | NEW |