Index: webrtc/api/peerconnection_unittest.cc |
diff --git a/webrtc/api/peerconnection_unittest.cc b/webrtc/api/peerconnection_unittest.cc |
index c27e53ffc4582bb062b7759dcb29821e7860c8dc..ee6edcd7403e0c8f6d1610cdcbe192eead98e0e6 100644 |
--- a/webrtc/api/peerconnection_unittest.cc |
+++ b/webrtc/api/peerconnection_unittest.cc |
@@ -525,6 +525,10 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, |
void RemoveCvoFromReceivedSdp(bool remove) { remove_cvo_ = remove; } |
+ void MakeRealMaxBundleOfferFromReceivedSdp(bool real) { |
+ make_real_max_bundle_offer_ = real; |
pthatcher1
2017/02/17 19:17:32
A better name might be:
modify_remote_offers_to_s
Taylor Brandstetter
2017/02/17 21:49:14
Replaced "real" with "spec compliant".
|
+ } |
+ |
bool can_receive_audio() { |
bool value; |
if (prefer_constraint_apis_) { |
@@ -1056,6 +1060,33 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, |
} |
std::unique_ptr<SessionDescriptionInterface> desc( |
webrtc::CreateSessionDescription("offer", msg, nullptr)); |
+ |
+ // Do the equivalent of setting the port to 0, adding a=bundle-only, and |
+ // removing a=ice-ufrag, a=ice-pwd, a=fingerprint and a=setup from all but |
+ // the first m= section. |
+ if (make_real_max_bundle_offer_) { |
+ bool first = true; |
+ for (cricket::ContentInfo& content : desc->description()->contents()) { |
+ if (first) { |
+ first = false; |
+ continue; |
+ } |
+ content.bundle_only = true; |
+ } |
+ first = true; |
+ for (cricket::TransportInfo& transport : |
+ desc->description()->transport_infos()) { |
+ if (first) { |
+ first = false; |
+ continue; |
+ } |
+ transport.description.ice_ufrag.clear(); |
+ transport.description.ice_pwd.clear(); |
+ transport.description.connection_role = cricket::CONNECTIONROLE_NONE; |
+ transport.description.identity_fingerprint.reset(nullptr); |
+ } |
+ } |
+ |
EXPECT_TRUE(DoSetRemoteDescription(desc.release())); |
// Set the RtpReceiverObserver after receivers are created. |
SetRtpReceiverObservers(); |
@@ -1216,6 +1247,8 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver, |
// |remove_cvo_| is true if extension urn:3gpp:video-orientation should be |
// removed in the received SDP. |
bool remove_cvo_ = false; |
+ // See LocalP2PTestWithRealMaxBundleOffer. |
+ bool make_real_max_bundle_offer_ = false; |
rtc::scoped_refptr<DataChannelInterface> data_channel_; |
std::unique_ptr<MockDataChannelObserver> data_observer_; |
@@ -1863,6 +1896,19 @@ TEST_F(P2PTestConductor, LocalP2PTestTwoStreams) { |
EXPECT_EQ(2u, receiving_client()->number_of_remote_streams()); |
} |
+// Test that if applying a true "max bundle" offer, which uses ports of 0, |
+// "a=bundle-only", omitting "a=fingerprint", "a=setup", "a=ice-ufrag" and |
+// "a=ice-pwd" for all but the audio "m=" section, negotiation still completes |
+// successfully and media flows. |
+// TODO(deadbeef): Update this test to also omit "a=rtcp-mux", once that works. |
+// TODO(deadbeef): Won't need this test once we start generating actual |
+// standards-compliant SDP. |
+TEST_F(P2PTestConductor, LocalP2PTestWithRealMaxBundleOffer) { |
pthatcher1
2017/02/17 19:17:32
A better test name might be IncomingOfferWithSpecC
|
+ ASSERT_TRUE(CreateTestClients()); |
+ receiving_client()->MakeRealMaxBundleOfferFromReceivedSdp(true); |
+ LocalP2PTest(); |
+} |
+ |
// Test that we can receive the audio output level from a remote audio track. |
TEST_F(P2PTestConductor, GetAudioOutputLevelStats) { |
ASSERT_TRUE(CreateTestClients()); |