OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); | 2801 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); |
2802 | 2802 |
2803 sdp.clear(); | 2803 sdp.clear(); |
2804 ModifyIceUfragPwdLines(offer.get(), kTooLongIceUfragPwd, kTooLongIceUfragPwd, | 2804 ModifyIceUfragPwdLines(offer.get(), kTooLongIceUfragPwd, kTooLongIceUfragPwd, |
2805 &sdp); | 2805 &sdp); |
2806 modified_offer = CreateSessionDescription(JsepSessionDescription::kOffer, sdp, | 2806 modified_offer = CreateSessionDescription(JsepSessionDescription::kOffer, sdp, |
2807 NULL); | 2807 NULL); |
2808 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); | 2808 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); |
2809 } | 2809 } |
2810 | 2810 |
2811 // Test that if the remote description indicates the peer requested ICE restart | 2811 // Test that if the remote offer indicates the peer requested ICE restart (via |
2812 // (via a new ufrag or pwd), the old ICE candidates are not copied, | 2812 // a new ufrag or pwd), the old ICE candidates are not copied, and vice versa. |
2813 // and vice versa. | 2813 TEST_F(WebRtcSessionTest, TestSetRemoteOfferWithIceRestart) { |
2814 TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithIceRestart) { | |
2815 Init(); | 2814 Init(); |
2816 scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer()); | 2815 scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer()); |
2817 | 2816 |
2818 // Create the first offer. | 2817 // Create the first offer. |
2819 std::string sdp; | 2818 std::string sdp; |
2820 ModifyIceUfragPwdLines(offer.get(), "0123456789012345", | 2819 ModifyIceUfragPwdLines(offer.get(), "0123456789012345", |
2821 "abcdefghijklmnopqrstuvwx", &sdp); | 2820 "abcdefghijklmnopqrstuvwx", &sdp); |
2822 SessionDescriptionInterface* offer1 = | 2821 SessionDescriptionInterface* offer1 = |
2823 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); | 2822 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); |
2824 cricket::Candidate candidate1(1, "udp", rtc::SocketAddress("1.1.1.1", 5000), | 2823 cricket::Candidate candidate1(1, "udp", rtc::SocketAddress("1.1.1.1", 5000), |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2858 // The fourth offer has no candidate but a different ufrag/pwd. | 2857 // The fourth offer has no candidate but a different ufrag/pwd. |
2859 sdp.clear(); | 2858 sdp.clear(); |
2860 ModifyIceUfragPwdLines(offer.get(), "0123456789012444", | 2859 ModifyIceUfragPwdLines(offer.get(), "0123456789012444", |
2861 "abcdefghijklmnopqrstuvyz", &sdp); | 2860 "abcdefghijklmnopqrstuvyz", &sdp); |
2862 SessionDescriptionInterface* offer4 = | 2861 SessionDescriptionInterface* offer4 = |
2863 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); | 2862 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); |
2864 SetRemoteDescriptionWithoutError(offer4); | 2863 SetRemoteDescriptionWithoutError(offer4); |
2865 EXPECT_EQ(0, session_->remote_description()->candidates(0)->count()); | 2864 EXPECT_EQ(0, session_->remote_description()->candidates(0)->count()); |
2866 } | 2865 } |
2867 | 2866 |
| 2867 // Test that if the remote answer indicates the peer requested ICE restart (via |
| 2868 // a new ufrag or pwd), the old ICE candidates are not copied, and vice versa. |
| 2869 TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithIceRestart) { |
| 2870 Init(); |
| 2871 SessionDescriptionInterface* offer = CreateOffer(); |
| 2872 SetLocalDescriptionWithoutError(offer); |
| 2873 scoped_ptr<SessionDescriptionInterface> answer(CreateRemoteAnswer(offer)); |
| 2874 |
| 2875 // Create the first answer. |
| 2876 std::string sdp; |
| 2877 ModifyIceUfragPwdLines(answer.get(), "0123456789012345", |
| 2878 "abcdefghijklmnopqrstuvwx", &sdp); |
| 2879 SessionDescriptionInterface* answer1 = |
| 2880 CreateSessionDescription(JsepSessionDescription::kPrAnswer, sdp, NULL); |
| 2881 cricket::Candidate candidate1(1, "udp", rtc::SocketAddress("1.1.1.1", 5000), |
| 2882 0, "", "", "relay", 0, ""); |
| 2883 JsepIceCandidate ice_candidate1(kMediaContentName0, kMediaContentIndex0, |
| 2884 candidate1); |
| 2885 EXPECT_TRUE(answer1->AddCandidate(&ice_candidate1)); |
| 2886 SetRemoteDescriptionWithoutError(answer1); |
| 2887 EXPECT_EQ(1, session_->remote_description()->candidates(0)->count()); |
| 2888 |
| 2889 // The second answer has the same ufrag and pwd but different address. |
| 2890 sdp.clear(); |
| 2891 ModifyIceUfragPwdLines(answer.get(), "0123456789012345", |
| 2892 "abcdefghijklmnopqrstuvwx", &sdp); |
| 2893 SessionDescriptionInterface* answer2 = |
| 2894 CreateSessionDescription(JsepSessionDescription::kPrAnswer, sdp, NULL); |
| 2895 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 6000)); |
| 2896 JsepIceCandidate ice_candidate2(kMediaContentName0, kMediaContentIndex0, |
| 2897 candidate1); |
| 2898 EXPECT_TRUE(answer2->AddCandidate(&ice_candidate2)); |
| 2899 SetRemoteDescriptionWithoutError(answer2); |
| 2900 EXPECT_EQ(2, session_->remote_description()->candidates(0)->count()); |
| 2901 |
| 2902 // The third answer has a different ufrag and different address. |
| 2903 sdp.clear(); |
| 2904 ModifyIceUfragPwdLines(answer.get(), "0123456789012333", |
| 2905 "abcdefghijklmnopqrstuvwx", &sdp); |
| 2906 SessionDescriptionInterface* answer3 = |
| 2907 CreateSessionDescription(JsepSessionDescription::kPrAnswer, sdp, NULL); |
| 2908 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 7000)); |
| 2909 JsepIceCandidate ice_candidate3(kMediaContentName0, kMediaContentIndex0, |
| 2910 candidate1); |
| 2911 EXPECT_TRUE(answer3->AddCandidate(&ice_candidate3)); |
| 2912 SetRemoteDescriptionWithoutError(answer3); |
| 2913 EXPECT_EQ(1, session_->remote_description()->candidates(0)->count()); |
| 2914 |
| 2915 // The fourth answer has no candidate but a different ufrag/pwd. |
| 2916 sdp.clear(); |
| 2917 ModifyIceUfragPwdLines(answer.get(), "0123456789012444", |
| 2918 "abcdefghijklmnopqrstuvyz", &sdp); |
| 2919 SessionDescriptionInterface* offer4 = |
| 2920 CreateSessionDescription(JsepSessionDescription::kPrAnswer, sdp, NULL); |
| 2921 SetRemoteDescriptionWithoutError(offer4); |
| 2922 EXPECT_EQ(0, session_->remote_description()->candidates(0)->count()); |
| 2923 } |
| 2924 |
2868 // Test that candidates sent to the "video" transport do not get pushed down to | 2925 // Test that candidates sent to the "video" transport do not get pushed down to |
2869 // the "audio" transport channel when bundling. | 2926 // the "audio" transport channel when bundling. |
2870 TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) { | 2927 TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) { |
2871 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 2928 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
2872 | 2929 |
2873 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); | 2930 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); |
2874 SendAudioVideoStream1(); | 2931 SendAudioVideoStream1(); |
2875 | 2932 |
2876 PeerConnectionInterface::RTCOfferAnswerOptions options; | 2933 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2877 options.use_rtp_mux = true; | 2934 options.use_rtp_mux = true; |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4203 } | 4260 } |
4204 | 4261 |
4205 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4262 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4206 // currently fails because upon disconnection and reconnection OnIceComplete is | 4263 // currently fails because upon disconnection and reconnection OnIceComplete is |
4207 // called more than once without returning to IceGatheringGathering. | 4264 // called more than once without returning to IceGatheringGathering. |
4208 | 4265 |
4209 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4266 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4210 WebRtcSessionTest, | 4267 WebRtcSessionTest, |
4211 testing::Values(ALREADY_GENERATED, | 4268 testing::Values(ALREADY_GENERATED, |
4212 DTLS_IDENTITY_STORE)); | 4269 DTLS_IDENTITY_STORE)); |
OLD | NEW |