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

Side by Side Diff: talk/app/webrtc/webrtcsession_unittest.cc

Issue 1496693002: Discard old-generation candidates when ICE restarts (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years 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 | « talk/app/webrtc/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 * 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 2788 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); 2799 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error));
2800 2800
2801 sdp.clear(); 2801 sdp.clear();
2802 ModifyIceUfragPwdLines(offer.get(), kTooLongIceUfragPwd, kTooLongIceUfragPwd, 2802 ModifyIceUfragPwdLines(offer.get(), kTooLongIceUfragPwd, kTooLongIceUfragPwd,
2803 &sdp); 2803 &sdp);
2804 modified_offer = CreateSessionDescription(JsepSessionDescription::kOffer, sdp, 2804 modified_offer = CreateSessionDescription(JsepSessionDescription::kOffer, sdp,
2805 NULL); 2805 NULL);
2806 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); 2806 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error));
2807 } 2807 }
2808 2808
2809 // Test that if the remote description indicates the peer requested ICE restart 2809 // Test that if the remote offer indicates the peer requested ICE restart (via
2810 // (via a new ufrag or pwd), the old ICE candidates are not copied, 2810 // a new ufrag or pwd), the old ICE candidates are not copied, and vice versa.
2811 // and vice versa. 2811 TEST_F(WebRtcSessionTest, TestSetRemoteOfferWithIceRestart) {
2812 TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithIceRestart) {
2813 Init(); 2812 Init();
2814 scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer()); 2813 scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer());
2815 2814
2816 // Create the first offer. 2815 // Create the first offer.
2817 std::string sdp; 2816 std::string sdp;
2818 ModifyIceUfragPwdLines(offer.get(), "0123456789012345", 2817 ModifyIceUfragPwdLines(offer.get(), "0123456789012345",
2819 "abcdefghijklmnopqrstuvwx", &sdp); 2818 "abcdefghijklmnopqrstuvwx", &sdp);
2820 SessionDescriptionInterface* offer1 = 2819 SessionDescriptionInterface* offer1 =
2821 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); 2820 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL);
2822 cricket::Candidate candidate1(1, "udp", rtc::SocketAddress("1.1.1.1", 5000), 2821 cricket::Candidate candidate1(1, "udp", rtc::SocketAddress("1.1.1.1", 5000),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 // The fourth offer has no candidate but a different ufrag/pwd. 2855 // The fourth offer has no candidate but a different ufrag/pwd.
2857 sdp.clear(); 2856 sdp.clear();
2858 ModifyIceUfragPwdLines(offer.get(), "0123456789012444", 2857 ModifyIceUfragPwdLines(offer.get(), "0123456789012444",
2859 "abcdefghijklmnopqrstuvyz", &sdp); 2858 "abcdefghijklmnopqrstuvyz", &sdp);
2860 SessionDescriptionInterface* offer4 = 2859 SessionDescriptionInterface* offer4 =
2861 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); 2860 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL);
2862 SetRemoteDescriptionWithoutError(offer4); 2861 SetRemoteDescriptionWithoutError(offer4);
2863 EXPECT_EQ(0, session_->remote_description()->candidates(0)->count()); 2862 EXPECT_EQ(0, session_->remote_description()->candidates(0)->count());
2864 } 2863 }
2865 2864
2865 // Test that if the remote answer indicates the peer requested ICE restart (via
2866 // a new ufrag or pwd), the old ICE candidates are not copied, and vice versa.
2867 TEST_F(WebRtcSessionTest, TestSetRemoteAnswerWithIceRestart) {
2868 Init();
2869 SessionDescriptionInterface* offer = CreateOffer();
2870 SetLocalDescriptionWithoutError(offer);
2871 scoped_ptr<SessionDescriptionInterface> answer(CreateRemoteAnswer(offer));
2872
2873 // Create the first answer.
2874 std::string sdp;
2875 ModifyIceUfragPwdLines(answer.get(), "0123456789012345",
2876 "abcdefghijklmnopqrstuvwx", &sdp);
2877 SessionDescriptionInterface* answer1 =
2878 CreateSessionDescription(JsepSessionDescription::kPrAnswer, sdp, NULL);
2879 cricket::Candidate candidate1(1, "udp", rtc::SocketAddress("1.1.1.1", 5000),
2880 0, "", "", "relay", 0, "");
2881 JsepIceCandidate ice_candidate1(kMediaContentName0, kMediaContentIndex0,
2882 candidate1);
2883 EXPECT_TRUE(answer1->AddCandidate(&ice_candidate1));
2884 SetRemoteDescriptionWithoutError(answer1);
2885 EXPECT_EQ(1, session_->remote_description()->candidates(0)->count());
2886
2887 // The second answer has the same ufrag and pwd but different address.
2888 sdp.clear();
2889 ModifyIceUfragPwdLines(answer.get(), "0123456789012345",
2890 "abcdefghijklmnopqrstuvwx", &sdp);
2891 SessionDescriptionInterface* answer2 =
2892 CreateSessionDescription(JsepSessionDescription::kPrAnswer, sdp, NULL);
2893 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 6000));
2894 JsepIceCandidate ice_candidate2(kMediaContentName0, kMediaContentIndex0,
2895 candidate1);
2896 EXPECT_TRUE(answer2->AddCandidate(&ice_candidate2));
2897 SetRemoteDescriptionWithoutError(answer2);
2898 EXPECT_EQ(2, session_->remote_description()->candidates(0)->count());
2899
2900 // The third answer has a different ufrag and different address.
2901 sdp.clear();
2902 ModifyIceUfragPwdLines(answer.get(), "0123456789012333",
2903 "abcdefghijklmnopqrstuvwx", &sdp);
2904 SessionDescriptionInterface* answer3 =
2905 CreateSessionDescription(JsepSessionDescription::kPrAnswer, sdp, NULL);
2906 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 7000));
2907 JsepIceCandidate ice_candidate3(kMediaContentName0, kMediaContentIndex0,
2908 candidate1);
2909 EXPECT_TRUE(answer3->AddCandidate(&ice_candidate3));
2910 SetRemoteDescriptionWithoutError(answer3);
2911 EXPECT_EQ(1, session_->remote_description()->candidates(0)->count());
2912
2913 // The fourth answer has no candidate but a different ufrag/pwd.
2914 sdp.clear();
2915 ModifyIceUfragPwdLines(answer.get(), "0123456789012444",
2916 "abcdefghijklmnopqrstuvyz", &sdp);
2917 SessionDescriptionInterface* offer4 =
2918 CreateSessionDescription(JsepSessionDescription::kPrAnswer, sdp, NULL);
2919 SetRemoteDescriptionWithoutError(offer4);
2920 EXPECT_EQ(0, session_->remote_description()->candidates(0)->count());
2921 }
2922
2866 // Test that candidates sent to the "video" transport do not get pushed down to 2923 // Test that candidates sent to the "video" transport do not get pushed down to
2867 // the "audio" transport channel when bundling. 2924 // the "audio" transport channel when bundling.
2868 TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) { 2925 TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) {
2869 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); 2926 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort));
2870 2927
2871 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); 2928 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced);
2872 SendAudioVideoStream1(); 2929 SendAudioVideoStream1();
2873 2930
2874 PeerConnectionInterface::RTCOfferAnswerOptions options; 2931 PeerConnectionInterface::RTCOfferAnswerOptions options;
2875 options.use_rtp_mux = true; 2932 options.use_rtp_mux = true;
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
4200 } 4257 }
4201 4258
4202 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4259 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4203 // currently fails because upon disconnection and reconnection OnIceComplete is 4260 // currently fails because upon disconnection and reconnection OnIceComplete is
4204 // called more than once without returning to IceGatheringGathering. 4261 // called more than once without returning to IceGatheringGathering.
4205 4262
4206 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4263 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4207 WebRtcSessionTest, 4264 WebRtcSessionTest,
4208 testing::Values(ALREADY_GENERATED, 4265 testing::Values(ALREADY_GENERATED,
4209 DTLS_IDENTITY_STORE)); 4266 DTLS_IDENTITY_STORE));
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698