Index: media/base/test_helpers.cc |
diff --git a/media/base/test_helpers.cc b/media/base/test_helpers.cc |
index 60581554ea797e0e54c71e4f952e7374ca74cf49..ba3e637d30a68719a8a6f7ee82b9cd17e626c140 100644 |
--- a/media/base/test_helpers.cc |
+++ b/media/base/test_helpers.cc |
@@ -9,7 +9,6 @@ |
#include "base/bind.h" |
#include "base/logging.h" |
#include "base/macros.h" |
-#include "base/message_loop/message_loop.h" |
#include "base/pickle.h" |
#include "base/run_loop.h" |
#include "base/test/test_timeouts.h" |
@@ -67,34 +66,34 @@ WaitableMessageLoopEvent::WaitableMessageLoopEvent() |
: WaitableMessageLoopEvent(TestTimeouts::action_timeout()) {} |
WaitableMessageLoopEvent::WaitableMessageLoopEvent(base::TimeDelta timeout) |
- : message_loop_(base::MessageLoop::current()), |
- signaled_(false), |
- status_(PIPELINE_OK), |
- timeout_(timeout) { |
- DCHECK(message_loop_); |
+ : signaled_(false), status_(PIPELINE_OK), timeout_(timeout) { |
+ DCHECK(CalledOnValidThread()); |
chcunningham
2016/06/29 18:10:04
This is sort of tautological right? Thread checker
fdoray
2016/06/29 18:20:17
Done. Removed it, you're right.
|
} |
-WaitableMessageLoopEvent::~WaitableMessageLoopEvent() {} |
+WaitableMessageLoopEvent::~WaitableMessageLoopEvent() { |
+ DCHECK(CalledOnValidThread()); |
+} |
base::Closure WaitableMessageLoopEvent::GetClosure() { |
- DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
+ DCHECK(CalledOnValidThread()); |
return BindToCurrentLoop(base::Bind( |
&WaitableMessageLoopEvent::OnCallback, base::Unretained(this), |
PIPELINE_OK)); |
} |
PipelineStatusCB WaitableMessageLoopEvent::GetPipelineStatusCB() { |
- DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
+ DCHECK(CalledOnValidThread()); |
return BindToCurrentLoop(base::Bind( |
&WaitableMessageLoopEvent::OnCallback, base::Unretained(this))); |
} |
void WaitableMessageLoopEvent::RunAndWait() { |
+ DCHECK(CalledOnValidThread()); |
RunAndWaitForStatus(PIPELINE_OK); |
} |
void WaitableMessageLoopEvent::RunAndWaitForStatus(PipelineStatus expected) { |
- DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
+ DCHECK(CalledOnValidThread()); |
if (signaled_) { |
EXPECT_EQ(expected, status_); |
return; |
@@ -113,7 +112,7 @@ void WaitableMessageLoopEvent::RunAndWaitForStatus(PipelineStatus expected) { |
} |
void WaitableMessageLoopEvent::OnCallback(PipelineStatus status) { |
- DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
+ DCHECK(CalledOnValidThread()); |
signaled_ = true; |
status_ = status; |
@@ -123,7 +122,7 @@ void WaitableMessageLoopEvent::OnCallback(PipelineStatus status) { |
} |
void WaitableMessageLoopEvent::OnTimeout() { |
- DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
+ DCHECK(CalledOnValidThread()); |
ADD_FAILURE() << "Timed out waiting for message loop to quit"; |
run_loop_->Quit(); |
} |