OLD | NEW |
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 Loading... |
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 3653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3737 CreateRemoteAnswer(session_->local_description())); | 3737 CreateRemoteAnswer(session_->local_description())); |
3738 | 3738 |
3739 cricket::SessionDescription* answer_copy = answer->description()->Copy(); | 3739 cricket::SessionDescription* answer_copy = answer->description()->Copy(); |
3740 answer_copy->RemoveContentByName("video"); | 3740 answer_copy->RemoveContentByName("video"); |
3741 JsepSessionDescription* modified_answer = | 3741 JsepSessionDescription* modified_answer = |
3742 new JsepSessionDescription(JsepSessionDescription::kAnswer); | 3742 new JsepSessionDescription(JsepSessionDescription::kAnswer); |
3743 | 3743 |
3744 EXPECT_TRUE(modified_answer->Initialize(answer_copy, | 3744 EXPECT_TRUE(modified_answer->Initialize(answer_copy, |
3745 answer->session_id(), | 3745 answer->session_id(), |
3746 answer->session_version())); | 3746 answer->session_version())); |
3747 SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer); | 3747 SetRemoteDescriptionAnswerExpectError(kMlineMismatchInAnswer, |
| 3748 modified_answer); |
3748 | 3749 |
3749 // Different content names. | 3750 // Different content names. |
3750 std::string sdp; | 3751 std::string sdp; |
3751 EXPECT_TRUE(answer->ToString(&sdp)); | 3752 EXPECT_TRUE(answer->ToString(&sdp)); |
3752 const std::string kAudioMid = "a=mid:audio"; | 3753 const std::string kAudioMid = "a=mid:audio"; |
3753 const std::string kAudioMidReplaceStr = "a=mid:audio_content_name"; | 3754 const std::string kAudioMidReplaceStr = "a=mid:audio_content_name"; |
3754 rtc::replace_substrs(kAudioMid.c_str(), kAudioMid.length(), | 3755 rtc::replace_substrs(kAudioMid.c_str(), kAudioMid.length(), |
3755 kAudioMidReplaceStr.c_str(), | 3756 kAudioMidReplaceStr.c_str(), |
3756 kAudioMidReplaceStr.length(), | 3757 kAudioMidReplaceStr.length(), |
3757 &sdp); | 3758 &sdp); |
3758 SessionDescriptionInterface* modified_answer1 = | 3759 SessionDescriptionInterface* modified_answer1 = |
3759 CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL); | 3760 CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL); |
3760 SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer1); | 3761 SetRemoteDescriptionAnswerExpectError(kMlineMismatchInAnswer, |
| 3762 modified_answer1); |
3761 | 3763 |
3762 // Different media types. | 3764 // Different media types. |
3763 EXPECT_TRUE(answer->ToString(&sdp)); | 3765 EXPECT_TRUE(answer->ToString(&sdp)); |
3764 const std::string kAudioMline = "m=audio"; | 3766 const std::string kAudioMline = "m=audio"; |
3765 const std::string kAudioMlineReplaceStr = "m=video"; | 3767 const std::string kAudioMlineReplaceStr = "m=video"; |
3766 rtc::replace_substrs(kAudioMline.c_str(), kAudioMline.length(), | 3768 rtc::replace_substrs(kAudioMline.c_str(), kAudioMline.length(), |
3767 kAudioMlineReplaceStr.c_str(), | 3769 kAudioMlineReplaceStr.c_str(), |
3768 kAudioMlineReplaceStr.length(), | 3770 kAudioMlineReplaceStr.length(), |
3769 &sdp); | 3771 &sdp); |
3770 SessionDescriptionInterface* modified_answer2 = | 3772 SessionDescriptionInterface* modified_answer2 = |
3771 CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL); | 3773 CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL); |
3772 SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer2); | 3774 SetRemoteDescriptionAnswerExpectError(kMlineMismatchInAnswer, |
| 3775 modified_answer2); |
3773 | 3776 |
3774 SetRemoteDescriptionWithoutError(answer.release()); | 3777 SetRemoteDescriptionWithoutError(answer.release()); |
3775 } | 3778 } |
3776 | 3779 |
3777 // Verifying remote offer and local answer have matching m-lines as per | 3780 // Verifying remote offer and local answer have matching m-lines as per |
3778 // RFC 3264. | 3781 // RFC 3264. |
3779 TEST_F(WebRtcSessionTest, TestIncorrectMLinesInLocalAnswer) { | 3782 TEST_F(WebRtcSessionTest, TestIncorrectMLinesInLocalAnswer) { |
3780 Init(); | 3783 Init(); |
3781 SendAudioVideoStream1(); | 3784 SendAudioVideoStream1(); |
3782 SessionDescriptionInterface* offer = CreateRemoteOffer(); | 3785 SessionDescriptionInterface* offer = CreateRemoteOffer(); |
3783 SetRemoteDescriptionWithoutError(offer); | 3786 SetRemoteDescriptionWithoutError(offer); |
3784 SessionDescriptionInterface* answer = CreateAnswer(); | 3787 SessionDescriptionInterface* answer = CreateAnswer(); |
3785 | 3788 |
3786 cricket::SessionDescription* answer_copy = answer->description()->Copy(); | 3789 cricket::SessionDescription* answer_copy = answer->description()->Copy(); |
3787 answer_copy->RemoveContentByName("video"); | 3790 answer_copy->RemoveContentByName("video"); |
3788 JsepSessionDescription* modified_answer = | 3791 JsepSessionDescription* modified_answer = |
3789 new JsepSessionDescription(JsepSessionDescription::kAnswer); | 3792 new JsepSessionDescription(JsepSessionDescription::kAnswer); |
3790 | 3793 |
3791 EXPECT_TRUE(modified_answer->Initialize(answer_copy, | 3794 EXPECT_TRUE(modified_answer->Initialize(answer_copy, |
3792 answer->session_id(), | 3795 answer->session_id(), |
3793 answer->session_version())); | 3796 answer->session_version())); |
3794 SetLocalDescriptionAnswerExpectError(kMlineMismatch, modified_answer); | 3797 SetLocalDescriptionAnswerExpectError(kMlineMismatchInAnswer, modified_answer); |
3795 SetLocalDescriptionWithoutError(answer); | 3798 SetLocalDescriptionWithoutError(answer); |
3796 } | 3799 } |
3797 | 3800 |
3798 // This test verifies that WebRtcSession does not start candidate allocation | 3801 // This test verifies that WebRtcSession does not start candidate allocation |
3799 // before SetLocalDescription is called. | 3802 // before SetLocalDescription is called. |
3800 TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) { | 3803 TEST_F(WebRtcSessionTest, TestIceStartAfterSetLocalDescriptionOnly) { |
3801 Init(); | 3804 Init(); |
3802 SendAudioVideoStream1(); | 3805 SendAudioVideoStream1(); |
3803 SessionDescriptionInterface* offer = CreateRemoteOffer(); | 3806 SessionDescriptionInterface* offer = CreateRemoteOffer(); |
3804 cricket::Candidate candidate; | 3807 cricket::Candidate candidate; |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4566 } | 4569 } |
4567 | 4570 |
4568 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4571 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4569 // currently fails because upon disconnection and reconnection OnIceComplete is | 4572 // currently fails because upon disconnection and reconnection OnIceComplete is |
4570 // called more than once without returning to IceGatheringGathering. | 4573 // called more than once without returning to IceGatheringGathering. |
4571 | 4574 |
4572 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4575 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4573 WebRtcSessionTest, | 4576 WebRtcSessionTest, |
4574 testing::Values(ALREADY_GENERATED, | 4577 testing::Values(ALREADY_GENERATED, |
4575 DTLS_IDENTITY_STORE)); | 4578 DTLS_IDENTITY_STORE)); |
OLD | NEW |