Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: media/audio/alsa/alsa_output_unittest.cc

Issue 1806313003: Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments from patch 48 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/speech/speech_recognizer_impl_unittest.cc ('k') | media/audio/alsa/audio_manager_alsa.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/alsa/alsa_output_unittest.cc
diff --git a/media/audio/alsa/alsa_output_unittest.cc b/media/audio/alsa/alsa_output_unittest.cc
index 1b1386347f9437c21865c9fa64b71936090ee735..acf6d2881552324f3d582fcd34e9f15a1cba6934 100644
--- a/media/audio/alsa/alsa_output_unittest.cc
+++ b/media/audio/alsa/alsa_output_unittest.cc
@@ -5,7 +5,10 @@
#include <stdint.h>
#include "base/macros.h"
+#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
+#include "base/test/test_message_loop.h"
+#include "base/thread_task_runner_handle.h"
#include "media/audio/alsa/alsa_output.h"
#include "media/audio/alsa/alsa_wrapper.h"
#include "media/audio/alsa/audio_manager_alsa.h"
@@ -72,7 +75,10 @@ class MockAlsaWrapper : public AlsaWrapper {
class MockAudioManagerAlsa : public AudioManagerAlsa {
public:
- MockAudioManagerAlsa() : AudioManagerAlsa(&fake_audio_log_factory_) {}
+ MockAudioManagerAlsa()
+ : AudioManagerAlsa(base::ThreadTaskRunnerHandle::Get(),
+ base::ThreadTaskRunnerHandle::Get(),
+ &fake_audio_log_factory_) {}
MOCK_METHOD0(Init, void());
MOCK_METHOD0(HasAudioOutputDevices, bool());
MOCK_METHOD0(HasAudioInputDevices, bool());
@@ -93,12 +99,6 @@ class MockAudioManagerAlsa : public AudioManagerAlsa {
delete stream;
}
- // We don't mock this method since all tests will do the same thing
- // and use the current task runner.
- scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override {
- return base::MessageLoop::current()->task_runner();
- }
-
private:
FakeAudioLogFactory fake_audio_log_factory_;
};
@@ -168,9 +168,10 @@ class AlsaPcmOutputStreamTest : public testing::Test {
static void* kFakeHints[];
static char kGenericSurround50[];
+ base::TestMessageLoop message_loop_;
StrictMock<MockAlsaWrapper> mock_alsa_wrapper_;
- scoped_ptr<StrictMock<MockAudioManagerAlsa> > mock_manager_;
- base::MessageLoop message_loop_;
+ std::unique_ptr<StrictMock<MockAudioManagerAlsa>, AudioManagerDeleter>
+ mock_manager_;
scoped_refptr<media::DataBuffer> packet_;
private:
@@ -442,7 +443,7 @@ TEST_F(AlsaPcmOutputStreamTest, StartStop) {
// call Stop() immediately after to ensure we don't run the message loop
// forever.
test_stream->Stop();
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle))
.WillOnce(Return(0));
« no previous file with comments | « content/browser/speech/speech_recognizer_impl_unittest.cc ('k') | media/audio/alsa/audio_manager_alsa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698