| 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 582 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 | |
| 610 // Connect with DTLS, and transfer some data. | 603 // Connect with DTLS, and transfer some data. |
| 611 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtls) { | 604 TEST_F(DtlsTransportChannelTest, TestTransferDtls) { |
| 612 MAYBE_SKIP_TEST(HaveDtls); | 605 MAYBE_SKIP_TEST(HaveDtls); |
| 613 PrepareDtls(true, true, rtc::KT_DEFAULT); | 606 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 614 ASSERT_TRUE(Connect()); | 607 ASSERT_TRUE(Connect()); |
| 615 TestTransfer(0, 1000, 100, false); | 608 TestTransfer(0, 1000, 100, false); |
| 616 } | 609 } |
| 617 | 610 |
| 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 | |
| 625 // Create two channels with DTLS, and transfer some data. | 611 // Create two channels with DTLS, and transfer some data. |
| 626 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsTwoChannels) { | 612 TEST_F(DtlsTransportChannelTest, TestTransferDtlsTwoChannels) { |
| 627 MAYBE_SKIP_TEST(HaveDtls); | 613 MAYBE_SKIP_TEST(HaveDtls); |
| 628 SetChannelCount(2); | 614 SetChannelCount(2); |
| 629 PrepareDtls(true, true, rtc::KT_DEFAULT); | 615 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 630 ASSERT_TRUE(Connect()); | 616 ASSERT_TRUE(Connect()); |
| 631 TestTransfer(0, 1000, 100, false); | 617 TestTransfer(0, 1000, 100, false); |
| 632 TestTransfer(1, 1000, 100, false); | 618 TestTransfer(1, 1000, 100, false); |
| 633 } | 619 } |
| 634 | 620 |
| 635 // Connect with A doing DTLS and B not, and transfer some data. | 621 // Connect with A doing DTLS and B not, and transfer some data. |
| 636 TEST_F(DtlsTransportChannelTest, TestTransferDtlsRejected) { | 622 TEST_F(DtlsTransportChannelTest, TestTransferDtlsRejected) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 648 | 634 |
| 649 // Create two channels with DTLS 1.0 and check ciphers. | 635 // Create two channels with DTLS 1.0 and check ciphers. |
| 650 TEST_F(DtlsTransportChannelTest, TestDtls12None) { | 636 TEST_F(DtlsTransportChannelTest, TestDtls12None) { |
| 651 MAYBE_SKIP_TEST(HaveDtls); | 637 MAYBE_SKIP_TEST(HaveDtls); |
| 652 SetChannelCount(2); | 638 SetChannelCount(2); |
| 653 PrepareDtls(true, true, rtc::KT_DEFAULT); | 639 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 654 SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10); | 640 SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10); |
| 655 ASSERT_TRUE(Connect()); | 641 ASSERT_TRUE(Connect()); |
| 656 } | 642 } |
| 657 | 643 |
| 658 #if defined(MEMORY_SANITIZER) | |
| 659 // Fails under MemorySanitizer: | |
| 660 // See https://code.google.com/p/webrtc/issues/detail?id=5381. | |
| 661 #define MAYBE_TestDtls12Both DISABLED_TestDtls12Both | |
| 662 #else | |
| 663 #define MAYBE_TestDtls12Both TestDtls12Both | |
| 664 #endif | |
| 665 // Create two channels with DTLS 1.2 and check ciphers. | 644 // Create two channels with DTLS 1.2 and check ciphers. |
| 666 TEST_F(DtlsTransportChannelTest, MAYBE_TestDtls12Both) { | 645 TEST_F(DtlsTransportChannelTest, TestDtls12Both) { |
| 667 MAYBE_SKIP_TEST(HaveDtls); | 646 MAYBE_SKIP_TEST(HaveDtls); |
| 668 SetChannelCount(2); | 647 SetChannelCount(2); |
| 669 PrepareDtls(true, true, rtc::KT_DEFAULT); | 648 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 670 SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_12); | 649 SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_12); |
| 671 ASSERT_TRUE(Connect()); | 650 ASSERT_TRUE(Connect()); |
| 672 } | 651 } |
| 673 | 652 |
| 674 // Create two channels with DTLS 1.0 / DTLS 1.2 and check ciphers. | 653 // Create two channels with DTLS 1.0 / DTLS 1.2 and check ciphers. |
| 675 TEST_F(DtlsTransportChannelTest, TestDtls12Client1) { | 654 TEST_F(DtlsTransportChannelTest, TestDtls12Client1) { |
| 676 MAYBE_SKIP_TEST(HaveDtls); | 655 MAYBE_SKIP_TEST(HaveDtls); |
| 677 SetChannelCount(2); | 656 SetChannelCount(2); |
| 678 PrepareDtls(true, true, rtc::KT_DEFAULT); | 657 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 679 SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_10); | 658 SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_10); |
| 680 ASSERT_TRUE(Connect()); | 659 ASSERT_TRUE(Connect()); |
| 681 } | 660 } |
| 682 | 661 |
| 683 // Create two channels with DTLS 1.2 / DTLS 1.0 and check ciphers. | 662 // Create two channels with DTLS 1.2 / DTLS 1.0 and check ciphers. |
| 684 TEST_F(DtlsTransportChannelTest, TestDtls12Client2) { | 663 TEST_F(DtlsTransportChannelTest, TestDtls12Client2) { |
| 685 MAYBE_SKIP_TEST(HaveDtls); | 664 MAYBE_SKIP_TEST(HaveDtls); |
| 686 SetChannelCount(2); | 665 SetChannelCount(2); |
| 687 PrepareDtls(true, true, rtc::KT_DEFAULT); | 666 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 688 SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_12); | 667 SetMaxProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_12); |
| 689 ASSERT_TRUE(Connect()); | 668 ASSERT_TRUE(Connect()); |
| 690 } | 669 } |
| 691 | 670 |
| 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 | |
| 699 // Connect with DTLS, negotiate DTLS-SRTP, and transfer SRTP using bypass. | 671 // Connect with DTLS, negotiate DTLS-SRTP, and transfer SRTP using bypass. |
| 700 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsSrtp) { | 672 TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtp) { |
| 701 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 673 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 702 PrepareDtls(true, true, rtc::KT_DEFAULT); | 674 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 703 PrepareDtlsSrtp(true, true); | 675 PrepareDtlsSrtp(true, true); |
| 704 ASSERT_TRUE(Connect()); | 676 ASSERT_TRUE(Connect()); |
| 705 TestTransfer(0, 1000, 100, true); | 677 TestTransfer(0, 1000, 100, true); |
| 706 } | 678 } |
| 707 | 679 |
| 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 | |
| 717 // Connect with DTLS-SRTP, transfer an invalid SRTP packet, and expects -1 | 680 // Connect with DTLS-SRTP, transfer an invalid SRTP packet, and expects -1 |
| 718 // returned. | 681 // returned. |
| 719 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsInvalidSrtpPacket) { | 682 TEST_F(DtlsTransportChannelTest, TestTransferDtlsInvalidSrtpPacket) { |
| 720 MAYBE_SKIP_TEST(HaveDtls); | 683 MAYBE_SKIP_TEST(HaveDtls); |
| 721 PrepareDtls(true, true, rtc::KT_DEFAULT); | 684 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 722 PrepareDtlsSrtp(true, true); | 685 PrepareDtlsSrtp(true, true); |
| 723 ASSERT_TRUE(Connect()); | 686 ASSERT_TRUE(Connect()); |
| 724 int result = client1_.SendInvalidSrtpPacket(0, 100); | 687 int result = client1_.SendInvalidSrtpPacket(0, 100); |
| 725 ASSERT_EQ(-1, result); | 688 ASSERT_EQ(-1, result); |
| 726 } | 689 } |
| 727 | 690 |
| 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 | |
| 735 // Connect with DTLS. A does DTLS-SRTP but B does not. | 691 // Connect with DTLS. A does DTLS-SRTP but B does not. |
| 736 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsSrtpRejected) { | 692 TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpRejected) { |
| 737 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 693 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 738 PrepareDtls(true, true, rtc::KT_DEFAULT); | 694 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 739 PrepareDtlsSrtp(true, false); | 695 PrepareDtlsSrtp(true, false); |
| 740 ASSERT_TRUE(Connect()); | 696 ASSERT_TRUE(Connect()); |
| 741 } | 697 } |
| 742 | 698 |
| 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 | |
| 751 // Connect with DTLS. B does DTLS-SRTP but A does not. | 699 // Connect with DTLS. B does DTLS-SRTP but A does not. |
| 752 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsSrtpNotOffered) { | 700 TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpNotOffered) { |
| 753 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 701 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 754 PrepareDtls(true, true, rtc::KT_DEFAULT); | 702 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 755 PrepareDtlsSrtp(false, true); | 703 PrepareDtlsSrtp(false, true); |
| 756 ASSERT_TRUE(Connect()); | 704 ASSERT_TRUE(Connect()); |
| 757 } | 705 } |
| 758 | 706 |
| 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 | |
| 767 // Create two channels with DTLS, negotiate DTLS-SRTP, and transfer bypass SRTP. | 707 // Create two channels with DTLS, negotiate DTLS-SRTP, and transfer bypass SRTP. |
| 768 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsSrtpTwoChannels) { | 708 TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpTwoChannels) { |
| 769 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 709 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 770 SetChannelCount(2); | 710 SetChannelCount(2); |
| 771 PrepareDtls(true, true, rtc::KT_DEFAULT); | 711 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 772 PrepareDtlsSrtp(true, true); | 712 PrepareDtlsSrtp(true, true); |
| 773 ASSERT_TRUE(Connect()); | 713 ASSERT_TRUE(Connect()); |
| 774 TestTransfer(0, 1000, 100, true); | 714 TestTransfer(0, 1000, 100, true); |
| 775 TestTransfer(1, 1000, 100, true); | 715 TestTransfer(1, 1000, 100, true); |
| 776 } | 716 } |
| 777 | 717 |
| 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 | |
| 785 // Create a single channel with DTLS, and send normal data and SRTP data on it. | 718 // Create a single channel with DTLS, and send normal data and SRTP data on it. |
| 786 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsSrtpDemux) { | 719 TEST_F(DtlsTransportChannelTest, TestTransferDtlsSrtpDemux) { |
| 787 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 720 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 788 PrepareDtls(true, true, rtc::KT_DEFAULT); | 721 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 789 PrepareDtlsSrtp(true, true); | 722 PrepareDtlsSrtp(true, true); |
| 790 ASSERT_TRUE(Connect()); | 723 ASSERT_TRUE(Connect()); |
| 791 TestTransfer(0, 1000, 100, false); | 724 TestTransfer(0, 1000, 100, false); |
| 792 TestTransfer(0, 1000, 100, true); | 725 TestTransfer(0, 1000, 100, true); |
| 793 } | 726 } |
| 794 | 727 |
| 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 | |
| 804 // Testing when the remote is passive. | 728 // Testing when the remote is passive. |
| 805 TEST_F(DtlsTransportChannelTest, MAYBE_TestTransferDtlsAnswererIsPassive) { | 729 TEST_F(DtlsTransportChannelTest, TestTransferDtlsAnswererIsPassive) { |
| 806 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 730 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 807 SetChannelCount(2); | 731 SetChannelCount(2); |
| 808 PrepareDtls(true, true, rtc::KT_DEFAULT); | 732 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 809 PrepareDtlsSrtp(true, true); | 733 PrepareDtlsSrtp(true, true); |
| 810 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, | 734 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
| 811 cricket::CONNECTIONROLE_PASSIVE)); | 735 cricket::CONNECTIONROLE_PASSIVE)); |
| 812 TestTransfer(0, 1000, 100, true); | 736 TestTransfer(0, 1000, 100, true); |
| 813 TestTransfer(1, 1000, 100, true); | 737 TestTransfer(1, 1000, 100, true); |
| 814 } | 738 } |
| 815 | 739 |
| 816 // Testing with the legacy DTLS client which doesn't use setup attribute. | 740 // Testing with the legacy DTLS client which doesn't use setup attribute. |
| 817 // In this case legacy is the answerer. | 741 // In this case legacy is the answerer. |
| 818 TEST_F(DtlsTransportChannelTest, TestDtlsSetupWithLegacyAsAnswerer) { | 742 TEST_F(DtlsTransportChannelTest, TestDtlsSetupWithLegacyAsAnswerer) { |
| 819 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 743 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 820 PrepareDtls(true, true, rtc::KT_DEFAULT); | 744 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 821 NegotiateWithLegacy(); | 745 NegotiateWithLegacy(); |
| 822 rtc::SSLRole channel1_role; | 746 rtc::SSLRole channel1_role; |
| 823 rtc::SSLRole channel2_role; | 747 rtc::SSLRole channel2_role; |
| 824 EXPECT_TRUE(client1_.transport()->GetSslRole(&channel1_role)); | 748 EXPECT_TRUE(client1_.transport()->GetSslRole(&channel1_role)); |
| 825 EXPECT_TRUE(client2_.transport()->GetSslRole(&channel2_role)); | 749 EXPECT_TRUE(client2_.transport()->GetSslRole(&channel2_role)); |
| 826 EXPECT_EQ(rtc::SSL_SERVER, channel1_role); | 750 EXPECT_EQ(rtc::SSL_SERVER, channel1_role); |
| 827 EXPECT_EQ(rtc::SSL_CLIENT, channel2_role); | 751 EXPECT_EQ(rtc::SSL_CLIENT, channel2_role); |
| 828 } | 752 } |
| 829 | 753 |
| 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 | |
| 837 // Testing re offer/answer after the session is estbalished. Roles will be | 754 // Testing re offer/answer after the session is estbalished. Roles will be |
| 838 // kept same as of the previous negotiation. | 755 // kept same as of the previous negotiation. |
| 839 TEST_F(DtlsTransportChannelTest, MAYBE_TestDtlsReOfferFromOfferer) { | 756 TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromOfferer) { |
| 840 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 757 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 841 SetChannelCount(2); | 758 SetChannelCount(2); |
| 842 PrepareDtls(true, true, rtc::KT_DEFAULT); | 759 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 843 PrepareDtlsSrtp(true, true); | 760 PrepareDtlsSrtp(true, true); |
| 844 // Initial role for client1 is ACTPASS and client2 is ACTIVE. | 761 // Initial role for client1 is ACTPASS and client2 is ACTIVE. |
| 845 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, | 762 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
| 846 cricket::CONNECTIONROLE_ACTIVE)); | 763 cricket::CONNECTIONROLE_ACTIVE)); |
| 847 TestTransfer(0, 1000, 100, true); | 764 TestTransfer(0, 1000, 100, true); |
| 848 TestTransfer(1, 1000, 100, true); | 765 TestTransfer(1, 1000, 100, true); |
| 849 // Using input roles for the re-offer. | 766 // Using input roles for the re-offer. |
| 850 Renegotiate(&client1_, cricket::CONNECTIONROLE_ACTPASS, | 767 Renegotiate(&client1_, cricket::CONNECTIONROLE_ACTPASS, |
| 851 cricket::CONNECTIONROLE_ACTIVE, NF_REOFFER); | 768 cricket::CONNECTIONROLE_ACTIVE, NF_REOFFER); |
| 852 TestTransfer(0, 1000, 100, true); | 769 TestTransfer(0, 1000, 100, true); |
| 853 TestTransfer(1, 1000, 100, true); | 770 TestTransfer(1, 1000, 100, true); |
| 854 } | 771 } |
| 855 | 772 |
| 856 #if defined(MEMORY_SANITIZER) | 773 TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromAnswerer) { |
| 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) { | |
| 864 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 774 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 865 SetChannelCount(2); | 775 SetChannelCount(2); |
| 866 PrepareDtls(true, true, rtc::KT_DEFAULT); | 776 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 867 PrepareDtlsSrtp(true, true); | 777 PrepareDtlsSrtp(true, true); |
| 868 // Initial role for client1 is ACTPASS and client2 is ACTIVE. | 778 // Initial role for client1 is ACTPASS and client2 is ACTIVE. |
| 869 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, | 779 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
| 870 cricket::CONNECTIONROLE_ACTIVE)); | 780 cricket::CONNECTIONROLE_ACTIVE)); |
| 871 TestTransfer(0, 1000, 100, true); | 781 TestTransfer(0, 1000, 100, true); |
| 872 TestTransfer(1, 1000, 100, true); | 782 TestTransfer(1, 1000, 100, true); |
| 873 // Using input roles for the re-offer. | 783 // Using input roles for the re-offer. |
| 874 Renegotiate(&client2_, cricket::CONNECTIONROLE_PASSIVE, | 784 Renegotiate(&client2_, cricket::CONNECTIONROLE_PASSIVE, |
| 875 cricket::CONNECTIONROLE_ACTPASS, NF_REOFFER); | 785 cricket::CONNECTIONROLE_ACTPASS, NF_REOFFER); |
| 876 TestTransfer(0, 1000, 100, true); | 786 TestTransfer(0, 1000, 100, true); |
| 877 TestTransfer(1, 1000, 100, true); | 787 TestTransfer(1, 1000, 100, true); |
| 878 } | 788 } |
| 879 | 789 |
| 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 | |
| 887 // Test that any change in role after the intial setup will result in failure. | 790 // Test that any change in role after the intial setup will result in failure. |
| 888 TEST_F(DtlsTransportChannelTest, MAYBE_TestDtlsRoleReversal) { | 791 TEST_F(DtlsTransportChannelTest, TestDtlsRoleReversal) { |
| 889 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 792 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 890 SetChannelCount(2); | 793 SetChannelCount(2); |
| 891 PrepareDtls(true, true, rtc::KT_DEFAULT); | 794 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 892 PrepareDtlsSrtp(true, true); | 795 PrepareDtlsSrtp(true, true); |
| 893 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, | 796 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
| 894 cricket::CONNECTIONROLE_PASSIVE)); | 797 cricket::CONNECTIONROLE_PASSIVE)); |
| 895 | 798 |
| 896 // Renegotiate from client2 with actpass and client1 as active. | 799 // Renegotiate from client2 with actpass and client1 as active. |
| 897 Renegotiate(&client2_, cricket::CONNECTIONROLE_ACTPASS, | 800 Renegotiate(&client2_, cricket::CONNECTIONROLE_ACTPASS, |
| 898 cricket::CONNECTIONROLE_ACTIVE, | 801 cricket::CONNECTIONROLE_ACTIVE, |
| 899 NF_REOFFER | NF_EXPECT_FAILURE); | 802 NF_REOFFER | NF_EXPECT_FAILURE); |
| 900 } | 803 } |
| 901 | 804 |
| 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 | |
| 911 // Test that using different setup attributes which results in similar ssl | 805 // Test that using different setup attributes which results in similar ssl |
| 912 // role as the initial negotiation will result in success. | 806 // role as the initial negotiation will result in success. |
| 913 TEST_F(DtlsTransportChannelTest, MAYBE_TestDtlsReOfferWithDifferentSetupAttr) { | 807 TEST_F(DtlsTransportChannelTest, TestDtlsReOfferWithDifferentSetupAttr) { |
| 914 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 808 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 915 SetChannelCount(2); | 809 SetChannelCount(2); |
| 916 PrepareDtls(true, true, rtc::KT_DEFAULT); | 810 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 917 PrepareDtlsSrtp(true, true); | 811 PrepareDtlsSrtp(true, true); |
| 918 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, | 812 ASSERT_TRUE(Connect(cricket::CONNECTIONROLE_ACTPASS, |
| 919 cricket::CONNECTIONROLE_PASSIVE)); | 813 cricket::CONNECTIONROLE_PASSIVE)); |
| 920 // Renegotiate from client2 with actpass and client1 as active. | 814 // Renegotiate from client2 with actpass and client1 as active. |
| 921 Renegotiate(&client2_, cricket::CONNECTIONROLE_ACTIVE, | 815 Renegotiate(&client2_, cricket::CONNECTIONROLE_ACTIVE, |
| 922 cricket::CONNECTIONROLE_ACTPASS, NF_REOFFER); | 816 cricket::CONNECTIONROLE_ACTPASS, NF_REOFFER); |
| 923 TestTransfer(0, 1000, 100, true); | 817 TestTransfer(0, 1000, 100, true); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), | 857 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), |
| 964 certificate2->ssl_certificate().ToPEMString()); | 858 certificate2->ssl_certificate().ToPEMString()); |
| 965 ASSERT_FALSE( | 859 ASSERT_FALSE( |
| 966 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); | 860 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); |
| 967 ASSERT_FALSE(remote_cert1 != NULL); | 861 ASSERT_FALSE(remote_cert1 != NULL); |
| 968 ASSERT_FALSE( | 862 ASSERT_FALSE( |
| 969 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); | 863 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); |
| 970 ASSERT_FALSE(remote_cert2 != NULL); | 864 ASSERT_FALSE(remote_cert2 != NULL); |
| 971 } | 865 } |
| 972 | 866 |
| 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 | |
| 980 // Test Certificates state after connection. | 867 // Test Certificates state after connection. |
| 981 TEST_F(DtlsTransportChannelTest, MAYBE_TestCertificatesAfterConnect) { | 868 TEST_F(DtlsTransportChannelTest, TestCertificatesAfterConnect) { |
| 982 MAYBE_SKIP_TEST(HaveDtls); | 869 MAYBE_SKIP_TEST(HaveDtls); |
| 983 PrepareDtls(true, true, rtc::KT_DEFAULT); | 870 PrepareDtls(true, true, rtc::KT_DEFAULT); |
| 984 ASSERT_TRUE(Connect()); | 871 ASSERT_TRUE(Connect()); |
| 985 | 872 |
| 986 rtc::scoped_refptr<rtc::RTCCertificate> certificate1; | 873 rtc::scoped_refptr<rtc::RTCCertificate> certificate1; |
| 987 rtc::scoped_refptr<rtc::RTCCertificate> certificate2; | 874 rtc::scoped_refptr<rtc::RTCCertificate> certificate2; |
| 988 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert1; | 875 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert1; |
| 989 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert2; | 876 rtc::scoped_ptr<rtc::SSLCertificate> remote_cert2; |
| 990 | 877 |
| 991 // After connection, each side has a distinct local certificate. | 878 // After connection, each side has a distinct local certificate. |
| 992 ASSERT_TRUE(client1_.transport()->GetLocalCertificate(&certificate1)); | 879 ASSERT_TRUE(client1_.transport()->GetLocalCertificate(&certificate1)); |
| 993 ASSERT_TRUE(client2_.transport()->GetLocalCertificate(&certificate2)); | 880 ASSERT_TRUE(client2_.transport()->GetLocalCertificate(&certificate2)); |
| 994 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), | 881 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), |
| 995 certificate2->ssl_certificate().ToPEMString()); | 882 certificate2->ssl_certificate().ToPEMString()); |
| 996 | 883 |
| 997 // Each side's remote certificate is the other side's local certificate. | 884 // Each side's remote certificate is the other side's local certificate. |
| 998 ASSERT_TRUE( | 885 ASSERT_TRUE( |
| 999 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); | 886 client1_.transport()->GetRemoteSSLCertificate(remote_cert1.accept())); |
| 1000 ASSERT_EQ(remote_cert1->ToPEMString(), | 887 ASSERT_EQ(remote_cert1->ToPEMString(), |
| 1001 certificate2->ssl_certificate().ToPEMString()); | 888 certificate2->ssl_certificate().ToPEMString()); |
| 1002 ASSERT_TRUE( | 889 ASSERT_TRUE( |
| 1003 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); | 890 client2_.transport()->GetRemoteSSLCertificate(remote_cert2.accept())); |
| 1004 ASSERT_EQ(remote_cert2->ToPEMString(), | 891 ASSERT_EQ(remote_cert2->ToPEMString(), |
| 1005 certificate1->ssl_certificate().ToPEMString()); | 892 certificate1->ssl_certificate().ToPEMString()); |
| 1006 } | 893 } |
| OLD | NEW |