Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: webrtc/api/webrtcsession_unittest.cc

Issue 2648003003: Revert of Removing #defines previously used for building without BoringSSL/OpenSSL. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/test/peerconnectiontestwrapper.cc ('k') | webrtc/base/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "webrtc/media/engine/fakewebrtccall.h" 43 #include "webrtc/media/engine/fakewebrtccall.h"
44 #include "webrtc/media/sctp/sctptransportinternal.h" 44 #include "webrtc/media/sctp/sctptransportinternal.h"
45 #include "webrtc/p2p/base/packettransportinterface.h" 45 #include "webrtc/p2p/base/packettransportinterface.h"
46 #include "webrtc/p2p/base/stunserver.h" 46 #include "webrtc/p2p/base/stunserver.h"
47 #include "webrtc/p2p/base/teststunserver.h" 47 #include "webrtc/p2p/base/teststunserver.h"
48 #include "webrtc/p2p/base/testturnserver.h" 48 #include "webrtc/p2p/base/testturnserver.h"
49 #include "webrtc/p2p/client/basicportallocator.h" 49 #include "webrtc/p2p/client/basicportallocator.h"
50 #include "webrtc/pc/channelmanager.h" 50 #include "webrtc/pc/channelmanager.h"
51 #include "webrtc/pc/mediasession.h" 51 #include "webrtc/pc/mediasession.h"
52 52
53 #define MAYBE_SKIP_TEST(feature) \
54 if (!(feature())) { \
55 LOG(LS_INFO) << "Feature disabled... skipping"; \
56 return; \
57 }
58
53 using cricket::FakeVoiceMediaChannel; 59 using cricket::FakeVoiceMediaChannel;
54 using cricket::TransportInfo; 60 using cricket::TransportInfo;
55 using rtc::SocketAddress; 61 using rtc::SocketAddress;
56 using rtc::Thread; 62 using rtc::Thread;
57 using webrtc::CreateSessionDescription; 63 using webrtc::CreateSessionDescription;
58 using webrtc::CreateSessionDescriptionObserver; 64 using webrtc::CreateSessionDescriptionObserver;
59 using webrtc::CreateSessionDescriptionRequest; 65 using webrtc::CreateSessionDescriptionRequest;
60 using webrtc::DataChannel; 66 using webrtc::DataChannel;
61 using webrtc::FakeMetricsObserver; 67 using webrtc::FakeMetricsObserver;
62 using webrtc::IceCandidateCollection; 68 using webrtc::IceCandidateCollection;
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 CreateCryptoOfferAndNonCryptoAnswer(&offer, &answer); 1843 CreateCryptoOfferAndNonCryptoAnswer(&offer, &answer);
1838 // SetRemoteDescription and SetLocalDescription will take the ownership of 1844 // SetRemoteDescription and SetLocalDescription will take the ownership of
1839 // the offer. 1845 // the offer.
1840 SetLocalDescriptionWithoutError(offer); 1846 SetLocalDescriptionWithoutError(offer);
1841 SetRemoteDescriptionAnswerExpectError(kSdpWithoutSdesCrypto, answer); 1847 SetRemoteDescriptionAnswerExpectError(kSdpWithoutSdesCrypto, answer);
1842 } 1848 }
1843 1849
1844 // Test that we accept an offer with a DTLS fingerprint when DTLS is on 1850 // Test that we accept an offer with a DTLS fingerprint when DTLS is on
1845 // and that we return an answer with a DTLS fingerprint. 1851 // and that we return an answer with a DTLS fingerprint.
1846 TEST_P(WebRtcSessionTest, TestReceiveDtlsOfferCreateDtlsAnswer) { 1852 TEST_P(WebRtcSessionTest, TestReceiveDtlsOfferCreateDtlsAnswer) {
1853 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1847 SendAudioVideoStream1(); 1854 SendAudioVideoStream1();
1848 InitWithDtls(GetParam()); 1855 InitWithDtls(GetParam());
1849 SetFactoryDtlsSrtp(); 1856 SetFactoryDtlsSrtp();
1850 cricket::MediaSessionOptions options; 1857 cricket::MediaSessionOptions options;
1851 options.recv_video = true; 1858 options.recv_video = true;
1852 JsepSessionDescription* offer = 1859 JsepSessionDescription* offer =
1853 CreateRemoteOffer(options, cricket::SEC_DISABLED); 1860 CreateRemoteOffer(options, cricket::SEC_DISABLED);
1854 ASSERT_TRUE(offer != NULL); 1861 ASSERT_TRUE(offer != NULL);
1855 VerifyFingerprintStatus(offer->description(), true); 1862 VerifyFingerprintStatus(offer->description(), true);
1856 VerifyNoCryptoParams(offer->description(), true); 1863 VerifyNoCryptoParams(offer->description(), true);
1857 1864
1858 // SetRemoteDescription will take the ownership of the offer. 1865 // SetRemoteDescription will take the ownership of the offer.
1859 SetRemoteDescriptionWithoutError(offer); 1866 SetRemoteDescriptionWithoutError(offer);
1860 1867
1861 // Verify that we get a crypto fingerprint in the answer. 1868 // Verify that we get a crypto fingerprint in the answer.
1862 SessionDescriptionInterface* answer = CreateAnswer(); 1869 SessionDescriptionInterface* answer = CreateAnswer();
1863 ASSERT_TRUE(answer != NULL); 1870 ASSERT_TRUE(answer != NULL);
1864 VerifyFingerprintStatus(answer->description(), true); 1871 VerifyFingerprintStatus(answer->description(), true);
1865 // Check that we don't have an a=crypto line in the answer. 1872 // Check that we don't have an a=crypto line in the answer.
1866 VerifyNoCryptoParams(answer->description(), true); 1873 VerifyNoCryptoParams(answer->description(), true);
1867 1874
1868 // Now set the local description, which should work, even without a=crypto. 1875 // Now set the local description, which should work, even without a=crypto.
1869 SetLocalDescriptionWithoutError(answer); 1876 SetLocalDescriptionWithoutError(answer);
1870 } 1877 }
1871 1878
1872 // Test that we set a local offer with a DTLS fingerprint when DTLS is on 1879 // Test that we set a local offer with a DTLS fingerprint when DTLS is on
1873 // and then we accept a remote answer with a DTLS fingerprint successfully. 1880 // and then we accept a remote answer with a DTLS fingerprint successfully.
1874 TEST_P(WebRtcSessionTest, TestCreateDtlsOfferReceiveDtlsAnswer) { 1881 TEST_P(WebRtcSessionTest, TestCreateDtlsOfferReceiveDtlsAnswer) {
1882 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1875 SendAudioVideoStream1(); 1883 SendAudioVideoStream1();
1876 InitWithDtls(GetParam()); 1884 InitWithDtls(GetParam());
1877 SetFactoryDtlsSrtp(); 1885 SetFactoryDtlsSrtp();
1878 1886
1879 // Verify that we get a crypto fingerprint in the answer. 1887 // Verify that we get a crypto fingerprint in the answer.
1880 SessionDescriptionInterface* offer = CreateOffer(); 1888 SessionDescriptionInterface* offer = CreateOffer();
1881 ASSERT_TRUE(offer != NULL); 1889 ASSERT_TRUE(offer != NULL);
1882 VerifyFingerprintStatus(offer->description(), true); 1890 VerifyFingerprintStatus(offer->description(), true);
1883 // Check that we don't have an a=crypto line in the offer. 1891 // Check that we don't have an a=crypto line in the offer.
1884 VerifyNoCryptoParams(offer->description(), true); 1892 VerifyNoCryptoParams(offer->description(), true);
1885 1893
1886 // Now set the local description, which should work, even without a=crypto. 1894 // Now set the local description, which should work, even without a=crypto.
1887 SetLocalDescriptionWithoutError(offer); 1895 SetLocalDescriptionWithoutError(offer);
1888 1896
1889 cricket::MediaSessionOptions options; 1897 cricket::MediaSessionOptions options;
1890 options.recv_video = true; 1898 options.recv_video = true;
1891 JsepSessionDescription* answer = 1899 JsepSessionDescription* answer =
1892 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED); 1900 CreateRemoteAnswer(offer, options, cricket::SEC_DISABLED);
1893 ASSERT_TRUE(answer != NULL); 1901 ASSERT_TRUE(answer != NULL);
1894 VerifyFingerprintStatus(answer->description(), true); 1902 VerifyFingerprintStatus(answer->description(), true);
1895 VerifyNoCryptoParams(answer->description(), true); 1903 VerifyNoCryptoParams(answer->description(), true);
1896 1904
1897 // SetRemoteDescription will take the ownership of the answer. 1905 // SetRemoteDescription will take the ownership of the answer.
1898 SetRemoteDescriptionWithoutError(answer); 1906 SetRemoteDescriptionWithoutError(answer);
1899 } 1907 }
1900 1908
1901 // Test that if we support DTLS and the other side didn't offer a fingerprint, 1909 // Test that if we support DTLS and the other side didn't offer a fingerprint,
1902 // we will fail to set the remote description. 1910 // we will fail to set the remote description.
1903 TEST_P(WebRtcSessionTest, TestReceiveNonDtlsOfferWhenDtlsOn) { 1911 TEST_P(WebRtcSessionTest, TestReceiveNonDtlsOfferWhenDtlsOn) {
1912 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1904 InitWithDtls(GetParam()); 1913 InitWithDtls(GetParam());
1905 cricket::MediaSessionOptions options; 1914 cricket::MediaSessionOptions options;
1906 options.recv_video = true; 1915 options.recv_video = true;
1907 options.bundle_enabled = true; 1916 options.bundle_enabled = true;
1908 JsepSessionDescription* offer = CreateRemoteOffer( 1917 JsepSessionDescription* offer = CreateRemoteOffer(
1909 options, cricket::SEC_REQUIRED); 1918 options, cricket::SEC_REQUIRED);
1910 ASSERT_TRUE(offer != NULL); 1919 ASSERT_TRUE(offer != NULL);
1911 VerifyFingerprintStatus(offer->description(), false); 1920 VerifyFingerprintStatus(offer->description(), false);
1912 VerifyCryptoParams(offer->description()); 1921 VerifyCryptoParams(offer->description());
1913 1922
1914 // SetRemoteDescription will take the ownership of the offer. 1923 // SetRemoteDescription will take the ownership of the offer.
1915 SetRemoteDescriptionOfferExpectError( 1924 SetRemoteDescriptionOfferExpectError(
1916 kSdpWithoutDtlsFingerprint, offer); 1925 kSdpWithoutDtlsFingerprint, offer);
1917 1926
1918 offer = CreateRemoteOffer(options, cricket::SEC_REQUIRED); 1927 offer = CreateRemoteOffer(options, cricket::SEC_REQUIRED);
1919 // SetLocalDescription will take the ownership of the offer. 1928 // SetLocalDescription will take the ownership of the offer.
1920 SetLocalDescriptionOfferExpectError( 1929 SetLocalDescriptionOfferExpectError(
1921 kSdpWithoutDtlsFingerprint, offer); 1930 kSdpWithoutDtlsFingerprint, offer);
1922 } 1931 }
1923 1932
1924 // Test that we return a failure when applying a local answer that doesn't have 1933 // Test that we return a failure when applying a local answer that doesn't have
1925 // a DTLS fingerprint when DTLS is required. 1934 // a DTLS fingerprint when DTLS is required.
1926 TEST_P(WebRtcSessionTest, TestSetLocalNonDtlsAnswerWhenDtlsOn) { 1935 TEST_P(WebRtcSessionTest, TestSetLocalNonDtlsAnswerWhenDtlsOn) {
1936 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1927 InitWithDtls(GetParam()); 1937 InitWithDtls(GetParam());
1928 SessionDescriptionInterface* offer = NULL; 1938 SessionDescriptionInterface* offer = NULL;
1929 SessionDescriptionInterface* answer = NULL; 1939 SessionDescriptionInterface* answer = NULL;
1930 CreateDtlsOfferAndNonDtlsAnswer(&offer, &answer); 1940 CreateDtlsOfferAndNonDtlsAnswer(&offer, &answer);
1931 1941
1932 // SetRemoteDescription and SetLocalDescription will take the ownership of 1942 // SetRemoteDescription and SetLocalDescription will take the ownership of
1933 // the offer and answer. 1943 // the offer and answer.
1934 SetRemoteDescriptionWithoutError(offer); 1944 SetRemoteDescriptionWithoutError(offer);
1935 SetLocalDescriptionAnswerExpectError( 1945 SetLocalDescriptionAnswerExpectError(
1936 kSdpWithoutDtlsFingerprint, answer); 1946 kSdpWithoutDtlsFingerprint, answer);
1937 } 1947 }
1938 1948
1939 // Test that we return a failure when applying a remote answer that doesn't have 1949 // Test that we return a failure when applying a remote answer that doesn't have
1940 // a DTLS fingerprint when DTLS is required. 1950 // a DTLS fingerprint when DTLS is required.
1941 TEST_P(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) { 1951 TEST_P(WebRtcSessionTest, TestSetRemoteNonDtlsAnswerWhenDtlsOn) {
1952 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1942 InitWithDtls(GetParam()); 1953 InitWithDtls(GetParam());
1943 SessionDescriptionInterface* offer = CreateOffer(); 1954 SessionDescriptionInterface* offer = CreateOffer();
1944 cricket::MediaSessionOptions options; 1955 cricket::MediaSessionOptions options;
1945 options.recv_video = true; 1956 options.recv_video = true;
1946 std::unique_ptr<SessionDescriptionInterface> temp_offer( 1957 std::unique_ptr<SessionDescriptionInterface> temp_offer(
1947 CreateRemoteOffer(options, cricket::SEC_ENABLED)); 1958 CreateRemoteOffer(options, cricket::SEC_ENABLED));
1948 JsepSessionDescription* answer = 1959 JsepSessionDescription* answer =
1949 CreateRemoteAnswer(temp_offer.get(), options, cricket::SEC_ENABLED); 1960 CreateRemoteAnswer(temp_offer.get(), options, cricket::SEC_ENABLED);
1950 1961
1951 // SetRemoteDescription and SetLocalDescription will take the ownership of 1962 // SetRemoteDescription and SetLocalDescription will take the ownership of
(...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after
3908 3919
3909 TEST_F(WebRtcSessionTest, TestRtpDataChannel) { 3920 TEST_F(WebRtcSessionTest, TestRtpDataChannel) {
3910 configuration_.enable_rtp_data_channel = true; 3921 configuration_.enable_rtp_data_channel = true;
3911 Init(); 3922 Init();
3912 SetLocalDescriptionWithDataChannel(); 3923 SetLocalDescriptionWithDataChannel();
3913 ASSERT_TRUE(data_engine_); 3924 ASSERT_TRUE(data_engine_);
3914 EXPECT_NE(nullptr, data_engine_->GetChannel(0)); 3925 EXPECT_NE(nullptr, data_engine_->GetChannel(0));
3915 } 3926 }
3916 3927
3917 TEST_P(WebRtcSessionTest, TestRtpDataChannelConstraintTakesPrecedence) { 3928 TEST_P(WebRtcSessionTest, TestRtpDataChannelConstraintTakesPrecedence) {
3929 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
3930
3918 configuration_.enable_rtp_data_channel = true; 3931 configuration_.enable_rtp_data_channel = true;
3919 options_.disable_sctp_data_channels = false; 3932 options_.disable_sctp_data_channels = false;
3920 3933
3921 InitWithDtls(GetParam()); 3934 InitWithDtls(GetParam());
3922 3935
3923 SetLocalDescriptionWithDataChannel(); 3936 SetLocalDescriptionWithDataChannel();
3924 EXPECT_NE(nullptr, data_engine_->GetChannel(0)); 3937 EXPECT_NE(nullptr, data_engine_->GetChannel(0));
3925 } 3938 }
3926 3939
3927 // Test that sctp_content_name/sctp_transport_name (used for stats) are correct 3940 // Test that sctp_content_name/sctp_transport_name (used for stats) are correct
3928 // before and after BUNDLE is negotiated. 3941 // before and after BUNDLE is negotiated.
3929 TEST_P(WebRtcSessionTest, SctpContentAndTransportName) { 3942 TEST_P(WebRtcSessionTest, SctpContentAndTransportName) {
3943 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
3930 SetFactoryDtlsSrtp(); 3944 SetFactoryDtlsSrtp();
3931 InitWithDtls(GetParam()); 3945 InitWithDtls(GetParam());
3932 3946
3933 // Initially these fields should be empty. 3947 // Initially these fields should be empty.
3934 EXPECT_FALSE(session_->sctp_content_name()); 3948 EXPECT_FALSE(session_->sctp_content_name());
3935 EXPECT_FALSE(session_->sctp_transport_name()); 3949 EXPECT_FALSE(session_->sctp_transport_name());
3936 3950
3937 // Create offer with audio/video/data. 3951 // Create offer with audio/video/data.
3938 // Default bundle policy is "balanced", so data should be using its own 3952 // Default bundle policy is "balanced", so data should be using its own
3939 // transport. 3953 // transport.
(...skipping 13 matching lines...) Expand all
3953 answer_options.data_channel_type = cricket::DCT_SCTP; 3967 answer_options.data_channel_type = cricket::DCT_SCTP;
3954 SetRemoteDescriptionWithoutError(CreateRemoteAnswer( 3968 SetRemoteDescriptionWithoutError(CreateRemoteAnswer(
3955 session_->local_description(), answer_options, cricket::SEC_DISABLED)); 3969 session_->local_description(), answer_options, cricket::SEC_DISABLED));
3956 ASSERT_TRUE(session_->sctp_content_name()); 3970 ASSERT_TRUE(session_->sctp_content_name());
3957 ASSERT_TRUE(session_->sctp_transport_name()); 3971 ASSERT_TRUE(session_->sctp_transport_name());
3958 EXPECT_EQ("data", *session_->sctp_content_name()); 3972 EXPECT_EQ("data", *session_->sctp_content_name());
3959 EXPECT_EQ("audio", *session_->sctp_transport_name()); 3973 EXPECT_EQ("audio", *session_->sctp_transport_name());
3960 } 3974 }
3961 3975
3962 TEST_P(WebRtcSessionTest, TestCreateOfferWithSctpEnabledWithoutStreams) { 3976 TEST_P(WebRtcSessionTest, TestCreateOfferWithSctpEnabledWithoutStreams) {
3977 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
3978
3963 InitWithDtls(GetParam()); 3979 InitWithDtls(GetParam());
3964 3980
3965 std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer()); 3981 std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
3966 EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL); 3982 EXPECT_TRUE(offer->description()->GetContentByName("data") == NULL);
3967 EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL); 3983 EXPECT_TRUE(offer->description()->GetTransportInfoByName("data") == NULL);
3968 } 3984 }
3969 3985
3970 TEST_P(WebRtcSessionTest, TestCreateAnswerWithSctpInOfferAndNoStreams) { 3986 TEST_P(WebRtcSessionTest, TestCreateAnswerWithSctpInOfferAndNoStreams) {
3987 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
3971 SetFactoryDtlsSrtp(); 3988 SetFactoryDtlsSrtp();
3972 InitWithDtls(GetParam()); 3989 InitWithDtls(GetParam());
3973 3990
3974 // Create remote offer with SCTP. 3991 // Create remote offer with SCTP.
3975 cricket::MediaSessionOptions options; 3992 cricket::MediaSessionOptions options;
3976 options.data_channel_type = cricket::DCT_SCTP; 3993 options.data_channel_type = cricket::DCT_SCTP;
3977 JsepSessionDescription* offer = 3994 JsepSessionDescription* offer =
3978 CreateRemoteOffer(options, cricket::SEC_DISABLED); 3995 CreateRemoteOffer(options, cricket::SEC_DISABLED);
3979 SetRemoteDescriptionWithoutError(offer); 3996 SetRemoteDescriptionWithoutError(offer);
3980 3997
(...skipping 11 matching lines...) Expand all
3992 InitWithDtls(GetParam()); 4009 InitWithDtls(GetParam());
3993 4010
3994 SetLocalDescriptionWithDataChannel(); 4011 SetLocalDescriptionWithDataChannel();
3995 EXPECT_EQ(nullptr, data_engine_->GetChannel(0)); 4012 EXPECT_EQ(nullptr, data_engine_->GetChannel(0));
3996 EXPECT_EQ(nullptr, fake_sctp_transport_factory_->last_fake_sctp_transport()); 4013 EXPECT_EQ(nullptr, fake_sctp_transport_factory_->last_fake_sctp_transport());
3997 } 4014 }
3998 4015
3999 // Test that if DTLS is enabled, we end up with an SctpTransport created 4016 // Test that if DTLS is enabled, we end up with an SctpTransport created
4000 // (and not an RtpDataChannel). 4017 // (and not an RtpDataChannel).
4001 TEST_P(WebRtcSessionTest, TestSctpDataChannelWithDtls) { 4018 TEST_P(WebRtcSessionTest, TestSctpDataChannelWithDtls) {
4019 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4020
4002 InitWithDtls(GetParam()); 4021 InitWithDtls(GetParam());
4003 4022
4004 SetLocalDescriptionWithDataChannel(); 4023 SetLocalDescriptionWithDataChannel();
4005 EXPECT_EQ(nullptr, data_engine_->GetChannel(0)); 4024 EXPECT_EQ(nullptr, data_engine_->GetChannel(0));
4006 EXPECT_NE(nullptr, fake_sctp_transport_factory_->last_fake_sctp_transport()); 4025 EXPECT_NE(nullptr, fake_sctp_transport_factory_->last_fake_sctp_transport());
4007 } 4026 }
4008 4027
4009 // Test that if SCTP is disabled, we don't end up with an SctpTransport 4028 // Test that if SCTP is disabled, we don't end up with an SctpTransport
4010 // created (or an RtpDataChannel). 4029 // created (or an RtpDataChannel).
4011 TEST_P(WebRtcSessionTest, TestDisableSctpDataChannels) { 4030 TEST_P(WebRtcSessionTest, TestDisableSctpDataChannels) {
4031 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4012 options_.disable_sctp_data_channels = true; 4032 options_.disable_sctp_data_channels = true;
4013 InitWithDtls(GetParam()); 4033 InitWithDtls(GetParam());
4014 4034
4015 SetLocalDescriptionWithDataChannel(); 4035 SetLocalDescriptionWithDataChannel();
4016 EXPECT_EQ(nullptr, data_engine_->GetChannel(0)); 4036 EXPECT_EQ(nullptr, data_engine_->GetChannel(0));
4017 EXPECT_EQ(nullptr, fake_sctp_transport_factory_->last_fake_sctp_transport()); 4037 EXPECT_EQ(nullptr, fake_sctp_transport_factory_->last_fake_sctp_transport());
4018 } 4038 }
4019 4039
4020 TEST_P(WebRtcSessionTest, TestSctpDataChannelSendPortParsing) { 4040 TEST_P(WebRtcSessionTest, TestSctpDataChannelSendPortParsing) {
4041 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4021 const int new_send_port = 9998; 4042 const int new_send_port = 9998;
4022 const int new_recv_port = 7775; 4043 const int new_recv_port = 7775;
4023 4044
4024 InitWithDtls(GetParam()); 4045 InitWithDtls(GetParam());
4025 SetFactoryDtlsSrtp(); 4046 SetFactoryDtlsSrtp();
4026 4047
4027 // By default, don't actually add the codecs to desc_factory_; they don't 4048 // By default, don't actually add the codecs to desc_factory_; they don't
4028 // actually get serialized for SCTP in BuildMediaDescription(). Instead, 4049 // actually get serialized for SCTP in BuildMediaDescription(). Instead,
4029 // let the session description get parsed. That'll get the proper codecs 4050 // let the session description get parsed. That'll get the proper codecs
4030 // into the stream. 4051 // into the stream.
(...skipping 21 matching lines...) Expand all
4052 fake_sctp_transport_factory_->last_fake_sctp_transport()->local_port()); 4073 fake_sctp_transport_factory_->last_fake_sctp_transport()->local_port());
4053 EXPECT_EQ( 4074 EXPECT_EQ(
4054 new_send_port, 4075 new_send_port,
4055 fake_sctp_transport_factory_->last_fake_sctp_transport()->remote_port()); 4076 fake_sctp_transport_factory_->last_fake_sctp_transport()->remote_port());
4056 } 4077 }
4057 4078
4058 // Verifies that when a session's SctpTransport receives an OPEN message, 4079 // Verifies that when a session's SctpTransport receives an OPEN message,
4059 // WebRtcSession signals the SctpTransport creation request with the expected 4080 // WebRtcSession signals the SctpTransport creation request with the expected
4060 // config. 4081 // config.
4061 TEST_P(WebRtcSessionTest, TestSctpDataChannelOpenMessage) { 4082 TEST_P(WebRtcSessionTest, TestSctpDataChannelOpenMessage) {
4083 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4084
4062 InitWithDtls(GetParam()); 4085 InitWithDtls(GetParam());
4063 4086
4064 SetLocalDescriptionWithDataChannel(); 4087 SetLocalDescriptionWithDataChannel();
4065 EXPECT_EQ(nullptr, data_engine_->GetChannel(0)); 4088 EXPECT_EQ(nullptr, data_engine_->GetChannel(0));
4066 ASSERT_NE(nullptr, fake_sctp_transport_factory_->last_fake_sctp_transport()); 4089 ASSERT_NE(nullptr, fake_sctp_transport_factory_->last_fake_sctp_transport());
4067 4090
4068 // Make the fake SCTP transport pretend it received an OPEN message. 4091 // Make the fake SCTP transport pretend it received an OPEN message.
4069 webrtc::DataChannelInit config; 4092 webrtc::DataChannelInit config;
4070 config.id = 1; 4093 config.id = 1;
4071 rtc::CopyOnWriteBuffer payload; 4094 rtc::CopyOnWriteBuffer payload;
(...skipping 19 matching lines...) Expand all
4091 Init(); 4114 Init();
4092 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000); 4115 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000);
4093 4116
4094 EXPECT_EQ(session_->certificate_for_testing(), certificate); 4117 EXPECT_EQ(session_->certificate_for_testing(), certificate);
4095 } 4118 }
4096 4119
4097 // Verifies that CreateOffer succeeds when CreateOffer is called before async 4120 // Verifies that CreateOffer succeeds when CreateOffer is called before async
4098 // identity generation is finished (even if a certificate is provided this is 4121 // identity generation is finished (even if a certificate is provided this is
4099 // an async op). 4122 // an async op).
4100 TEST_P(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) { 4123 TEST_P(WebRtcSessionTest, TestCreateOfferBeforeIdentityRequestReturnSuccess) {
4124 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4101 InitWithDtls(GetParam()); 4125 InitWithDtls(GetParam());
4102 4126
4103 EXPECT_TRUE(session_->waiting_for_certificate_for_testing()); 4127 EXPECT_TRUE(session_->waiting_for_certificate_for_testing());
4104 SendAudioVideoStream1(); 4128 SendAudioVideoStream1();
4105 std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer()); 4129 std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
4106 4130
4107 EXPECT_TRUE(offer != NULL); 4131 EXPECT_TRUE(offer != NULL);
4108 VerifyNoCryptoParams(offer->description(), true); 4132 VerifyNoCryptoParams(offer->description(), true);
4109 VerifyFingerprintStatus(offer->description(), true); 4133 VerifyFingerprintStatus(offer->description(), true);
4110 } 4134 }
4111 4135
4112 // Verifies that CreateAnswer succeeds when CreateOffer is called before async 4136 // Verifies that CreateAnswer succeeds when CreateOffer is called before async
4113 // identity generation is finished (even if a certificate is provided this is 4137 // identity generation is finished (even if a certificate is provided this is
4114 // an async op). 4138 // an async op).
4115 TEST_P(WebRtcSessionTest, TestCreateAnswerBeforeIdentityRequestReturnSuccess) { 4139 TEST_P(WebRtcSessionTest, TestCreateAnswerBeforeIdentityRequestReturnSuccess) {
4140 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4116 InitWithDtls(GetParam()); 4141 InitWithDtls(GetParam());
4117 SetFactoryDtlsSrtp(); 4142 SetFactoryDtlsSrtp();
4118 4143
4119 cricket::MediaSessionOptions options; 4144 cricket::MediaSessionOptions options;
4120 options.recv_video = true; 4145 options.recv_video = true;
4121 std::unique_ptr<JsepSessionDescription> offer( 4146 std::unique_ptr<JsepSessionDescription> offer(
4122 CreateRemoteOffer(options, cricket::SEC_DISABLED)); 4147 CreateRemoteOffer(options, cricket::SEC_DISABLED));
4123 ASSERT_TRUE(offer.get() != NULL); 4148 ASSERT_TRUE(offer.get() != NULL);
4124 SetRemoteDescriptionWithoutError(offer.release()); 4149 SetRemoteDescriptionWithoutError(offer.release());
4125 4150
4126 std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer()); 4151 std::unique_ptr<SessionDescriptionInterface> answer(CreateAnswer());
4127 EXPECT_TRUE(answer != NULL); 4152 EXPECT_TRUE(answer != NULL);
4128 VerifyNoCryptoParams(answer->description(), true); 4153 VerifyNoCryptoParams(answer->description(), true);
4129 VerifyFingerprintStatus(answer->description(), true); 4154 VerifyFingerprintStatus(answer->description(), true);
4130 } 4155 }
4131 4156
4132 // Verifies that CreateOffer succeeds when CreateOffer is called after async 4157 // Verifies that CreateOffer succeeds when CreateOffer is called after async
4133 // identity generation is finished (even if a certificate is provided this is 4158 // identity generation is finished (even if a certificate is provided this is
4134 // an async op). 4159 // an async op).
4135 TEST_P(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) { 4160 TEST_P(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnSuccess) {
4161 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4136 InitWithDtls(GetParam()); 4162 InitWithDtls(GetParam());
4137 4163
4138 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000); 4164 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000);
4139 4165
4140 std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer()); 4166 std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
4141 EXPECT_TRUE(offer != NULL); 4167 EXPECT_TRUE(offer != NULL);
4142 } 4168 }
4143 4169
4144 // Verifies that CreateOffer fails when CreateOffer is called after async 4170 // Verifies that CreateOffer fails when CreateOffer is called after async
4145 // identity generation fails. 4171 // identity generation fails.
4146 TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) { 4172 TEST_F(WebRtcSessionTest, TestCreateOfferAfterIdentityRequestReturnFailure) {
4173 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4147 InitWithDtlsIdentityGenFail(); 4174 InitWithDtlsIdentityGenFail();
4148 4175
4149 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000); 4176 EXPECT_TRUE_WAIT(!session_->waiting_for_certificate_for_testing(), 1000);
4150 4177
4151 std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer()); 4178 std::unique_ptr<SessionDescriptionInterface> offer(CreateOffer());
4152 EXPECT_TRUE(offer == NULL); 4179 EXPECT_TRUE(offer == NULL);
4153 } 4180 }
4154 4181
4155 // Verifies that CreateOffer succeeds when Multiple CreateOffer calls are made 4182 // Verifies that CreateOffer succeeds when Multiple CreateOffer calls are made
4156 // before async identity generation is finished. 4183 // before async identity generation is finished.
4157 TEST_P(WebRtcSessionTest, 4184 TEST_P(WebRtcSessionTest,
4158 TestMultipleCreateOfferBeforeIdentityRequestReturnSuccess) { 4185 TestMultipleCreateOfferBeforeIdentityRequestReturnSuccess) {
4186 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4159 VerifyMultipleAsyncCreateDescription(GetParam(), 4187 VerifyMultipleAsyncCreateDescription(GetParam(),
4160 CreateSessionDescriptionRequest::kOffer); 4188 CreateSessionDescriptionRequest::kOffer);
4161 } 4189 }
4162 4190
4163 // Verifies that CreateOffer fails when Multiple CreateOffer calls are made 4191 // Verifies that CreateOffer fails when Multiple CreateOffer calls are made
4164 // before async identity generation fails. 4192 // before async identity generation fails.
4165 TEST_F(WebRtcSessionTest, 4193 TEST_F(WebRtcSessionTest,
4166 TestMultipleCreateOfferBeforeIdentityRequestReturnFailure) { 4194 TestMultipleCreateOfferBeforeIdentityRequestReturnFailure) {
4195 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4167 VerifyMultipleAsyncCreateDescriptionIdentityGenFailure( 4196 VerifyMultipleAsyncCreateDescriptionIdentityGenFailure(
4168 CreateSessionDescriptionRequest::kOffer); 4197 CreateSessionDescriptionRequest::kOffer);
4169 } 4198 }
4170 4199
4171 // Verifies that CreateAnswer succeeds when Multiple CreateAnswer calls are made 4200 // Verifies that CreateAnswer succeeds when Multiple CreateAnswer calls are made
4172 // before async identity generation is finished. 4201 // before async identity generation is finished.
4173 TEST_P(WebRtcSessionTest, 4202 TEST_P(WebRtcSessionTest,
4174 TestMultipleCreateAnswerBeforeIdentityRequestReturnSuccess) { 4203 TestMultipleCreateAnswerBeforeIdentityRequestReturnSuccess) {
4204 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4175 VerifyMultipleAsyncCreateDescription( 4205 VerifyMultipleAsyncCreateDescription(
4176 GetParam(), CreateSessionDescriptionRequest::kAnswer); 4206 GetParam(), CreateSessionDescriptionRequest::kAnswer);
4177 } 4207 }
4178 4208
4179 // Verifies that CreateAnswer fails when Multiple CreateAnswer calls are made 4209 // Verifies that CreateAnswer fails when Multiple CreateAnswer calls are made
4180 // before async identity generation fails. 4210 // before async identity generation fails.
4181 TEST_F(WebRtcSessionTest, 4211 TEST_F(WebRtcSessionTest,
4182 TestMultipleCreateAnswerBeforeIdentityRequestReturnFailure) { 4212 TestMultipleCreateAnswerBeforeIdentityRequestReturnFailure) {
4213 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4183 VerifyMultipleAsyncCreateDescriptionIdentityGenFailure( 4214 VerifyMultipleAsyncCreateDescriptionIdentityGenFailure(
4184 CreateSessionDescriptionRequest::kAnswer); 4215 CreateSessionDescriptionRequest::kAnswer);
4185 } 4216 }
4186 4217
4187 // Verifies that setRemoteDescription fails when DTLS is disabled and the remote 4218 // Verifies that setRemoteDescription fails when DTLS is disabled and the remote
4188 // offer has no SDES crypto but only DTLS fingerprint. 4219 // offer has no SDES crypto but only DTLS fingerprint.
4189 TEST_F(WebRtcSessionTest, TestSetRemoteOfferFailIfDtlsDisabledAndNoCrypto) { 4220 TEST_F(WebRtcSessionTest, TestSetRemoteOfferFailIfDtlsDisabledAndNoCrypto) {
4190 // Init without DTLS. 4221 // Init without DTLS.
4191 Init(); 4222 Init();
4192 // Create a remote offer with secured transport disabled. 4223 // Create a remote offer with secured transport disabled.
(...skipping 23 matching lines...) Expand all
4216 voice_channel_ = media_engine_->GetVoiceChannel(0); 4247 voice_channel_ = media_engine_->GetVoiceChannel(0);
4217 4248
4218 ASSERT_TRUE(voice_channel_ != NULL); 4249 ASSERT_TRUE(voice_channel_ != NULL);
4219 const cricket::AudioOptions& audio_options = voice_channel_->options(); 4250 const cricket::AudioOptions& audio_options = voice_channel_->options();
4220 EXPECT_EQ(rtc::Optional<bool>(true), audio_options.combined_audio_video_bwe); 4251 EXPECT_EQ(rtc::Optional<bool>(true), audio_options.combined_audio_video_bwe);
4221 } 4252 }
4222 4253
4223 // Tests that we can renegotiate new media content with ICE candidates in the 4254 // Tests that we can renegotiate new media content with ICE candidates in the
4224 // new remote SDP. 4255 // new remote SDP.
4225 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) { 4256 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesInSdp) {
4257 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4226 InitWithDtls(GetParam()); 4258 InitWithDtls(GetParam());
4227 SetFactoryDtlsSrtp(); 4259 SetFactoryDtlsSrtp();
4228 4260
4229 SendAudioOnlyStream2(); 4261 SendAudioOnlyStream2();
4230 SessionDescriptionInterface* offer = CreateOffer(); 4262 SessionDescriptionInterface* offer = CreateOffer();
4231 SetLocalDescriptionWithoutError(offer); 4263 SetLocalDescriptionWithoutError(offer);
4232 4264
4233 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); 4265 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
4234 SetRemoteDescriptionWithoutError(answer); 4266 SetRemoteDescriptionWithoutError(answer);
4235 4267
4236 cricket::MediaSessionOptions options; 4268 cricket::MediaSessionOptions options;
4237 options.recv_video = true; 4269 options.recv_video = true;
4238 offer = CreateRemoteOffer(options, cricket::SEC_DISABLED); 4270 offer = CreateRemoteOffer(options, cricket::SEC_DISABLED);
4239 4271
4240 cricket::Candidate candidate1; 4272 cricket::Candidate candidate1;
4241 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000)); 4273 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 5000));
4242 candidate1.set_component(1); 4274 candidate1.set_component(1);
4243 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1, 4275 JsepIceCandidate ice_candidate(kMediaContentName1, kMediaContentIndex1,
4244 candidate1); 4276 candidate1);
4245 EXPECT_TRUE(offer->AddCandidate(&ice_candidate)); 4277 EXPECT_TRUE(offer->AddCandidate(&ice_candidate));
4246 SetRemoteDescriptionWithoutError(offer); 4278 SetRemoteDescriptionWithoutError(offer);
4247 4279
4248 answer = CreateAnswer(); 4280 answer = CreateAnswer();
4249 SetLocalDescriptionWithoutError(answer); 4281 SetLocalDescriptionWithoutError(answer);
4250 } 4282 }
4251 4283
4252 // Tests that we can renegotiate new media content with ICE candidates separated 4284 // Tests that we can renegotiate new media content with ICE candidates separated
4253 // from the remote SDP. 4285 // from the remote SDP.
4254 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) { 4286 TEST_P(WebRtcSessionTest, TestRenegotiateNewMediaWithCandidatesSeparated) {
4287 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
4255 InitWithDtls(GetParam()); 4288 InitWithDtls(GetParam());
4256 SetFactoryDtlsSrtp(); 4289 SetFactoryDtlsSrtp();
4257 4290
4258 SendAudioOnlyStream2(); 4291 SendAudioOnlyStream2();
4259 SessionDescriptionInterface* offer = CreateOffer(); 4292 SessionDescriptionInterface* offer = CreateOffer();
4260 SetLocalDescriptionWithoutError(offer); 4293 SetLocalDescriptionWithoutError(offer);
4261 4294
4262 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer); 4295 SessionDescriptionInterface* answer = CreateRemoteAnswer(offer);
4263 SetRemoteDescriptionWithoutError(answer); 4296 SetRemoteDescriptionWithoutError(answer);
4264 4297
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4409 } 4442 }
4410 4443
4411 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4444 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4412 // currently fails because upon disconnection and reconnection OnIceComplete is 4445 // currently fails because upon disconnection and reconnection OnIceComplete is
4413 // called more than once without returning to IceGatheringGathering. 4446 // called more than once without returning to IceGatheringGathering.
4414 4447
4415 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4448 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4416 WebRtcSessionTest, 4449 WebRtcSessionTest,
4417 testing::Values(ALREADY_GENERATED, 4450 testing::Values(ALREADY_GENERATED,
4418 DTLS_IDENTITY_STORE)); 4451 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « webrtc/api/test/peerconnectiontestwrapper.cc ('k') | webrtc/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698