base/thread_unittest: wrap test was setting current thread to NULL.

This broke unittests following ThreadTest.Wrap

BUG=3836
R=pbos@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/28689004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7413 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrike@webrtc.org 2014-10-09 15:41:40 +00:00
parent 17f8ddd6c4
commit e30dab77df
4 changed files with 16 additions and 4 deletions

View File

@ -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',

View File

@ -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.

View File

@ -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;

View File

@ -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<FunctorB>::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"