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 | |
722 // Test that we can make a handshake work | 704 // Test that we can make a handshake work |
723 TEST_P(SSLStreamAdapterTestTLS, TestTLSConnect) { | 705 TEST_P(SSLStreamAdapterTestTLS, TestTLSConnect) { |
724 TestHandshake(); | 706 TestHandshake(); |
725 }; | 707 }; |
726 | 708 |
727 // Test that closing the connection on one side updates the other side. | 709 // Test that closing the connection on one side updates the other side. |
728 TEST_P(SSLStreamAdapterTestTLS, TestTLSClose) { | 710 TEST_P(SSLStreamAdapterTestTLS, TestTLSClose) { |
729 TestHandshake(); | 711 TestHandshake(); |
730 client_ssl_->Close(); | 712 client_ssl_->Close(); |
731 EXPECT_EQ_WAIT(rtc::SS_CLOSED, server_ssl_->GetState(), handshake_wait_); | 713 EXPECT_EQ_WAIT(rtc::SS_CLOSED, server_ssl_->GetState(), handshake_wait_); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 } | 1036 } |
1055 | 1037 |
1056 INSTANTIATE_TEST_CASE_P(SSLStreamAdapterTestsTLS, | 1038 INSTANTIATE_TEST_CASE_P(SSLStreamAdapterTestsTLS, |
1057 SSLStreamAdapterTestTLS, | 1039 SSLStreamAdapterTestTLS, |
1058 Combine(Values(rtc::KT_RSA, rtc::KT_ECDSA), | 1040 Combine(Values(rtc::KT_RSA, rtc::KT_ECDSA), |
1059 Values(rtc::KT_RSA, rtc::KT_ECDSA))); | 1041 Values(rtc::KT_RSA, rtc::KT_ECDSA))); |
1060 INSTANTIATE_TEST_CASE_P(SSLStreamAdapterTestsDTLS, | 1042 INSTANTIATE_TEST_CASE_P(SSLStreamAdapterTestsDTLS, |
1061 SSLStreamAdapterTestDTLS, | 1043 SSLStreamAdapterTestDTLS, |
1062 Combine(Values(rtc::KT_RSA, rtc::KT_ECDSA), | 1044 Combine(Values(rtc::KT_RSA, rtc::KT_ECDSA), |
1063 Values(rtc::KT_RSA, rtc::KT_ECDSA))); | 1045 Values(rtc::KT_RSA, rtc::KT_ECDSA))); |
OLD | NEW |