Revert "Delay call to Destroy until after SignalDone has finished firing."

This reverts commit c7b8da453c2776a3e80fca3ff2400831adad03af.

Reason for revert: introduced a flaky test

Original change's description:
> Delay call to Destroy until after SignalDone has finished firing.
> 
> Bug: chromium:905542
> Change-Id: I0def33a3ac21bd0da4b77ef05d42a0e7ef66caec
> Reviewed-on: https://webrtc-review.googlesource.com/c/112163
> Commit-Queue: Zach Stein <zstein@webrtc.org>
> Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25807}

TBR=zstein@webrtc.org,qingsi@webrtc.org

Change-Id: Iae31fdfe16823f1061b433037eb1e498d8b33f28
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:905542
Reviewed-on: https://webrtc-review.googlesource.com/c/112217
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25809}
This commit is contained in:
Qingsi Wang 2018-11-27 23:43:23 +00:00 committed by Commit Bot
parent ab20b3f364
commit 889b587226
2 changed files with 3 additions and 11 deletions

View File

@ -1098,9 +1098,7 @@ void P2PTransportChannel::OnCandidateResolved(
Candidate candidate = p->candidate_;
resolvers_.erase(p);
AddRemoteCandidateWithResolver(candidate, resolver);
invoker_.AsyncInvoke<void>(
RTC_FROM_HERE, thread(),
rtc::Bind(&rtc::AsyncResolverInterface::Destroy, resolver, false));
resolver->Destroy(false);
}
void P2PTransportChannel::AddRemoteCandidateWithResolver(

View File

@ -4565,18 +4565,13 @@ TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest, TestTcpTurn) {
}
// Test that a resolver is created, asked for a result, and destroyed
// when the address is a hostname. The destruction should happen even
// if the channel is not destroyed.
// when the address is a hostname.
TEST(P2PTransportChannelResolverTest, HostnameCandidateIsResolved) {
rtc::MockAsyncResolver mock_async_resolver;
EXPECT_CALL(mock_async_resolver, GetError()).WillOnce(Return(0));
EXPECT_CALL(mock_async_resolver, GetResolvedAddress(_, _))
.WillOnce(Return(true));
// Destroy is called asynchronously after the address is resolved,
// so we need a variable to wait on.
bool destroy_called = false;
EXPECT_CALL(mock_async_resolver, Destroy(_))
.WillOnce(testing::Assign(&destroy_called, true));
EXPECT_CALL(mock_async_resolver, Destroy(_));
webrtc::MockAsyncResolverFactory mock_async_resolver_factory;
EXPECT_CALL(mock_async_resolver_factory, Create())
.WillOnce(Return(&mock_async_resolver));
@ -4591,7 +4586,6 @@ TEST(P2PTransportChannelResolverTest, HostnameCandidateIsResolved) {
ASSERT_EQ_WAIT(1u, channel.remote_candidates().size(), kDefaultTimeout);
const RemoteCandidate& candidate = channel.remote_candidates()[0];
EXPECT_FALSE(candidate.address().IsUnresolvedIP());
WAIT(destroy_called, kShortTimeout);
}
// Test that if we signal a hostname candidate after the remote endpoint