Reinstate old iceConnectionState "completed" behavior

The old iceConnectionState only becomes completed on the controlling side, and only if we're not configured to continually gather ICE candidates. This change makes the new ICE connection state do the same thing.

Bug: webrtc:10356
Change-Id: I82ca854a638a52674e4ca43364cf454dacb0cf1e
Reviewed-on: https://webrtc-review.googlesource.com/c/124360
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26950}
This commit is contained in:
Jonas Olsson
2019-02-25 15:26:24 +01:00
committed by Commit Bot
parent 0a16916ac8
commit acd8ae74ac
2 changed files with 35 additions and 3 deletions

View File

@ -281,6 +281,13 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
ice_connection_state_history_.clear();
}
// Every standardized ICE connection state in order that has been seen by the
// observer.
std::vector<PeerConnectionInterface::IceConnectionState>
standardized_ice_connection_state_history() const {
return standardized_ice_connection_state_history_;
}
// Every PeerConnection state in order that has been seen by the observer.
std::vector<PeerConnectionInterface::PeerConnectionState>
peer_connection_state_history() const {
@ -894,6 +901,10 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
EXPECT_EQ(pc()->ice_connection_state(), new_state);
ice_connection_state_history_.push_back(new_state);
}
void OnStandardizedIceConnectionChange(
webrtc::PeerConnectionInterface::IceConnectionState new_state) override {
standardized_ice_connection_state_history_.push_back(new_state);
}
void OnConnectionChange(
webrtc::PeerConnectionInterface::PeerConnectionState new_state) override {
peer_connection_state_history_.push_back(new_state);
@ -981,6 +992,8 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
std::vector<PeerConnectionInterface::IceConnectionState>
ice_connection_state_history_;
std::vector<PeerConnectionInterface::IceConnectionState>
standardized_ice_connection_state_history_;
std::vector<PeerConnectionInterface::PeerConnectionState>
peer_connection_state_history_;
std::vector<PeerConnectionInterface::IceGatheringState>
@ -3928,7 +3941,7 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, VerifyIceStates) {
ASSERT_EQ(PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state());
ASSERT_EQ(PeerConnectionInterface::kIceConnectionConnected,
ASSERT_EQ(PeerConnectionInterface::kIceConnectionCompleted,
caller()->standardized_ice_connection_state());
// Verify that the observer was notified of the intermediate transitions.
@ -3936,6 +3949,10 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, VerifyIceStates) {
ElementsAre(PeerConnectionInterface::kIceConnectionChecking,
PeerConnectionInterface::kIceConnectionConnected,
PeerConnectionInterface::kIceConnectionCompleted));
EXPECT_THAT(caller()->standardized_ice_connection_state_history(),
ElementsAre(PeerConnectionInterface::kIceConnectionChecking,
PeerConnectionInterface::kIceConnectionConnected,
PeerConnectionInterface::kIceConnectionCompleted));
EXPECT_THAT(
caller()->peer_connection_state_history(),
ElementsAre(PeerConnectionInterface::PeerConnectionState::kConnecting,
@ -3963,7 +3980,7 @@ TEST_P(PeerConnectionIntegrationIceStatesTest, VerifyIceStates) {
ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
caller()->ice_connection_state(), kDefaultTimeout,
fake_clock);
ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionConnected,
ASSERT_EQ_SIMULATED_WAIT(PeerConnectionInterface::kIceConnectionCompleted,
caller()->standardized_ice_connection_state(),
kDefaultTimeout, fake_clock);