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

Side by Side Diff: webrtc/pc/webrtcsession_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 unified diff | Download patch
« no previous file with comments | « webrtc/pc/webrtcsession.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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 using webrtc::JsepSessionDescription; 63 using webrtc::JsepSessionDescription;
64 using webrtc::PeerConnectionFactoryInterface; 64 using webrtc::PeerConnectionFactoryInterface;
65 using webrtc::PeerConnectionInterface; 65 using webrtc::PeerConnectionInterface;
66 using webrtc::SessionDescriptionInterface; 66 using webrtc::SessionDescriptionInterface;
67 using webrtc::SessionStats; 67 using webrtc::SessionStats;
68 using webrtc::StreamCollection; 68 using webrtc::StreamCollection;
69 using webrtc::WebRtcSession; 69 using webrtc::WebRtcSession;
70 using webrtc::kBundleWithoutRtcpMux; 70 using webrtc::kBundleWithoutRtcpMux;
71 using webrtc::kCreateChannelFailed; 71 using webrtc::kCreateChannelFailed;
72 using webrtc::kInvalidSdp; 72 using webrtc::kInvalidSdp;
73 using webrtc::kMlineMismatch; 73 using webrtc::kMlineMismatchInAnswer;
74 using webrtc::kPushDownTDFailed; 74 using webrtc::kPushDownTDFailed;
75 using webrtc::kSdpWithoutIceUfragPwd; 75 using webrtc::kSdpWithoutIceUfragPwd;
76 using webrtc::kSdpWithoutDtlsFingerprint; 76 using webrtc::kSdpWithoutDtlsFingerprint;
77 using webrtc::kSdpWithoutSdesCrypto; 77 using webrtc::kSdpWithoutSdesCrypto;
78 using webrtc::kSessionError; 78 using webrtc::kSessionError;
79 using webrtc::kSessionErrorDesc; 79 using webrtc::kSessionErrorDesc;
80 using webrtc::kMaxUnsignalledRecvStreams; 80 using webrtc::kMaxUnsignalledRecvStreams;
81 81
82 typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions; 82 typedef PeerConnectionInterface::RTCOfferAnswerOptions RTCOfferAnswerOptions;
83 83
(...skipping 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after
3740 CreateRemoteAnswer(session_->local_description())); 3740 CreateRemoteAnswer(session_->local_description()));
3741 3741
3742 cricket::SessionDescription* answer_copy = answer->description()->Copy(); 3742 cricket::SessionDescription* answer_copy = answer->description()->Copy();
3743 answer_copy->RemoveContentByName("video"); 3743 answer_copy->RemoveContentByName("video");
3744 JsepSessionDescription* modified_answer = 3744 JsepSessionDescription* modified_answer =
3745 new JsepSessionDescription(JsepSessionDescription::kAnswer); 3745 new JsepSessionDescription(JsepSessionDescription::kAnswer);
3746 3746
3747 EXPECT_TRUE(modified_answer->Initialize(answer_copy, 3747 EXPECT_TRUE(modified_answer->Initialize(answer_copy,
3748 answer->session_id(), 3748 answer->session_id(),
3749 answer->session_version())); 3749 answer->session_version()));
3750 SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer); 3750 SetRemoteDescriptionAnswerExpectError(kMlineMismatchInAnswer,
3751 modified_answer);
3751 3752
3752 // Different content names. 3753 // Different content names.
3753 std::string sdp; 3754 std::string sdp;
3754 EXPECT_TRUE(answer->ToString(&sdp)); 3755 EXPECT_TRUE(answer->ToString(&sdp));
3755 const std::string kAudioMid = "a=mid:audio"; 3756 const std::string kAudioMid = "a=mid:audio";
3756 const std::string kAudioMidReplaceStr = "a=mid:audio_content_name"; 3757 const std::string kAudioMidReplaceStr = "a=mid:audio_content_name";
3757 rtc::replace_substrs(kAudioMid.c_str(), kAudioMid.length(), 3758 rtc::replace_substrs(kAudioMid.c_str(), kAudioMid.length(),
3758 kAudioMidReplaceStr.c_str(), 3759 kAudioMidReplaceStr.c_str(),
3759 kAudioMidReplaceStr.length(), 3760 kAudioMidReplaceStr.length(),
3760 &sdp); 3761 &sdp);
3761 SessionDescriptionInterface* modified_answer1 = 3762 SessionDescriptionInterface* modified_answer1 =
3762 CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL); 3763 CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL);
3763 SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer1); 3764 SetRemoteDescriptionAnswerExpectError(kMlineMismatchInAnswer,
3765 modified_answer1);
3764 3766
3765 // Different media types. 3767 // Different media types.
3766 EXPECT_TRUE(answer->ToString(&sdp)); 3768 EXPECT_TRUE(answer->ToString(&sdp));
3767 const std::string kAudioMline = "m=audio"; 3769 const std::string kAudioMline = "m=audio";
3768 const std::string kAudioMlineReplaceStr = "m=video"; 3770 const std::string kAudioMlineReplaceStr = "m=video";
3769 rtc::replace_substrs(kAudioMline.c_str(), kAudioMline.length(), 3771 rtc::replace_substrs(kAudioMline.c_str(), kAudioMline.length(),
3770 kAudioMlineReplaceStr.c_str(), 3772 kAudioMlineReplaceStr.c_str(),
3771 kAudioMlineReplaceStr.length(), 3773 kAudioMlineReplaceStr.length(),
3772 &sdp); 3774 &sdp);
3773 SessionDescriptionInterface* modified_answer2 = 3775 SessionDescriptionInterface* modified_answer2 =
3774 CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL); 3776 CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL);
3775 SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer2); 3777 SetRemoteDescriptionAnswerExpectError(kMlineMismatchInAnswer,
3778 modified_answer2);
3776 3779
3777 SetRemoteDescriptionWithoutError(answer.release()); 3780 SetRemoteDescriptionWithoutError(answer.release());
3778 } 3781 }
3779 3782
3780 // Verifying remote offer and local answer have matching m-lines as per 3783 // Verifying remote offer and local answer have matching m-lines as per
3781 // RFC 3264. 3784 // RFC 3264.
3782 TEST_F(WebRtcSessionTest, TestIncorrectMLinesInLocalAnswer) { 3785 TEST_F(WebRtcSessionTest, TestIncorrectMLinesInLocalAnswer) {
3783 Init(); 3786 Init();
3784 SendAudioVideoStream1(); 3787 SendAudioVideoStream1();
3785 SessionDescriptionInterface* offer = CreateRemoteOffer(); 3788 SessionDescriptionInterface* offer = CreateRemoteOffer();
3786 SetRemoteDescriptionWithoutError(offer); 3789 SetRemoteDescriptionWithoutError(offer);
3787 SessionDescriptionInterface* answer = CreateAnswer(); 3790 SessionDescriptionInterface* answer = CreateAnswer();
3788 3791
3789 cricket::SessionDescription* answer_copy = answer->description()->Copy(); 3792 cricket::SessionDescription* answer_copy = answer->description()->Copy();
3790 answer_copy->RemoveContentByName("video"); 3793 answer_copy->RemoveContentByName("video");
3791 JsepSessionDescription* modified_answer = 3794 JsepSessionDescription* modified_answer =
3792 new JsepSessionDescription(JsepSessionDescription::kAnswer); 3795 new JsepSessionDescription(JsepSessionDescription::kAnswer);
3793 3796
3794 EXPECT_TRUE(modified_answer->Initialize(answer_copy, 3797 EXPECT_TRUE(modified_answer->Initialize(answer_copy,
3795 answer->session_id(), 3798 answer->session_id(),
3796 answer->session_version())); 3799 answer->session_version()));
3797 SetLocalDescriptionAnswerExpectError(kMlineMismatch, modified_answer); 3800 SetLocalDescriptionAnswerExpectError(kMlineMismatchInAnswer, modified_answer);
3798 SetLocalDescriptionWithoutError(answer); 3801 SetLocalDescriptionWithoutError(answer);
3799 } 3802 }
3800 3803
3801 // This test verifies that WebRtcSession does not start candidate allocation 3804 // This test verifies that WebRtcSession does not start candidate allocation
3802 // before SetLocalDescription is called. 3805 // before SetLocalDescription is called.
3803 TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) { 3806 TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) {
3804 Init(); 3807 Init();
3805 SendAudioVideoStream1(); 3808 SendAudioVideoStream1();
3806 SessionDescriptionInterface* offer = CreateRemoteOffer(); 3809 SessionDescriptionInterface* offer = CreateRemoteOffer();
3807 cricket::Candidate candidate; 3810 cricket::Candidate candidate;
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
4569 } 4572 }
4570 4573
4571 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4574 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4572 // currently fails because upon disconnection and reconnection OnIceComplete is 4575 // currently fails because upon disconnection and reconnection OnIceComplete is
4573 // called more than once without returning to IceGatheringGathering. 4576 // called more than once without returning to IceGatheringGathering.
4574 4577
4575 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4578 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4576 WebRtcSessionTest, 4579 WebRtcSessionTest,
4577 testing::Values(ALREADY_GENERATED, 4580 testing::Values(ALREADY_GENERATED,
4578 DTLS_IDENTITY_STORE)); 4581 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « webrtc/pc/webrtcsession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698