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

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

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

Powered by Google App Engine
This is Rietveld 408576698