Do not stop SingleThreadedTaskQueueForTestingTest near the end of the tests
That brings usage of that queue closer to the production.
In particular that should surface race conditions on destruction.
Those should be fixed rather than avoided.
Bug: webrtc:10933
Change-Id: Iff60cf5a4b87bd848117ef543ffc97f6504dc979
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157898
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29665}
diff --git a/call/rampup_tests.cc b/call/rampup_tests.cc
index 9c7a267..0377126 100644
--- a/call/rampup_tests.cc
+++ b/call/rampup_tests.cc
@@ -91,10 +91,7 @@
EXPECT_LE(num_audio_streams_, 1u);
}
-RampUpTester::~RampUpTester() {
- // Special case for WebRTC-QuickPerfTest/Enabled/
- SendTask(RTC_FROM_HERE, task_queue_, [this] { pending_task_.Stop(); });
-}
+RampUpTester::~RampUpTester() = default;
void RampUpTester::ModifySenderBitrateConfig(
BitrateConstraints* bitrate_config) {
diff --git a/test/call_test.cc b/test/call_test.cc
index 51ddaa3..d83f87a 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -58,19 +58,7 @@
audio_encoder_factory_(CreateBuiltinAudioEncoderFactory()),
task_queue_("CallTestTaskQueue") {}
-CallTest::~CallTest() {
- // In most cases the task_queue_ should have been stopped by now, assuming
- // the regular path of using CallTest to call PerformTest (followed by
- // cleanup). However, there are some tests that don't use the class that way
- // hence we need this special handling for cleaning up.
- if (task_queue_.IsRunning()) {
- SendTask(RTC_FROM_HERE, &task_queue_, [this]() {
- fake_send_audio_device_ = nullptr;
- fake_recv_audio_device_ = nullptr;
- video_sources_.clear();
- });
- }
-}
+CallTest::~CallTest() = default;
void CallTest::RegisterRtpExtension(const RtpExtension& extension) {
for (const RtpExtension& registered_extension : rtp_extensions_) {
@@ -209,15 +197,6 @@
fake_send_audio_device_ = nullptr;
fake_recv_audio_device_ = nullptr;
});
-
- // To avoid a race condition during destruction, which can happen while
- // a derived class is being destructed but pending tasks might still run
- // because the |task_queue_| is still in scope, we stop the TQ here.
- // Note that tests should not be posting more tasks during teardown but
- // as is, that's hard to control with the current test harness. E.g. transport
- // classes continue to issue callbacks (e.g. OnSendRtp) during teardown, which
- // can have a ripple effect.
- task_queue_.Stop();
}
void CallTest::CreateCalls() {