Index: webrtc/api/peerconnection_unittest.cc |
diff --git a/webrtc/api/peerconnection_unittest.cc b/webrtc/api/peerconnection_unittest.cc |
index c8a1eb6e2a1c48a6189637f7a7dea889ae717742..c27e53ffc4582bb062b7759dcb29821e7860c8dc 100644 |
--- a/webrtc/api/peerconnection_unittest.cc |
+++ b/webrtc/api/peerconnection_unittest.cc |
@@ -46,6 +46,12 @@ |
#include "webrtc/p2p/client/basicportallocator.h" |
#include "webrtc/pc/mediasession.h" |
+#define MAYBE_SKIP_TEST(feature) \ |
+ if (!(feature())) { \ |
+ LOG(LS_INFO) << "Feature disabled... skipping"; \ |
+ return; \ |
+ } |
+ |
using cricket::ContentInfo; |
using cricket::FakeWebRtcVideoDecoder; |
using cricket::FakeWebRtcVideoDecoderFactory; |
@@ -217,7 +223,8 @@ |
rtc::Thread* network_thread, |
rtc::Thread* worker_thread) { |
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator( |
- new FakeRTCCertificateGenerator()); |
+ rtc::SSLStreamAdapter::HaveDtlsSrtp() ? |
+ new FakeRTCCertificateGenerator() : nullptr); |
return CreateClientWithDtlsIdentityStore(id, constraints, options, config, |
std::move(cert_generator), true, |
@@ -230,7 +237,8 @@ |
rtc::Thread* network_thread, |
rtc::Thread* worker_thread) { |
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator( |
- new FakeRTCCertificateGenerator()); |
+ rtc::SSLStreamAdapter::HaveDtlsSrtp() ? |
+ new FakeRTCCertificateGenerator() : nullptr); |
return CreateClientWithDtlsIdentityStore(id, nullptr, options, nullptr, |
std::move(cert_generator), false, |
@@ -1464,6 +1472,7 @@ |
} |
void SetupAndVerifyDtlsCall() { |
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
FakeConstraints setup_constraints; |
setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
true); |
@@ -1488,7 +1497,8 @@ |
rtc_config.set_cpu_adaptation(false); |
std::unique_ptr<FakeRTCCertificateGenerator> cert_generator( |
- new FakeRTCCertificateGenerator()); |
+ rtc::SSLStreamAdapter::HaveDtlsSrtp() ? |
+ new FakeRTCCertificateGenerator() : nullptr); |
cert_generator->use_alternate_key(); |
// Make sure the new client is using a different certificate. |
@@ -1684,6 +1694,7 @@ |
// This test sets up a audio call initially and then upgrades to audio/video, |
// using DTLS. |
TEST_F(P2PTestConductor, LocalP2PTestDtlsRenegotiate) { |
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
FakeConstraints setup_constraints; |
setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
true); |
@@ -1697,6 +1708,7 @@ |
// This test sets up a call transfer to a new caller with a different DTLS |
// fingerprint. |
TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCallee) { |
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
SetupAndVerifyDtlsCall(); |
// Keeping the original peer around which will still send packets to the |
@@ -1715,6 +1727,7 @@ |
// bundle is in effect in the restart, the channel can successfully reset its |
// DTLS-SRTP context. |
TEST_F(P2PTestConductor, LocalP2PTestDtlsBundleInIceRestart) { |
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
FakeConstraints setup_constraints; |
setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
true); |
@@ -1733,6 +1746,7 @@ |
// This test sets up a call transfer to a new callee with a different DTLS |
// fingerprint. |
TEST_F(P2PTestConductor, LocalP2PTestDtlsTransferCaller) { |
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
SetupAndVerifyDtlsCall(); |
// Keeping the original peer around which will still send packets to the |
@@ -1766,6 +1780,7 @@ |
// DTLS key agreement. The offerer don't support SDES. As a result, DTLS is |
// negotiated and used for transport. |
TEST_F(P2PTestConductor, LocalP2PTestOfferDtlsButNotSdes) { |
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
FakeConstraints setup_constraints; |
setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp, |
true); |
@@ -2242,6 +2257,7 @@ |
// negotiation is completed without error. |
#ifdef HAVE_SCTP |
TEST_F(P2PTestConductor, CreateOfferWithSctpDataChannel) { |
+ MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp); |
FakeConstraints constraints; |
constraints.SetMandatory( |
MediaConstraintsInterface::kEnableDtlsSrtp, true); |