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

Unified Diff: webrtc/pc/peerconnectioninterface_unittest.cc

Issue 3012313002: Reject the descriptions that attempt to change the order of m= sections (Closed)
Patch Set: Address comments. Created 3 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/pc/webrtcsession.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/peerconnectioninterface_unittest.cc
diff --git a/webrtc/pc/peerconnectioninterface_unittest.cc b/webrtc/pc/peerconnectioninterface_unittest.cc
index 565704e935cc677cf6aebeb5640626fae468ee0d..ccf64d241594c3055f47a6a95f7d7053aba86dd7 100644
--- a/webrtc/pc/peerconnectioninterface_unittest.cc
+++ b/webrtc/pc/peerconnectioninterface_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <algorithm>
#include <memory>
#include <sstream>
#include <string>
@@ -3831,6 +3832,39 @@ TEST_F(PeerConnectionInterfaceTest, CreateAnswerWithoutRemoteDescription) {
EXPECT_TRUE(DoCreateAnswer(&answer, nullptr));
}
+// Test that an error is returned if a description is applied that doesn't
+// respect the order of existing media sections.
+TEST_F(PeerConnectionInterfaceTest,
+ MediaSectionOrderEnforcedForSubsequentOffers) {
+ CreatePeerConnection();
+ FakeConstraints constraints;
+ constraints.SetMandatoryReceiveAudio(true);
+ constraints.SetMandatoryReceiveVideo(true);
+ std::unique_ptr<SessionDescriptionInterface> offer;
+ ASSERT_TRUE(DoCreateOffer(&offer, &constraints));
+ EXPECT_TRUE(DoSetRemoteDescription(std::move(offer)));
+
+ std::unique_ptr<SessionDescriptionInterface> answer;
+ ASSERT_TRUE(DoCreateAnswer(&answer, nullptr));
+ EXPECT_TRUE(DoSetLocalDescription(std::move(answer)));
+
+ // A remote offer with different m=line order should be rejected.
+ ASSERT_TRUE(DoCreateOffer(&offer, &constraints));
+ std::reverse(offer->description()->contents().begin(),
+ offer->description()->contents().end());
+ std::reverse(offer->description()->transport_infos().begin(),
+ offer->description()->transport_infos().end());
+ EXPECT_FALSE(DoSetRemoteDescription(std::move(offer)));
+
+ // A subsequent local offer with different m=line order should be rejected.
+ ASSERT_TRUE(DoCreateOffer(&offer, &constraints));
+ std::reverse(offer->description()->contents().begin(),
+ offer->description()->contents().end());
+ std::reverse(offer->description()->transport_infos().begin(),
+ offer->description()->transport_infos().end());
+ EXPECT_FALSE(DoSetLocalDescription(std::move(offer)));
+}
+
class PeerConnectionMediaConfigTest : public testing::Test {
protected:
void SetUp() override {
« no previous file with comments | « no previous file | webrtc/pc/webrtcsession.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698