diff --git a/webrtc/base/base_tests.gyp b/webrtc/base/base_tests.gyp index 77bed2c6d6..457fbdcc4f 100644 --- a/webrtc/base/base_tests.gyp +++ b/webrtc/base/base_tests.gyp @@ -105,7 +105,7 @@ 'task_unittest.cc', 'testclient_unittest.cc', 'thread_checker_unittest.cc', - #'thread_unittest.cc', + 'thread_unittest.cc', #'timeutils_unittest.cc', 'urlencode_unittest.cc', #'versionparsing_unittest.cc', diff --git a/webrtc/base/thread.h b/webrtc/base/thread.h index 8276f4e8ec..b05d6a9d03 100644 --- a/webrtc/base/thread.h +++ b/webrtc/base/thread.h @@ -213,7 +213,8 @@ class Thread : public MessageQueue { // value. Must be called on this thread. bool SetAllowBlockingCalls(bool allow); - protected: + // These functions are public to avoid injecting test hooks. Don't call them + // outside of tests. // This method should be called when thread is created using non standard // method, like derived implementation of rtc::Thread and it can not be // started by calling Start(). This will set started flag to true and @@ -221,6 +222,7 @@ class Thread : public MessageQueue { bool WrapCurrent(); void UnwrapCurrent(); + protected: // Same as WrapCurrent except that it never fails as it does not try to // acquire the synchronization access of the thread. The caller should never // call Stop() or Join() on this thread. diff --git a/webrtc/base/thread_unittest.cc b/webrtc/base/thread_unittest.cc index 57b6df669f..41edd731d0 100644 --- a/webrtc/base/thread_unittest.cc +++ b/webrtc/base/thread_unittest.cc @@ -247,7 +247,9 @@ TEST(ThreadTest, DISABLED_ON_MAC(Priorities)) { } -TEST(ThreadTest, DISABLED_ON_MAC(Wrap)) { +TEST(ThreadTest, Wrap) { + Thread* current_thread = Thread::Current(); + current_thread->UnwrapCurrent(); CustomThread* cthread = new CustomThread(); EXPECT_TRUE(cthread->WrapCurrent()); EXPECT_TRUE(cthread->RunningForTest()); @@ -255,6 +257,7 @@ TEST(ThreadTest, DISABLED_ON_MAC(Wrap)) { cthread->UnwrapCurrent(); EXPECT_FALSE(cthread->RunningForTest()); delete cthread; + current_thread->WrapCurrent(); } TEST(ThreadTest, DISABLED_ON_MAC(Invoke)) { @@ -377,7 +380,7 @@ class AsyncInvokeTest : public testing::Test { Thread* expected_thread_; }; -TEST_F(AsyncInvokeTest, DISABLED_FireAndForget) { +TEST_F(AsyncInvokeTest, FireAndForget) { AsyncInvoker invoker; // Create and start the thread. Thread thread; diff --git a/webrtc/build/tsan_suppressions_webrtc.cc b/webrtc/build/tsan_suppressions_webrtc.cc index 548045b67e..c18bcfc75d 100644 --- a/webrtc/build/tsan_suppressions_webrtc.cc +++ b/webrtc/build/tsan_suppressions_webrtc.cc @@ -41,6 +41,13 @@ char kTSanDefaultSuppressions[] = "race:webrtc/modules/audio_processing/aec/aec_core.c\n" "race:webrtc/modules/audio_processing/aec/aec_rdft.c\n" +// rtc_unittest +// https://code.google.com/p/webrtc/issues/detail?id=3911 for details. +"race:ThreadTest_ThreeThreadsInvoke_Test::TestBody()::LocalFuncs::SetAndInvokeSet\n" +"race:rtc::FireAndForgetAsyncClosure::Execute\n" +"race:rtc::MessageQueueManager::Clear\n" +"race:rtc::Thread::Clear\n" + // libjingle_p2p_unittest // https://code.google.com/p/webrtc/issues/detail?id=2079 "race:webrtc/base/testclient.cc\n"