| Index: webrtc/api/peerconnection_unittest.cc
|
| diff --git a/webrtc/api/peerconnection_unittest.cc b/webrtc/api/peerconnection_unittest.cc
|
| index 406fab0d89eb6cc13d397a1ac668a87fca043b6e..ca6e545d16596c8f9a699627fbda5bf7db8291ba 100644
|
| --- a/webrtc/api/peerconnection_unittest.cc
|
| +++ b/webrtc/api/peerconnection_unittest.cc
|
| @@ -392,6 +392,13 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
|
|
|
| bool ExpectIceRestart() const { return expect_ice_restart_; }
|
|
|
| + void SetExpectIceRenomination() { expect_ice_renomination_ = true; }
|
| + void SetExpectRemoteIceRenomination(bool expect_renomination) {
|
| + expect_remote_ice_renomination_ = expect_renomination;
|
| + }
|
| + bool ExpectIceRenomination() { return expect_ice_renomination_; }
|
| + bool ExpectRemoteIceRenomination() { return expect_remote_ice_renomination_; }
|
| +
|
| void SetReceiveAudioVideo(bool audio, bool video) {
|
| SetReceiveAudio(audio);
|
| SetReceiveVideo(video);
|
| @@ -669,6 +676,42 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
|
| }
|
| }
|
|
|
| + void VerifyLocalIceRenomination() {
|
| + ASSERT_TRUE(peer_connection_->local_description() != nullptr);
|
| + const cricket::SessionDescription* desc =
|
| + peer_connection_->local_description()->description();
|
| + const cricket::ContentInfos& contents = desc->contents();
|
| +
|
| + for (auto content : contents) {
|
| + if (content.rejected)
|
| + continue;
|
| + const cricket::TransportDescription* transport_desc =
|
| + desc->GetTransportDescriptionByName(content.name);
|
| + const auto& options = transport_desc->transport_options;
|
| + auto iter = std::find(options.begin(), options.end(),
|
| + cricket::ICE_RENOMINATION_STR);
|
| + EXPECT_EQ(ExpectIceRenomination(), iter != options.end());
|
| + }
|
| + }
|
| +
|
| + void VerifyRemoteIceRenomination() {
|
| + ASSERT_TRUE(peer_connection_->remote_description() != nullptr);
|
| + const cricket::SessionDescription* desc =
|
| + peer_connection_->remote_description()->description();
|
| + const cricket::ContentInfos& contents = desc->contents();
|
| +
|
| + for (auto content : contents) {
|
| + if (content.rejected)
|
| + continue;
|
| + const cricket::TransportDescription* transport_desc =
|
| + desc->GetTransportDescriptionByName(content.name);
|
| + const auto& options = transport_desc->transport_options;
|
| + auto iter = std::find(options.begin(), options.end(),
|
| + cricket::ICE_RENOMINATION_STR);
|
| + EXPECT_EQ(ExpectRemoteIceRenomination(), iter != options.end());
|
| + }
|
| + }
|
| +
|
| int GetAudioOutputLevelStats(webrtc::MediaStreamTrackInterface* track) {
|
| rtc::scoped_refptr<MockStatsObserver>
|
| observer(new rtc::RefCountedObject<MockStatsObserver>());
|
| @@ -1029,6 +1072,8 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
|
| typedef std::pair<std::string, std::string> IceUfragPwdPair;
|
| std::map<int, IceUfragPwdPair> ice_ufrag_pwd_;
|
| bool expect_ice_restart_ = false;
|
| + bool expect_ice_renomination_ = false;
|
| + bool expect_remote_ice_renomination_ = false;
|
|
|
| // Needed to keep track of number of frames sent.
|
| rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
|
| @@ -2065,6 +2110,32 @@ TEST_F(P2PTestConductor, IceRestart) {
|
| EXPECT_NE(receiver_candidate, receiver_candidate_restart);
|
| }
|
|
|
| +TEST_F(P2PTestConductor, IceRenominationDisabled) {
|
| + config()->ice_renomination = false;
|
| + ASSERT_TRUE(CreateTestClients());
|
| + LocalP2PTest();
|
| +
|
| + initializing_client()->VerifyLocalIceRenomination();
|
| + receiving_client()->VerifyLocalIceRenomination();
|
| + initializing_client()->VerifyRemoteIceRenomination();
|
| + receiving_client()->VerifyRemoteIceRenomination();
|
| +}
|
| +
|
| +TEST_F(P2PTestConductor, IceRenominationEnabled) {
|
| + config()->ice_renomination = true;
|
| + ASSERT_TRUE(CreateTestClients());
|
| + initializing_client()->SetExpectIceRenomination();
|
| + initializing_client()->SetExpectRemoteIceRenomination(true);
|
| + receiving_client()->SetExpectIceRenomination();
|
| + receiving_client()->SetExpectRemoteIceRenomination(true);
|
| + LocalP2PTest();
|
| +
|
| + initializing_client()->VerifyLocalIceRenomination();
|
| + receiving_client()->VerifyLocalIceRenomination();
|
| + initializing_client()->VerifyRemoteIceRenomination();
|
| + receiving_client()->VerifyRemoteIceRenomination();
|
| +}
|
| +
|
| // This test sets up a call between two parties with audio, and video.
|
| // It then renegotiates setting the video m-line to "port 0", then later
|
| // renegotiates again, enabling video.
|
|
|