Explicitly wrap main thread in test_main.cc.
Bug: webrtc:9714 Change-Id: I6ee234f9a0b88b3656a683f2455c3e4b2acf0d54 Reviewed-on: https://webrtc-review.googlesource.com/97683 Reviewed-by: Tommi <tommi@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24560}
This commit is contained in:
@ -163,11 +163,15 @@ void MessageQueueManager::ProcessAllMessageQueuesInternal() {
|
||||
new ScopedIncrement(&queues_not_done));
|
||||
}
|
||||
}
|
||||
// Note: One of the message queues may have been on this thread, which is why
|
||||
// we can't synchronously wait for queues_not_done to go to 0; we need to
|
||||
// process messages as well.
|
||||
while (AtomicOps::AcquireLoad(&queues_not_done) > 0) {
|
||||
rtc::Thread::Current()->ProcessMessages(0);
|
||||
|
||||
rtc::Thread* current = rtc::Thread::Current();
|
||||
if (current) {
|
||||
// Note: One of the message queues may have been on this thread, which is
|
||||
// why we can't synchronously wait for queues_not_done to go to 0; we need
|
||||
// to process messages as well.
|
||||
while (AtomicOps::AcquireLoad(&queues_not_done) > 0) {
|
||||
current->ProcessMessages(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ if (rtc_include_tests) {
|
||||
":field_trial",
|
||||
":fileutils",
|
||||
":perf_test",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"../rtc_base:rtc_base",
|
||||
"../system_wrappers:field_trial_default",
|
||||
"../system_wrappers:metrics_default",
|
||||
"../system_wrappers:runtime_enabled_features_default",
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "rtc_base/flags.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "system_wrappers/include/field_trial_default.h"
|
||||
#include "system_wrappers/include/metrics_default.h"
|
||||
#include "test/field_trial.h"
|
||||
@ -87,6 +88,10 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
rtc::LogMessage::SetLogToStderr(FLAG_logs);
|
||||
|
||||
// Ensure that main thread gets wrapped as an rtc::Thread.
|
||||
rtc::ThreadManager::Instance()->WrapCurrentThread();
|
||||
RTC_CHECK(rtc::Thread::Current());
|
||||
|
||||
#if defined(WEBRTC_IOS)
|
||||
|
||||
rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv,
|
||||
|
Reference in New Issue
Block a user