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

Side by Side Diff: webrtc/api/peerconnection_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/BUILD.gn ('k') | webrtc/api/peerconnectionendtoend_unittest.cc » ('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 28 matching lines...) Expand all
39 #include "webrtc/base/thread.h" 39 #include "webrtc/base/thread.h"
40 #include "webrtc/base/virtualsocketserver.h" 40 #include "webrtc/base/virtualsocketserver.h"
41 #include "webrtc/media/engine/fakewebrtcvideoengine.h" 41 #include "webrtc/media/engine/fakewebrtcvideoengine.h"
42 #include "webrtc/p2p/base/p2pconstants.h" 42 #include "webrtc/p2p/base/p2pconstants.h"
43 #include "webrtc/p2p/base/portinterface.h" 43 #include "webrtc/p2p/base/portinterface.h"
44 #include "webrtc/p2p/base/sessiondescription.h" 44 #include "webrtc/p2p/base/sessiondescription.h"
45 #include "webrtc/p2p/base/testturnserver.h" 45 #include "webrtc/p2p/base/testturnserver.h"
46 #include "webrtc/p2p/client/basicportallocator.h" 46 #include "webrtc/p2p/client/basicportallocator.h"
47 #include "webrtc/pc/mediasession.h" 47 #include "webrtc/pc/mediasession.h"
48 48
49 #define MAYBE_SKIP_TEST(feature) \
50 if (!(feature())) { \
51 LOG(LS_INFO) << "Feature disabled... skipping"; \
52 return; \
53 }
54
49 using cricket::ContentInfo; 55 using cricket::ContentInfo;
50 using cricket::FakeWebRtcVideoDecoder; 56 using cricket::FakeWebRtcVideoDecoder;
51 using cricket::FakeWebRtcVideoDecoderFactory; 57 using cricket::FakeWebRtcVideoDecoderFactory;
52 using cricket::FakeWebRtcVideoEncoder; 58 using cricket::FakeWebRtcVideoEncoder;
53 using cricket::FakeWebRtcVideoEncoderFactory; 59 using cricket::FakeWebRtcVideoEncoderFactory;
54 using cricket::MediaContentDescription; 60 using cricket::MediaContentDescription;
55 using webrtc::DataBuffer; 61 using webrtc::DataBuffer;
56 using webrtc::DataChannelInterface; 62 using webrtc::DataChannelInterface;
57 using webrtc::DtmfSender; 63 using webrtc::DtmfSender;
58 using webrtc::DtmfSenderInterface; 64 using webrtc::DtmfSenderInterface;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 216 }
211 217
212 static PeerConnectionTestClient* CreateClient( 218 static PeerConnectionTestClient* CreateClient(
213 const std::string& id, 219 const std::string& id,
214 const MediaConstraintsInterface* constraints, 220 const MediaConstraintsInterface* constraints,
215 const PeerConnectionFactory::Options* options, 221 const PeerConnectionFactory::Options* options,
216 const PeerConnectionInterface::RTCConfiguration* config, 222 const PeerConnectionInterface::RTCConfiguration* config,
217 rtc::Thread* network_thread, 223 rtc::Thread* network_thread,
218 rtc::Thread* worker_thread) { 224 rtc::Thread* worker_thread) {
219 std::unique_ptr<FakeRTCCertificateGenerator> cert_generator( 225 std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
220 new FakeRTCCertificateGenerator()); 226 rtc::SSLStreamAdapter::HaveDtlsSrtp() ?
227 new FakeRTCCertificateGenerator() : nullptr);
221 228
222 return CreateClientWithDtlsIdentityStore(id, constraints, options, config, 229 return CreateClientWithDtlsIdentityStore(id, constraints, options, config,
223 std::move(cert_generator), true, 230 std::move(cert_generator), true,
224 network_thread, worker_thread); 231 network_thread, worker_thread);
225 } 232 }
226 233
227 static PeerConnectionTestClient* CreateClientPreferNoConstraints( 234 static PeerConnectionTestClient* CreateClientPreferNoConstraints(
228 const std::string& id, 235 const std::string& id,
229 const PeerConnectionFactory::Options* options, 236 const PeerConnectionFactory::Options* options,
230 rtc::Thread* network_thread, 237 rtc::Thread* network_thread,
231 rtc::Thread* worker_thread) { 238 rtc::Thread* worker_thread) {
232 std::unique_ptr<FakeRTCCertificateGenerator> cert_generator( 239 std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
233 new FakeRTCCertificateGenerator()); 240 rtc::SSLStreamAdapter::HaveDtlsSrtp() ?
241 new FakeRTCCertificateGenerator() : nullptr);
234 242
235 return CreateClientWithDtlsIdentityStore(id, nullptr, options, nullptr, 243 return CreateClientWithDtlsIdentityStore(id, nullptr, options, nullptr,
236 std::move(cert_generator), false, 244 std::move(cert_generator), false,
237 network_thread, worker_thread); 245 network_thread, worker_thread);
238 } 246 }
239 247
240 ~PeerConnectionTestClient() { 248 ~PeerConnectionTestClient() {
241 } 249 }
242 250
243 void Negotiate() { Negotiate(true, true); } 251 void Negotiate() { Negotiate(true, true); }
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete, 1465 EXPECT_EQ_WAIT(webrtc::PeerConnectionInterface::kIceGatheringComplete,
1458 receiving_client_->ice_gathering_state(), 1466 receiving_client_->ice_gathering_state(),
1459 kMaxWaitForFramesMs); 1467 kMaxWaitForFramesMs);
1460 1468
1461 // Check that the expected number of frames have arrived. 1469 // Check that the expected number of frames have arrived.
1462 EXPECT_TRUE_WAIT(FramesHaveArrived(audio_frame_count, video_frame_count), 1470 EXPECT_TRUE_WAIT(FramesHaveArrived(audio_frame_count, video_frame_count),
1463 kMaxWaitForFramesMs); 1471 kMaxWaitForFramesMs);
1464 } 1472 }
1465 1473
1466 void SetupAndVerifyDtlsCall() { 1474 void SetupAndVerifyDtlsCall() {
1475 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1467 FakeConstraints setup_constraints; 1476 FakeConstraints setup_constraints;
1468 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, 1477 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
1469 true); 1478 true);
1470 // Disable resolution adaptation, we don't want it interfering with the 1479 // Disable resolution adaptation, we don't want it interfering with the
1471 // test results. 1480 // test results.
1472 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; 1481 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config;
1473 rtc_config.set_cpu_adaptation(false); 1482 rtc_config.set_cpu_adaptation(false);
1474 1483
1475 ASSERT_TRUE(CreateTestClients(&setup_constraints, nullptr, &rtc_config, 1484 ASSERT_TRUE(CreateTestClients(&setup_constraints, nullptr, &rtc_config,
1476 &setup_constraints, nullptr, &rtc_config)); 1485 &setup_constraints, nullptr, &rtc_config));
1477 LocalP2PTest(); 1486 LocalP2PTest();
1478 VerifyRenderedAspectRatio(640, 480); 1487 VerifyRenderedAspectRatio(640, 480);
1479 } 1488 }
1480 1489
1481 PeerConnectionTestClient* CreateDtlsClientWithAlternateKey() { 1490 PeerConnectionTestClient* CreateDtlsClientWithAlternateKey() {
1482 FakeConstraints setup_constraints; 1491 FakeConstraints setup_constraints;
1483 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, 1492 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
1484 true); 1493 true);
1485 // Disable resolution adaptation, we don't want it interfering with the 1494 // Disable resolution adaptation, we don't want it interfering with the
1486 // test results. 1495 // test results.
1487 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; 1496 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config;
1488 rtc_config.set_cpu_adaptation(false); 1497 rtc_config.set_cpu_adaptation(false);
1489 1498
1490 std::unique_ptr<FakeRTCCertificateGenerator> cert_generator( 1499 std::unique_ptr<FakeRTCCertificateGenerator> cert_generator(
1491 new FakeRTCCertificateGenerator()); 1500 rtc::SSLStreamAdapter::HaveDtlsSrtp() ?
1501 new FakeRTCCertificateGenerator() : nullptr);
1492 cert_generator->use_alternate_key(); 1502 cert_generator->use_alternate_key();
1493 1503
1494 // Make sure the new client is using a different certificate. 1504 // Make sure the new client is using a different certificate.
1495 return PeerConnectionTestClient::CreateClientWithDtlsIdentityStore( 1505 return PeerConnectionTestClient::CreateClientWithDtlsIdentityStore(
1496 "New Peer: ", &setup_constraints, nullptr, &rtc_config, 1506 "New Peer: ", &setup_constraints, nullptr, &rtc_config,
1497 std::move(cert_generator), prefer_constraint_apis_, 1507 std::move(cert_generator), prefer_constraint_apis_,
1498 network_thread_.get(), worker_thread_.get()); 1508 network_thread_.get(), worker_thread_.get());
1499 } 1509 }
1500 1510
1501 void SendRtpData(webrtc::DataChannelInterface* dc, const std::string& data) { 1511 void SendRtpData(webrtc::DataChannelInterface* dc, const std::string& data) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 1687
1678 TEST_F(P2PTestConductor, OneWayMediaCallWithoutConstraints) { 1688 TEST_F(P2PTestConductor, OneWayMediaCallWithoutConstraints) {
1679 ASSERT_TRUE(CreateTestClientsThatPreferNoConstraints()); 1689 ASSERT_TRUE(CreateTestClientsThatPreferNoConstraints());
1680 receiving_client()->set_auto_add_stream(false); 1690 receiving_client()->set_auto_add_stream(false);
1681 LocalP2PTest(); 1691 LocalP2PTest();
1682 } 1692 }
1683 1693
1684 // This test sets up a audio call initially and then upgrades to audio/video, 1694 // This test sets up a audio call initially and then upgrades to audio/video,
1685 // using DTLS. 1695 // using DTLS.
1686 TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) { 1696 TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) {
1697 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1687 FakeConstraints setup_constraints; 1698 FakeConstraints setup_constraints;
1688 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, 1699 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
1689 true); 1700 true);
1690 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); 1701 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints));
1691 receiving_client()->SetReceiveAudioVideo(true, false); 1702 receiving_client()->SetReceiveAudioVideo(true, false);
1692 LocalP2PTest(); 1703 LocalP2PTest();
1693 receiving_client()->SetReceiveAudioVideo(true, true); 1704 receiving_client()->SetReceiveAudioVideo(true, true);
1694 receiving_client()->Negotiate(); 1705 receiving_client()->Negotiate();
1695 } 1706 }
1696 1707
1697 // This test sets up a call transfer to a new caller with a different DTLS 1708 // This test sets up a call transfer to a new caller with a different DTLS
1698 // fingerprint. 1709 // fingerprint.
1699 TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCallee) { 1710 TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCallee) {
1711 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1700 SetupAndVerifyDtlsCall(); 1712 SetupAndVerifyDtlsCall();
1701 1713
1702 // Keeping the original peer around which will still send packets to the 1714 // Keeping the original peer around which will still send packets to the
1703 // receiving client. These SRTP packets will be dropped. 1715 // receiving client. These SRTP packets will be dropped.
1704 std::unique_ptr<PeerConnectionTestClient> original_peer( 1716 std::unique_ptr<PeerConnectionTestClient> original_peer(
1705 set_initializing_client(CreateDtlsClientWithAlternateKey())); 1717 set_initializing_client(CreateDtlsClientWithAlternateKey()));
1706 original_peer->pc()->Close(); 1718 original_peer->pc()->Close();
1707 1719
1708 SetSignalingReceivers(); 1720 SetSignalingReceivers();
1709 receiving_client()->SetExpectIceRestart(true); 1721 receiving_client()->SetExpectIceRestart(true);
1710 LocalP2PTest(); 1722 LocalP2PTest();
1711 VerifyRenderedAspectRatio(640, 480); 1723 VerifyRenderedAspectRatio(640, 480);
1712 } 1724 }
1713 1725
1714 // This test sets up a non-bundle call and apply bundle during ICE restart. When 1726 // This test sets up a non-bundle call and apply bundle during ICE restart. When
1715 // bundle is in effect in the restart, the channel can successfully reset its 1727 // bundle is in effect in the restart, the channel can successfully reset its
1716 // DTLS-SRTP context. 1728 // DTLS-SRTP context.
1717 TEST_F(P2PTestConductor, LocalP2PTestDtlsBundleInIceRestart) { 1729 TEST_F(P2PTestConductor, LocalP2PTestDtlsBundleInIceRestart) {
1730 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1718 FakeConstraints setup_constraints; 1731 FakeConstraints setup_constraints;
1719 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, 1732 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
1720 true); 1733 true);
1721 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); 1734 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints));
1722 receiving_client()->RemoveBundleFromReceivedSdp(true); 1735 receiving_client()->RemoveBundleFromReceivedSdp(true);
1723 LocalP2PTest(); 1736 LocalP2PTest();
1724 VerifyRenderedAspectRatio(640, 480); 1737 VerifyRenderedAspectRatio(640, 480);
1725 1738
1726 initializing_client()->IceRestart(); 1739 initializing_client()->IceRestart();
1727 receiving_client()->SetExpectIceRestart(true); 1740 receiving_client()->SetExpectIceRestart(true);
1728 receiving_client()->RemoveBundleFromReceivedSdp(false); 1741 receiving_client()->RemoveBundleFromReceivedSdp(false);
1729 LocalP2PTest(); 1742 LocalP2PTest();
1730 VerifyRenderedAspectRatio(640, 480); 1743 VerifyRenderedAspectRatio(640, 480);
1731 } 1744 }
1732 1745
1733 // This test sets up a call transfer to a new callee with a different DTLS 1746 // This test sets up a call transfer to a new callee with a different DTLS
1734 // fingerprint. 1747 // fingerprint.
1735 TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCaller) { 1748 TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCaller) {
1749 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1736 SetupAndVerifyDtlsCall(); 1750 SetupAndVerifyDtlsCall();
1737 1751
1738 // Keeping the original peer around which will still send packets to the 1752 // Keeping the original peer around which will still send packets to the
1739 // receiving client. These SRTP packets will be dropped. 1753 // receiving client. These SRTP packets will be dropped.
1740 std::unique_ptr<PeerConnectionTestClient> original_peer( 1754 std::unique_ptr<PeerConnectionTestClient> original_peer(
1741 set_receiving_client(CreateDtlsClientWithAlternateKey())); 1755 set_receiving_client(CreateDtlsClientWithAlternateKey()));
1742 original_peer->pc()->Close(); 1756 original_peer->pc()->Close();
1743 1757
1744 SetSignalingReceivers(); 1758 SetSignalingReceivers();
1745 initializing_client()->IceRestart(); 1759 initializing_client()->IceRestart();
(...skipping 13 matching lines...) Expand all
1759 SetCaptureRotation(webrtc::kVideoRotation_90); 1773 SetCaptureRotation(webrtc::kVideoRotation_90);
1760 receiving_client()->RemoveCvoFromReceivedSdp(true); 1774 receiving_client()->RemoveCvoFromReceivedSdp(true);
1761 LocalP2PTest(); 1775 LocalP2PTest();
1762 VerifyRenderedAspectRatio(480, 640, webrtc::kVideoRotation_0); 1776 VerifyRenderedAspectRatio(480, 640, webrtc::kVideoRotation_0);
1763 } 1777 }
1764 1778
1765 // This test sets up a call between two endpoints that are configured to use 1779 // This test sets up a call between two endpoints that are configured to use
1766 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is 1780 // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is
1767 // negotiated and used for transport. 1781 // negotiated and used for transport.
1768 TEST_F(P2PTestConductor, LocalP2PTestOfferDtlsButNotSdes) { 1782 TEST_F(P2PTestConductor, LocalP2PTestOfferDtlsButNotSdes) {
1783 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
1769 FakeConstraints setup_constraints; 1784 FakeConstraints setup_constraints;
1770 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, 1785 setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
1771 true); 1786 true);
1772 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints)); 1787 ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints));
1773 receiving_client()->RemoveSdesCryptoFromReceivedSdp(true); 1788 receiving_client()->RemoveSdesCryptoFromReceivedSdp(true);
1774 LocalP2PTest(); 1789 LocalP2PTest();
1775 VerifyRenderedAspectRatio(640, 480); 1790 VerifyRenderedAspectRatio(640, 480);
1776 } 1791 }
1777 1792
1778 #ifdef HAVE_SCTP 1793 #ifdef HAVE_SCTP
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(), 2250 EXPECT_TRUE_WAIT(initializing_client()->data_observer()->IsOpen(),
2236 kMaxWaitMs); 2251 kMaxWaitMs);
2237 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(), 2252 EXPECT_TRUE_WAIT(receiving_client()->data_observer()->IsOpen(),
2238 kMaxWaitMs); 2253 kMaxWaitMs);
2239 } 2254 }
2240 2255
2241 // This test sets up a Jsep call with SCTP DataChannel and verifies the 2256 // This test sets up a Jsep call with SCTP DataChannel and verifies the
2242 // negotiation is completed without error. 2257 // negotiation is completed without error.
2243 #ifdef HAVE_SCTP 2258 #ifdef HAVE_SCTP
2244 TEST_F(P2PTestConductor, CreateOfferWithSctpDataChannel) { 2259 TEST_F(P2PTestConductor, CreateOfferWithSctpDataChannel) {
2260 MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
2245 FakeConstraints constraints; 2261 FakeConstraints constraints;
2246 constraints.SetMandatory( 2262 constraints.SetMandatory(
2247 MediaConstraintsInterface::kEnableDtlsSrtp, true); 2263 MediaConstraintsInterface::kEnableDtlsSrtp, true);
2248 ASSERT_TRUE(CreateTestClients(&constraints, &constraints)); 2264 ASSERT_TRUE(CreateTestClients(&constraints, &constraints));
2249 initializing_client()->CreateDataChannel(); 2265 initializing_client()->CreateDataChannel();
2250 initializing_client()->Negotiate(false, false); 2266 initializing_client()->Negotiate(false, false);
2251 } 2267 }
2252 #endif 2268 #endif
2253 2269
2254 // This test sets up a call between two parties with audio, and video. 2270 // This test sets up a call between two parties with audio, and video.
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 servers.push_back(server); 2835 servers.push_back(server);
2820 EXPECT_EQ(webrtc::RTCErrorType::NONE, 2836 EXPECT_EQ(webrtc::RTCErrorType::NONE,
2821 webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_)); 2837 webrtc::ParseIceServers(servers, &stun_servers_, &turn_servers_));
2822 EXPECT_EQ(2U, turn_servers_.size()); 2838 EXPECT_EQ(2U, turn_servers_.size());
2823 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority); 2839 EXPECT_NE(turn_servers_[0].priority, turn_servers_[1].priority);
2824 } 2840 }
2825 2841
2826 #endif // if !defined(THREAD_SANITIZER) 2842 #endif // if !defined(THREAD_SANITIZER)
2827 2843
2828 } // namespace 2844 } // namespace
OLDNEW
« no previous file with comments | « webrtc/BUILD.gn ('k') | webrtc/api/peerconnectionendtoend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698