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 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2573 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); | 2573 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); |
2574 | 2574 |
2575 sdp.clear(); | 2575 sdp.clear(); |
2576 ModifyIceUfragPwdLines(offer.get(), kTooLongIceUfragPwd, kTooLongIceUfragPwd, | 2576 ModifyIceUfragPwdLines(offer.get(), kTooLongIceUfragPwd, kTooLongIceUfragPwd, |
2577 &sdp); | 2577 &sdp); |
2578 modified_offer = CreateSessionDescription(JsepSessionDescription::kOffer, sdp, | 2578 modified_offer = CreateSessionDescription(JsepSessionDescription::kOffer, sdp, |
2579 NULL); | 2579 NULL); |
2580 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); | 2580 EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); |
2581 } | 2581 } |
2582 | 2582 |
| 2583 // Test that if the remote description indicates the peer requested ICE restart |
| 2584 // (via a new ufrag or pwd), the old ICE candidates are not copied, |
| 2585 // and vice versa. |
| 2586 TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionWithIceRestart) { |
| 2587 Init(); |
| 2588 scoped_ptr<SessionDescriptionInterface> offer(CreateRemoteOffer()); |
| 2589 |
| 2590 // Create the first offer. |
| 2591 std::string sdp; |
| 2592 ModifyIceUfragPwdLines(offer.get(), "0123456789012345", |
| 2593 "abcdefghijklmnopqrstuvwx", &sdp); |
| 2594 SessionDescriptionInterface* offer1 = |
| 2595 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); |
| 2596 cricket::Candidate candidate1(1, "udp", rtc::SocketAddress("1.1.1.1", 5000), |
| 2597 0, "", "", "relay", 0, ""); |
| 2598 JsepIceCandidate ice_candidate1(kMediaContentName0, kMediaContentIndex0, |
| 2599 candidate1); |
| 2600 EXPECT_TRUE(offer1->AddCandidate(&ice_candidate1)); |
| 2601 SetRemoteDescriptionWithoutError(offer1); |
| 2602 EXPECT_EQ(1, session_->remote_description()->candidates(0)->count()); |
| 2603 |
| 2604 // The second offer has the same ufrag and pwd but different address. |
| 2605 sdp.clear(); |
| 2606 ModifyIceUfragPwdLines(offer.get(), "0123456789012345", |
| 2607 "abcdefghijklmnopqrstuvwx", &sdp); |
| 2608 SessionDescriptionInterface* offer2 = |
| 2609 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); |
| 2610 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 6000)); |
| 2611 JsepIceCandidate ice_candidate2(kMediaContentName0, kMediaContentIndex0, |
| 2612 candidate1); |
| 2613 EXPECT_TRUE(offer2->AddCandidate(&ice_candidate2)); |
| 2614 SetRemoteDescriptionWithoutError(offer2); |
| 2615 EXPECT_EQ(2, session_->remote_description()->candidates(0)->count()); |
| 2616 |
| 2617 // The third offer has a different ufrag and different address. |
| 2618 sdp.clear(); |
| 2619 ModifyIceUfragPwdLines(offer.get(), "0123456789012333", |
| 2620 "abcdefghijklmnopqrstuvwx", &sdp); |
| 2621 SessionDescriptionInterface* offer3 = |
| 2622 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); |
| 2623 candidate1.set_address(rtc::SocketAddress("1.1.1.1", 7000)); |
| 2624 JsepIceCandidate ice_candidate3(kMediaContentName0, kMediaContentIndex0, |
| 2625 candidate1); |
| 2626 EXPECT_TRUE(offer3->AddCandidate(&ice_candidate3)); |
| 2627 SetRemoteDescriptionWithoutError(offer3); |
| 2628 EXPECT_EQ(1, session_->remote_description()->candidates(0)->count()); |
| 2629 |
| 2630 // The fourth offer has no candidate but a different ufrag/pwd. |
| 2631 sdp.clear(); |
| 2632 ModifyIceUfragPwdLines(offer.get(), "0123456789012444", |
| 2633 "abcdefghijklmnopqrstuvyz", &sdp); |
| 2634 SessionDescriptionInterface* offer4 = |
| 2635 CreateSessionDescription(JsepSessionDescription::kOffer, sdp, NULL); |
| 2636 SetRemoteDescriptionWithoutError(offer4); |
| 2637 EXPECT_EQ(0, session_->remote_description()->candidates(0)->count()); |
| 2638 } |
| 2639 |
2583 // Test that candidates sent to the "video" transport do not get pushed down to | 2640 // Test that candidates sent to the "video" transport do not get pushed down to |
2584 // the "audio" transport channel when bundling using TransportProxy. | 2641 // the "audio" transport channel when bundling using TransportProxy. |
2585 TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) { | 2642 TEST_F(WebRtcSessionTest, TestIgnoreCandidatesForUnusedTransportWhenBundling) { |
2586 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); | 2643 AddInterface(rtc::SocketAddress(kClientAddrHost1, kClientAddrPort)); |
2587 | 2644 |
2588 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); | 2645 InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); |
2589 mediastream_signaling_.SendAudioVideoStream1(); | 2646 mediastream_signaling_.SendAudioVideoStream1(); |
2590 | 2647 |
2591 PeerConnectionInterface::RTCOfferAnswerOptions options; | 2648 PeerConnectionInterface::RTCOfferAnswerOptions options; |
2592 options.use_rtp_mux = true; | 2649 options.use_rtp_mux = true; |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3884 // terminated. The offer creation may or may not have succeeded, but we | 3941 // terminated. The offer creation may or may not have succeeded, but we |
3885 // must have received a notification which, so the only invalid state | 3942 // must have received a notification which, so the only invalid state |
3886 // is kInit. | 3943 // is kInit. |
3887 EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state()); | 3944 EXPECT_NE(WebRtcSessionCreateSDPObserverForTest::kInit, o->state()); |
3888 } | 3945 } |
3889 } | 3946 } |
3890 | 3947 |
3891 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 3948 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
3892 // currently fails because upon disconnection and reconnection OnIceComplete is | 3949 // currently fails because upon disconnection and reconnection OnIceComplete is |
3893 // called more than once without returning to IceGatheringGathering. | 3950 // called more than once without returning to IceGatheringGathering. |
OLD | NEW |