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

Unified Diff: media/audio/audio_debug_recording_helper_unittest.cc

Issue 2885173002: Make AudioDebugFileWriter create its own file worker thread. (Closed)
Patch Set: Remove useless include Created 3 years, 7 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 | « media/audio/audio_debug_recording_helper.cc ('k') | media/audio/audio_debug_recording_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_debug_recording_helper_unittest.cc
diff --git a/media/audio/audio_debug_recording_helper_unittest.cc b/media/audio/audio_debug_recording_helper_unittest.cc
index 5883eecbf7152dccd0e8e5e10ecdb6c229cf390c..3e3eaf900c4e14128f0f84f5d62e0d398980d87e 100644
--- a/media/audio/audio_debug_recording_helper_unittest.cc
+++ b/media/audio/audio_debug_recording_helper_unittest.cc
@@ -11,6 +11,7 @@
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
+#include "base/test/scoped_task_environment.h"
#include "base/test/test_message_loop.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_sample_types.h"
@@ -41,11 +42,8 @@ const base::FilePath::CharType kFileNameExtension[] = FILE_PATH_LITERAL("wav");
// Mock class for the audio file writer that the helper wraps.
class MockAudioDebugFileWriter : public AudioDebugFileWriter {
public:
- MockAudioDebugFileWriter(
- const AudioParameters& params,
- scoped_refptr<base::SingleThreadTaskRunner> file_task_runner)
- : AudioDebugFileWriter(params, std::move(file_task_runner)),
- reference_data_(nullptr) {}
+ MockAudioDebugFileWriter(const AudioParameters& params)
+ : AudioDebugFileWriter(params), reference_data_(nullptr) {}
~MockAudioDebugFileWriter() override {}
MOCK_METHOD1(Start, void(const base::FilePath&));
@@ -91,11 +89,9 @@ class AudioDebugRecordingHelperUnderTest : public AudioDebugRecordingHelper {
AudioDebugRecordingHelperUnderTest(
const AudioParameters& params,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
base::OnceClosure on_destruction_closure)
: AudioDebugRecordingHelper(params,
std::move(task_runner),
- std::move(file_task_runner),
std::move(on_destruction_closure)) {}
~AudioDebugRecordingHelperUnderTest() override {}
@@ -103,10 +99,8 @@ class AudioDebugRecordingHelperUnderTest : public AudioDebugRecordingHelper {
// Creates the mock writer. After the mock writer is returned, we always
// expect GetFileNameExtension() and Start() to be called on it by the helper.
std::unique_ptr<AudioDebugFileWriter> CreateAudioDebugFileWriter(
- const AudioParameters& params,
- scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) override {
- MockAudioDebugFileWriter* writer =
- new MockAudioDebugFileWriter(params, std::move(file_task_runner));
+ const AudioParameters& params) override {
+ MockAudioDebugFileWriter* writer = new MockAudioDebugFileWriter(params);
EXPECT_CALL(*writer, GetFileNameExtension())
.WillOnce(Return(kFileNameExtension));
base::FilePath expected_file_path =
@@ -130,7 +124,7 @@ class AudioDebugRecordingHelperTest : public ::testing::Test {
const AudioParameters& params,
base::OnceClosure on_destruction_closure) {
return base::MakeUnique<AudioDebugRecordingHelperUnderTest>(
- params, message_loop_.task_runner(), message_loop_.task_runner(),
+ params, scoped_task_environment_.GetMainThreadTaskRunner(),
std::move(on_destruction_closure));
}
@@ -144,7 +138,8 @@ class AudioDebugRecordingHelperTest : public ::testing::Test {
protected:
base::FilePath file_path_;
- base::TestMessageLoop message_loop_;
+ // The test task environment.
+ base::test::ScopedTaskEnvironment scoped_task_environment_;
private:
DISALLOW_COPY_AND_ASSIGN(AudioDebugRecordingHelperTest);
« no previous file with comments | « media/audio/audio_debug_recording_helper.cc ('k') | media/audio/audio_debug_recording_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698