Index: media/audio/test_audio_thread.cc |
diff --git a/media/audio/test_audio_thread.cc b/media/audio/test_audio_thread.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..432753571457ac1f1718649efaae3dac45e6fcd2 |
--- /dev/null |
+++ b/media/audio/test_audio_thread.cc |
@@ -0,0 +1,33 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "media/audio/test_audio_thread.h" |
+ |
+#include "base/run_loop.h" |
+#include "base/threading/thread_task_runner_handle.h" |
+ |
+namespace media { |
+ |
+TestAudioThread::TestAudioThread() |
+ : task_runner_(base::ThreadTaskRunnerHandle::Get()) {} |
o1ka
2017/04/28 13:24:20
The purpose of this class needs to be explained in
alokp
2017/04/28 17:31:13
I will add more comments. IMO having this separate
o1ka
2017/05/02 16:16:01
See my comment in audio_system_impl_unittest.cc. A
alokp
2017/05/09 19:06:15
Done.
|
+ |
+TestAudioThread::~TestAudioThread() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+} |
+ |
+void TestAudioThread::Stop() { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ base::RunLoop().RunUntilIdle(); |
+ task_runner_ = nullptr; |
+} |
+ |
+base::SingleThreadTaskRunner* TestAudioThread::GetTaskRunner() { |
+ return task_runner_.get(); |
+} |
+ |
+base::SingleThreadTaskRunner* TestAudioThread::GetWorkerTaskRunner() { |
+ return task_runner_.get(); |
+} |
+ |
+} // namespace media |