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 30 matching lines...) Expand all Loading... |
41 using cricket::ConnectionRole; | 41 using cricket::ConnectionRole; |
42 | 42 |
43 enum Flags { NF_REOFFER = 0x1, NF_EXPECT_FAILURE = 0x2 }; | 43 enum Flags { NF_REOFFER = 0x1, NF_EXPECT_FAILURE = 0x2 }; |
44 | 44 |
45 class DtlsTestClient : public sigslot::has_slots<> { | 45 class DtlsTestClient : public sigslot::has_slots<> { |
46 public: | 46 public: |
47 DtlsTestClient(const std::string& name) | 47 DtlsTestClient(const std::string& name) |
48 : name_(name), | 48 : name_(name), |
49 packet_size_(0), | 49 packet_size_(0), |
50 use_dtls_srtp_(false), | 50 use_dtls_srtp_(false), |
51 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10), | 51 ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_12), |
52 negotiated_dtls_(false), | 52 negotiated_dtls_(false), |
53 received_dtls_client_hello_(false), | 53 received_dtls_client_hello_(false), |
54 received_dtls_server_hello_(false) {} | 54 received_dtls_server_hello_(false) {} |
55 void CreateCertificate(rtc::KeyType key_type) { | 55 void CreateCertificate(rtc::KeyType key_type) { |
56 certificate_ = | 56 certificate_ = |
57 rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>( | 57 rtc::RTCCertificate::Create(rtc::scoped_ptr<rtc::SSLIdentity>( |
58 rtc::SSLIdentity::Generate(name_, key_type))); | 58 rtc::SSLIdentity::Generate(name_, key_type))); |
59 } | 59 } |
60 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() { | 60 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() { |
61 return certificate_; | 61 return certificate_; |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 | 394 |
395 class DtlsTransportChannelTest : public testing::Test { | 395 class DtlsTransportChannelTest : public testing::Test { |
396 public: | 396 public: |
397 DtlsTransportChannelTest() | 397 DtlsTransportChannelTest() |
398 : client1_("P1"), | 398 : client1_("P1"), |
399 client2_("P2"), | 399 client2_("P2"), |
400 channel_ct_(1), | 400 channel_ct_(1), |
401 use_dtls_(false), | 401 use_dtls_(false), |
402 use_dtls_srtp_(false), | 402 use_dtls_srtp_(false), |
403 ssl_expected_version_(rtc::SSL_PROTOCOL_DTLS_10) {} | 403 ssl_expected_version_(rtc::SSL_PROTOCOL_DTLS_12) {} |
404 | 404 |
405 void SetChannelCount(size_t channel_ct) { | 405 void SetChannelCount(size_t channel_ct) { |
406 channel_ct_ = static_cast<int>(channel_ct); | 406 channel_ct_ = static_cast<int>(channel_ct); |
407 } | 407 } |
408 void SetMaxProtocolVersions(rtc::SSLProtocolVersion c1, | 408 void SetMaxProtocolVersions(rtc::SSLProtocolVersion c1, |
409 rtc::SSLProtocolVersion c2) { | 409 rtc::SSLProtocolVersion c2) { |
410 client1_.SetupMaxProtocolVersion(c1); | 410 client1_.SetupMaxProtocolVersion(c1); |
411 client2_.SetupMaxProtocolVersion(c2); | 411 client2_.SetupMaxProtocolVersion(c2); |
412 ssl_expected_version_ = std::min(c1, c2); | 412 ssl_expected_version_ = std::min(c1, c2); |
413 } | 413 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 } | 593 } |
594 | 594 |
595 // Create two channels without DTLS, and transfer SRTP data. | 595 // Create two channels without DTLS, and transfer SRTP data. |
596 TEST_F(DtlsTransportChannelTest, TestTransferSrtpTwoChannels) { | 596 TEST_F(DtlsTransportChannelTest, TestTransferSrtpTwoChannels) { |
597 SetChannelCount(2); | 597 SetChannelCount(2); |
598 ASSERT_TRUE(Connect()); | 598 ASSERT_TRUE(Connect()); |
599 TestTransfer(0, 1000, 100, true); | 599 TestTransfer(0, 1000, 100, true); |
600 TestTransfer(1, 1000, 100, true); | 600 TestTransfer(1, 1000, 100, true); |
601 } | 601 } |
602 | 602 |
| 603 #if defined(MEMORY_SANITIZER) |
| 604 // Fails under MemorySanitizer: |
| 605 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 606 #define MAYBE_TestTransferDtls DISABLED_TestTransferDtls |
| 607 #else |
| 608 #define MAYBE_TestTransferDtls TestTransferDtls |
| 609 #endif |
603 // Connect with DTLS, and transfer some data. | 610 // Connect with DTLS, and transfer some data. |
604 TEST_F(DtlsTransportChannelTest, TestTransferDtls) { | 611 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtls) { |
605 MAYBE_SKIP_TEST(HaveDtls); | 612 MAYBE_SKIP_TEST(HaveDtls); |
606 PrepareDtls(true, true, rtc::KT_DEFAULT); | 613 PrepareDtls(true, true, rtc::KT_DEFAULT); |
607 ASSERT_TRUE(Connect()); | 614 ASSERT_TRUE(Connect()); |
608 TestTransfer(0, 1000, 100, false); | 615 TestTransfer(0, 1000, 100, false); |
609 } | 616 } |
610 | 617 |
| 618 #if defined(MEMORY_SANITIZER) |
| 619 // Fails under MemorySanitizer: |
| 620 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 621 #define MAYBE_TestTransferDtlsTwoChannels DISABLED_TestTransferDtlsTwoChannels |
| 622 #else |
| 623 #define MAYBE_TestTransferDtlsTwoChannels TestTransferDtlsTwoChannels |
| 624 #endif |
611 // Create two channels with DTLS, and transfer some data. | 625 // Create two channels with DTLS, and transfer some data. |
612 TEST_F(DtlsTransportChannelTest, TestTransferDtlsTwoChannels) { | 626 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsTwoChannels) { |
613 MAYBE_SKIP_TEST(HaveDtls); | 627 MAYBE_SKIP_TEST(HaveDtls); |
614 SetChannelCount(2); | 628 SetChannelCount(2); |
615 PrepareDtls(true, true, rtc::KT_DEFAULT); | 629 PrepareDtls(true, true, rtc::KT_DEFAULT); |
616 ASSERT_TRUE(Connect()); | 630 ASSERT_TRUE(Connect()); |
617 TestTransfer(0, 1000, 100, false); | 631 TestTransfer(0, 1000, 100, false); |
618 TestTransfer(1, 1000, 100, false); | 632 TestTransfer(1, 1000, 100, false); |
619 } | 633 } |
620 | 634 |
621 // Connect with A doing DTLS and B not, and transfer some data. | 635 // Connect with A doing DTLS and B not, and transfer some data. |
622 TEST_F(DtlsTransportChannelTest, TestTransferDtlsRejected) { | 636 TEST_F(DtlsTransportChannelTest, TestTransferDtlsRejected) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 | 682 |
669 // Create two channels with DTLS 1.2 / DTLS 1.0 and check ciphers. | 683 // Create two channels with DTLS 1.2 / DTLS 1.0 and check ciphers. |
670 TEST_F(DtlsTransportChannelTest, TestDtls12Client2) { | 684 TEST_F(DtlsTransportChannelTest, TestDtls12Client2) { |
671 MAYBE_SKIP_TEST(HaveDtls); | 685 MAYBE_SKIP_TEST(HaveDtls); |
672 SetChannelCount(2); | 686 SetChannelCount(2); |
673 PrepareDtls(true, true, rtc::KT_DEFAULT); | 687 PrepareDtls(true, true, rtc::KT_DEFAULT); |
674 SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_12); | 688 SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_12); |
675 ASSERT_TRUE(Connect()); | 689 ASSERT_TRUE(Connect()); |
676 } | 690 } |
677 | 691 |
| 692 #if defined(MEMORY_SANITIZER) |
| 693 // Fails under MemorySanitizer: |
| 694 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 695 #define MAYBE_TestTransferDtlsSrtp DISABLED_TestTransferDtlsSrtp |
| 696 #else |
| 697 #define MAYBE_TestTransferDtlsSrtp TestTransferDtlsSrtp |
| 698 #endif |
678 // Connect with DTLS, negotiate DTLS-SRTP, and transfer SRTP using bypass. | 699 // Connect with DTLS, negotiate DTLS-SRTP, and transfer SRTP using bypass. |
679 TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtp) { | 700 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsSrtp) { |
680 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 701 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
681 PrepareDtls(true, true, rtc::KT_DEFAULT); | 702 PrepareDtls(true, true, rtc::KT_DEFAULT); |
682 PrepareDtlsSrtp(true, true); | 703 PrepareDtlsSrtp(true, true); |
683 ASSERT_TRUE(Connect()); | 704 ASSERT_TRUE(Connect()); |
684 TestTransfer(0, 1000, 100, true); | 705 TestTransfer(0, 1000, 100, true); |
685 } | 706 } |
686 | 707 |
| 708 #if defined(MEMORY_SANITIZER) |
| 709 // Fails under MemorySanitizer: |
| 710 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 711 #define MAYBE_TestTransferDtlsInvalidSrtpPacket \ |
| 712 DISABLED_TestTransferDtlsInvalidSrtpPacket |
| 713 #else |
| 714 #define MAYBE_TestTransferDtlsInvalidSrtpPacket \ |
| 715 TestTransferDtlsInvalidSrtpPacket |
| 716 #endif |
687 // Connect with DTLS-SRTP, transfer an invalid SRTP packet, and expects -1 | 717 // Connect with DTLS-SRTP, transfer an invalid SRTP packet, and expects -1 |
688 // returned. | 718 // returned. |
689 TEST_F(DtlsTransportChannelTest, TestTransferDtlsInvalidSrtpPacket) { | 719 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsInvalidSrtpPacket) { |
690 MAYBE_SKIP_TEST(HaveDtls); | 720 MAYBE_SKIP_TEST(HaveDtls); |
691 PrepareDtls(true, true, rtc::KT_DEFAULT); | 721 PrepareDtls(true, true, rtc::KT_DEFAULT); |
692 PrepareDtlsSrtp(true, true); | 722 PrepareDtlsSrtp(true, true); |
693 ASSERT_TRUE(Connect()); | 723 ASSERT_TRUE(Connect()); |
694 int result = client1_.SendInvalidSrtpPacket(0, 100); | 724 int result = client1_.SendInvalidSrtpPacket(0, 100); |
695 ASSERT_EQ(-1, result); | 725 ASSERT_EQ(-1, result); |
696 } | 726 } |
697 | 727 |
| 728 #if defined(MEMORY_SANITIZER) |
| 729 // Fails under MemorySanitizer: |
| 730 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 731 #define MAYBE_TestTransferDtlsSrtpRejected DISABLED_TestTransferDtlsSrtpRejected |
| 732 #else |
| 733 #define MAYBE_TestTransferDtlsSrtpRejected TestTransferDtlsSrtpRejected |
| 734 #endif |
698 // Connect with DTLS. A does DTLS-SRTP but B does not. | 735 // Connect with DTLS. A does DTLS-SRTP but B does not. |
699 TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpRejected) { | 736 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsSrtpRejected) { |
700 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 737 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
701 PrepareDtls(true, true, rtc::KT_DEFAULT); | 738 PrepareDtls(true, true, rtc::KT_DEFAULT); |
702 PrepareDtlsSrtp(true, false); | 739 PrepareDtlsSrtp(true, false); |
703 ASSERT_TRUE(Connect()); | 740 ASSERT_TRUE(Connect()); |
704 } | 741 } |
705 | 742 |
| 743 #if defined(MEMORY_SANITIZER) |
| 744 // Fails under MemorySanitizer: |
| 745 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 746 #define MAYBE_TestTransferDtlsSrtpNotOffered \ |
| 747 DISABLED_TestTransferDtlsSrtpNotOffered |
| 748 #else |
| 749 #define MAYBE_TestTransferDtlsSrtpNotOffered TestTransferDtlsSrtpNotOffered |
| 750 #endif |
706 // Connect with DTLS. B does DTLS-SRTP but A does not. | 751 // Connect with DTLS. B does DTLS-SRTP but A does not. |
707 TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpNotOffered) { | 752 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsSrtpNotOffered) { |
708 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 753 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
709 PrepareDtls(true, true, rtc::KT_DEFAULT); | 754 PrepareDtls(true, true, rtc::KT_DEFAULT); |
710 PrepareDtlsSrtp(false, true); | 755 PrepareDtlsSrtp(false, true); |
711 ASSERT_TRUE(Connect()); | 756 ASSERT_TRUE(Connect()); |
712 } | 757 } |
713 | 758 |
| 759 #if defined(MEMORY_SANITIZER) |
| 760 // Fails under MemorySanitizer: |
| 761 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 762 #define MAYBE_TestTransferDtlsSrtpTwoChannels \ |
| 763 DISABLED_TestTransferDtlsSrtpTwoChannels |
| 764 #else |
| 765 #define MAYBE_TestTransferDtlsSrtpTwoChannels TestTransferDtlsSrtpTwoChannels |
| 766 #endif |
714 // Create two channels with DTLS, negotiate DTLS-SRTP, and transfer bypass SRTP. | 767 // Create two channels with DTLS, negotiate DTLS-SRTP, and transfer bypass SRTP. |
715 TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpTwoChannels) { | 768 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsSrtpTwoChannels) { |
716 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 769 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
717 SetChannelCount(2); | 770 SetChannelCount(2); |
718 PrepareDtls(true, true, rtc::KT_DEFAULT); | 771 PrepareDtls(true, true, rtc::KT_DEFAULT); |
719 PrepareDtlsSrtp(true, true); | 772 PrepareDtlsSrtp(true, true); |
720 ASSERT_TRUE(Connect()); | 773 ASSERT_TRUE(Connect()); |
721 TestTransfer(0, 1000, 100, true); | 774 TestTransfer(0, 1000, 100, true); |
722 TestTransfer(1, 1000, 100, true); | 775 TestTransfer(1, 1000, 100, true); |
723 } | 776 } |
724 | 777 |
| 778 #if defined(MEMORY_SANITIZER) |
| 779 // Fails under MemorySanitizer: |
| 780 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 781 #define MAYBE_TestTransferDtlsSrtpDemux DISABLED_TestTransferDtlsSrtpDemux |
| 782 #else |
| 783 #define MAYBE_TestTransferDtlsSrtpDemux TestTransferDtlsSrtpDemux |
| 784 #endif |
725 // Create a single channel with DTLS, and send normal data and SRTP data on it. | 785 // Create a single channel with DTLS, and send normal data and SRTP data on it. |
726 TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpDemux) { | 786 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsSrtpDemux) { |
727 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 787 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
728 PrepareDtls(true, true, rtc::KT_DEFAULT); | 788 PrepareDtls(true, true, rtc::KT_DEFAULT); |
729 PrepareDtlsSrtp(true, true); | 789 PrepareDtlsSrtp(true, true); |
730 ASSERT_TRUE(Connect()); | 790 ASSERT_TRUE(Connect()); |
731 TestTransfer(0, 1000, 100, false); | 791 TestTransfer(0, 1000, 100, false); |
732 TestTransfer(0, 1000, 100, true); | 792 TestTransfer(0, 1000, 100, true); |
733 } | 793 } |
734 | 794 |
| 795 #if defined(MEMORY_SANITIZER) |
| 796 // Fails under MemorySanitizer: |
| 797 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 798 #define MAYBE_TestTransferDtlsAnswererIsPassive \ |
| 799 DISABLED_TestTransferDtlsAnswererIsPassive |
| 800 #else |
| 801 #define MAYBE_TestTransferDtlsAnswererIsPassive \ |
| 802 TestTransferDtlsAnswererIsPassive |
| 803 #endif |
735 // Testing when the remote is passive. | 804 // Testing when the remote is passive. |
736 TEST_F(DtlsTransportChannelTest, TestTransferDtlsAnswererIsPassive) { | 805 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsAnswererIsPassive) { |
737 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 806 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
738 SetChannelCount(2); | 807 SetChannelCount(2); |
739 PrepareDtls(true, true, rtc::KT_DEFAULT); | 808 PrepareDtls(true, true, rtc::KT_DEFAULT); |
740 PrepareDtlsSrtp(true, true); | 809 PrepareDtlsSrtp(true, true); |
741 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, | 810 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
742 cricket::CONNECTIONROLE_PASSIVE)); | 811 cricket::CONNECTIONROLE_PASSIVE)); |
743 TestTransfer(0, 1000, 100, true); | 812 TestTransfer(0, 1000, 100, true); |
744 TestTransfer(1, 1000, 100, true); | 813 TestTransfer(1, 1000, 100, true); |
745 } | 814 } |
746 | 815 |
747 // Testing with the legacy DTLS client which doesn't use setup attribute. | 816 // Testing with the legacy DTLS client which doesn't use setup attribute. |
748 // In this case legacy is the answerer. | 817 // In this case legacy is the answerer. |
749 TEST_F(DtlsTransportChannelTest, TestDtlsSetupWithLegacyAsAnswerer) { | 818 TEST_F(DtlsTransportChannelTest, TestDtlsSetupWithLegacyAsAnswerer) { |
750 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 819 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
751 PrepareDtls(true, true, rtc::KT_DEFAULT); | 820 PrepareDtls(true, true, rtc::KT_DEFAULT); |
752 NegotiateWithLegacy(); | 821 NegotiateWithLegacy(); |
753 rtc::SSLRole channel1_role; | 822 rtc::SSLRole channel1_role; |
754 rtc::SSLRole channel2_role; | 823 rtc::SSLRole channel2_role; |
755 EXPECT_TRUE(client1_.transport()->GetSslRole(&channel1_role)); | 824 EXPECT_TRUE(client1_.transport()->GetSslRole(&channel1_role)); |
756 EXPECT_TRUE(client2_.transport()->GetSslRole(&channel2_role)); | 825 EXPECT_TRUE(client2_.transport()->GetSslRole(&channel2_role)); |
757 EXPECT_EQ(rtc::SSL_SERVER, channel1_role); | 826 EXPECT_EQ(rtc::SSL_SERVER, channel1_role); |
758 EXPECT_EQ(rtc::SSL_CLIENT, channel2_role); | 827 EXPECT_EQ(rtc::SSL_CLIENT, channel2_role); |
759 } | 828 } |
760 | 829 |
| 830 #if defined(MEMORY_SANITIZER) |
| 831 // Fails under MemorySanitizer: |
| 832 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 833 #define MAYBE_TestDtlsReOfferFromOfferer DISABLED_TestDtlsReOfferFromOfferer |
| 834 #else |
| 835 #define MAYBE_TestDtlsReOfferFromOfferer TestDtlsReOfferFromOfferer |
| 836 #endif |
761 // Testing re offer/answer after the session is estbalished. Roles will be | 837 // Testing re offer/answer after the session is estbalished. Roles will be |
762 // kept same as of the previous negotiation. | 838 // kept same as of the previous negotiation. |
763 TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromOfferer) { | 839 TEST_F(DtlsTransportChannelTest, MAYBE_TestDtlsReOfferFromOfferer) { |
764 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 840 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
765 SetChannelCount(2); | 841 SetChannelCount(2); |
766 PrepareDtls(true, true, rtc::KT_DEFAULT); | 842 PrepareDtls(true, true, rtc::KT_DEFAULT); |
767 PrepareDtlsSrtp(true, true); | 843 PrepareDtlsSrtp(true, true); |
768 // Initial role for client1 is ACTPASS and client2 is ACTIVE. | 844 // Initial role for client1 is ACTPASS and client2 is ACTIVE. |
769 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, | 845 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
770 cricket::CONNECTIONROLE_ACTIVE)); | 846 cricket::CONNECTIONROLE_ACTIVE)); |
771 TestTransfer(0, 1000, 100, true); | 847 TestTransfer(0, 1000, 100, true); |
772 TestTransfer(1, 1000, 100, true); | 848 TestTransfer(1, 1000, 100, true); |
773 // Using input roles for the re-offer. | 849 // Using input roles for the re-offer. |
774 Renegotiate(&client1_, cricket::CONNECTIONROLE_ACTPASS, | 850 Renegotiate(&client1_, cricket::CONNECTIONROLE_ACTPASS, |
775 cricket::CONNECTIONROLE_ACTIVE, NF_REOFFER); | 851 cricket::CONNECTIONROLE_ACTIVE, NF_REOFFER); |
776 TestTransfer(0, 1000, 100, true); | 852 TestTransfer(0, 1000, 100, true); |
777 TestTransfer(1, 1000, 100, true); | 853 TestTransfer(1, 1000, 100, true); |
778 } | 854 } |
779 | 855 |
780 TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromAnswerer) { | 856 #if defined(MEMORY_SANITIZER) |
| 857 // Fails under MemorySanitizer: |
| 858 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 859 #define MAYBE_TestDtlsReOfferFromAnswerer DISABLED_TestDtlsReOfferFromAnswerer |
| 860 #else |
| 861 #define MAYBE_TestDtlsReOfferFromAnswerer TestDtlsReOfferFromAnswerer |
| 862 #endif |
| 863 TEST_F(DtlsTransportChannelTest, MAYBE_TestDtlsReOfferFromAnswerer) { |
781 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 864 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
782 SetChannelCount(2); | 865 SetChannelCount(2); |
783 PrepareDtls(true, true, rtc::KT_DEFAULT); | 866 PrepareDtls(true, true, rtc::KT_DEFAULT); |
784 PrepareDtlsSrtp(true, true); | 867 PrepareDtlsSrtp(true, true); |
785 // Initial role for client1 is ACTPASS and client2 is ACTIVE. | 868 // Initial role for client1 is ACTPASS and client2 is ACTIVE. |
786 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, | 869 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
787 cricket::CONNECTIONROLE_ACTIVE)); | 870 cricket::CONNECTIONROLE_ACTIVE)); |
788 TestTransfer(0, 1000, 100, true); | 871 TestTransfer(0, 1000, 100, true); |
789 TestTransfer(1, 1000, 100, true); | 872 TestTransfer(1, 1000, 100, true); |
790 // Using input roles for the re-offer. | 873 // Using input roles for the re-offer. |
791 Renegotiate(&client2_, cricket::CONNECTIONROLE_PASSIVE, | 874 Renegotiate(&client2_, cricket::CONNECTIONROLE_PASSIVE, |
792 cricket::CONNECTIONROLE_ACTPASS, NF_REOFFER); | 875 cricket::CONNECTIONROLE_ACTPASS, NF_REOFFER); |
793 TestTransfer(0, 1000, 100, true); | 876 TestTransfer(0, 1000, 100, true); |
794 TestTransfer(1, 1000, 100, true); | 877 TestTransfer(1, 1000, 100, true); |
795 } | 878 } |
796 | 879 |
| 880 #if defined(MEMORY_SANITIZER) |
| 881 // Fails under MemorySanitizer: |
| 882 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 883 #define MAYBE_TestDtlsRoleReversal DISABLED_TestDtlsRoleReversal |
| 884 #else |
| 885 #define MAYBE_TestDtlsRoleReversal TestDtlsRoleReversal |
| 886 #endif |
797 // Test that any change in role after the intial setup will result in failure. | 887 // Test that any change in role after the intial setup will result in failure. |
798 TEST_F(DtlsTransportChannelTest, TestDtlsRoleReversal) { | 888 TEST_F(DtlsTransportChannelTest, MAYBE_TestDtlsRoleReversal) { |
799 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 889 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
800 SetChannelCount(2); | 890 SetChannelCount(2); |
801 PrepareDtls(true, true, rtc::KT_DEFAULT); | 891 PrepareDtls(true, true, rtc::KT_DEFAULT); |
802 PrepareDtlsSrtp(true, true); | 892 PrepareDtlsSrtp(true, true); |
803 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, | 893 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
804 cricket::CONNECTIONROLE_PASSIVE)); | 894 cricket::CONNECTIONROLE_PASSIVE)); |
805 | 895 |
806 // Renegotiate from client2 with actpass and client1 as active. | 896 // Renegotiate from client2 with actpass and client1 as active. |
807 Renegotiate(&client2_, cricket::CONNECTIONROLE_ACTPASS, | 897 Renegotiate(&client2_, cricket::CONNECTIONROLE_ACTPASS, |
808 cricket::CONNECTIONROLE_ACTIVE, | 898 cricket::CONNECTIONROLE_ACTIVE, |
809 NF_REOFFER | NF_EXPECT_FAILURE); | 899 NF_REOFFER | NF_EXPECT_FAILURE); |
810 } | 900 } |
811 | 901 |
| 902 #if defined(MEMORY_SANITIZER) |
| 903 // Fails under MemorySanitizer: |
| 904 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 905 #define MAYBE_TestDtlsReOfferWithDifferentSetupAttr \ |
| 906 DISABLED_TestDtlsReOfferWithDifferentSetupAttr |
| 907 #else |
| 908 #define MAYBE_TestDtlsReOfferWithDifferentSetupAttr \ |
| 909 TestDtlsReOfferWithDifferentSetupAttr |
| 910 #endif |
812 // Test that using different setup attributes which results in similar ssl | 911 // Test that using different setup attributes which results in similar ssl |
813 // role as the initial negotiation will result in success. | 912 // role as the initial negotiation will result in success. |
814 TEST_F(DtlsTransportChannelTest, TestDtlsReOfferWithDifferentSetupAttr) { | 913 TEST_F(DtlsTransportChannelTest, MAYBE_TestDtlsReOfferWithDifferentSetupAttr) { |
815 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 914 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
816 SetChannelCount(2); | 915 SetChannelCount(2); |
817 PrepareDtls(true, true, rtc::KT_DEFAULT); | 916 PrepareDtls(true, true, rtc::KT_DEFAULT); |
818 PrepareDtlsSrtp(true, true); | 917 PrepareDtlsSrtp(true, true); |
819 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, | 918 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
820 cricket::CONNECTIONROLE_PASSIVE)); | 919 cricket::CONNECTIONROLE_PASSIVE)); |
821 // Renegotiate from client2 with actpass and client1 as active. | 920 // Renegotiate from client2 with actpass and client1 as active. |
822 Renegotiate(&client2_, cricket::CONNECTIONROLE_ACTIVE, | 921 Renegotiate(&client2_, cricket::CONNECTIONROLE_ACTIVE, |
823 cricket::CONNECTIONROLE_ACTPASS, NF_REOFFER); | 922 cricket::CONNECTIONROLE_ACTPASS, NF_REOFFER); |
824 TestTransfer(0, 1000, 100, true); | 923 TestTransfer(0, 1000, 100, true); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), | 963 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), |
865 certificate2->ssl_certificate().ToPEMString()); | 964 certificate2->ssl_certificate().ToPEMString()); |
866 ASSERT_FALSE( | 965 ASSERT_FALSE( |
867 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); | 966 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); |
868 ASSERT_FALSE(remote_cert1 != NULL); | 967 ASSERT_FALSE(remote_cert1 != NULL); |
869 ASSERT_FALSE( | 968 ASSERT_FALSE( |
870 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); | 969 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); |
871 ASSERT_FALSE(remote_cert2 != NULL); | 970 ASSERT_FALSE(remote_cert2 != NULL); |
872 } | 971 } |
873 | 972 |
| 973 #if defined(MEMORY_SANITIZER) |
| 974 // Fails under MemorySanitizer: |
| 975 // See https://code.google.com/p/webrtc/issues/detail?id=5381. |
| 976 #define MAYBE_TestCertificatesAfterConnect DISABLED_TestCertificatesAfterConnect |
| 977 #else |
| 978 #define MAYBE_TestCertificatesAfterConnect TestCertificatesAfterConnect |
| 979 #endif |
874 // Test Certificates state after connection. | 980 // Test Certificates state after connection. |
875 TEST_F(DtlsTransportChannelTest, TestCertificatesAfterConnect) { | 981 TEST_F(DtlsTransportChannelTest, MAYBE_TestCertificatesAfterConnect) { |
876 MAYBE_SKIP_TEST(HaveDtls); | 982 MAYBE_SKIP_TEST(HaveDtls); |
877 PrepareDtls(true, true, rtc::KT_DEFAULT); | 983 PrepareDtls(true, true, rtc::KT_DEFAULT); |
878 ASSERT_TRUE(Connect()); | 984 ASSERT_TRUE(Connect()); |
879 | 985 |
880 rtc::scoped_refptr<rtc::RTCCertificate> certificate1; | 986 rtc::scoped_refptr<rtc::RTCCertificate> certificate1; |
881 rtc::scoped_refptr<rtc::RTCCertificate> certificate2; | 987 rtc::scoped_refptr<rtc::RTCCertificate> certificate2; |
882 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert1; | 988 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert1; |
883 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert2; | 989 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert2; |
884 | 990 |
885 // After connection, each side has a distinct local certificate. | 991 // After connection, each side has a distinct local certificate. |
886 ASSERT_TRUE(client1_.transport()->GetLocalCertificate(&certificate1)); | 992 ASSERT_TRUE(client1_.transport()->GetLocalCertificate(&certificate1)); |
887 ASSERT_TRUE(client2_.transport()->GetLocalCertificate(&certificate2)); | 993 ASSERT_TRUE(client2_.transport()->GetLocalCertificate(&certificate2)); |
888 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), | 994 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), |
889 certificate2->ssl_certificate().ToPEMString()); | 995 certificate2->ssl_certificate().ToPEMString()); |
890 | 996 |
891 // Each side's remote certificate is the other side's local certificate. | 997 // Each side's remote certificate is the other side's local certificate. |
892 ASSERT_TRUE( | 998 ASSERT_TRUE( |
893 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); | 999 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); |
894 ASSERT_EQ(remote_cert1->ToPEMString(), | 1000 ASSERT_EQ(remote_cert1->ToPEMString(), |
895 certificate2->ssl_certificate().ToPEMString()); | 1001 certificate2->ssl_certificate().ToPEMString()); |
896 ASSERT_TRUE( | 1002 ASSERT_TRUE( |
897 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); | 1003 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); |
898 ASSERT_EQ(remote_cert2->ToPEMString(), | 1004 ASSERT_EQ(remote_cert2->ToPEMString(), |
899 certificate1->ssl_certificate().ToPEMString()); | 1005 certificate1->ssl_certificate().ToPEMString()); |
900 } | 1006 } |
OLD | NEW |