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

Unified Diff: components/audio_modem/audio_recorder_unittest.cc

Issue 1901583005: Revert of Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « components/audio_modem/audio_recorder_impl.cc ('k') | content/browser/browser_main_loop.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/audio_modem/audio_recorder_unittest.cc
diff --git a/components/audio_modem/audio_recorder_unittest.cc b/components/audio_modem/audio_recorder_unittest.cc
index 08b9a52b4aa9d8f82826535c9ec2c260b395d41f..e960cd389b5289ea42dfa1fdec74286f63cb71a0 100644
--- a/components/audio_modem/audio_recorder_unittest.cc
+++ b/components/audio_modem/audio_recorder_unittest.cc
@@ -12,7 +12,6 @@
#include "base/macros.h"
#include "base/memory/aligned_memory.h"
#include "base/run_loop.h"
-#include "base/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "components/audio_modem/audio_recorder_impl.h"
#include "components/audio_modem/public/audio_modem_types.h"
@@ -83,9 +82,8 @@
class AudioRecorderTest : public testing::Test {
public:
AudioRecorderTest() : total_samples_(0), recorder_(nullptr) {
- audio_manager_ = media::AudioManager::CreateForTesting(
- base::ThreadTaskRunnerHandle::Get());
- base::RunLoop().RunUntilIdle();
+ if (!media::AudioManager::Get())
+ media::AudioManager::CreateForTesting();
}
~AudioRecorderTest() override {
@@ -103,7 +101,6 @@
recorder_ = new AudioRecorderImpl();
recorder_->Initialize(base::Bind(&AudioRecorderTest::DecodeSamples,
base::Unretained(this)));
- base::RunLoop().RunUntilIdle();
} else {
CreateRecorder(kSomeNumber);
}
@@ -127,7 +124,6 @@
recorder_->set_params_for_testing(new media::AudioParameters(params_));
recorder_->Initialize(
base::Bind(&AudioRecorderTest::DecodeSamples, base::Unretained(this)));
- base::RunLoop().RunUntilIdle();
}
void DeleteRecorder() {
@@ -135,7 +131,6 @@
return;
recorder_->Finalize();
recorder_ = nullptr;
- base::RunLoop().RunUntilIdle();
}
void RecordAndVerifySamples() {
@@ -188,12 +183,9 @@
return samples;
}
bool IsRecording() {
- base::RunLoop().RunUntilIdle();
+ recorder_->FlushAudioLoopForTesting();
return recorder_->is_recording_;
}
-
- content::TestBrowserThreadBundle thread_bundle_;
- media::ScopedAudioManagerPtr audio_manager_;
std::vector<float*> channel_data_;
media::AudioParameters params_;
@@ -205,6 +197,7 @@
std::string received_samples_;
scoped_ptr<base::RunLoop> run_loop_;
+ content::TestBrowserThreadBundle thread_bundle_;
};
@@ -220,19 +213,16 @@
recorder_->Record();
EXPECT_TRUE(IsRecording());
-
- recorder_->Stop();
- EXPECT_FALSE(IsRecording());
-
- recorder_->Record();
- EXPECT_TRUE(IsRecording());
-
- recorder_->Stop();
- EXPECT_FALSE(IsRecording());
-
- recorder_->Record();
- EXPECT_TRUE(IsRecording());
-
+ recorder_->Stop();
+ EXPECT_FALSE(IsRecording());
+ recorder_->Record();
+
+ EXPECT_TRUE(IsRecording());
+ recorder_->Stop();
+ EXPECT_FALSE(IsRecording());
+ recorder_->Record();
+
+ EXPECT_TRUE(IsRecording());
recorder_->Stop();
EXPECT_FALSE(IsRecording());
« no previous file with comments | « components/audio_modem/audio_recorder_impl.cc ('k') | content/browser/browser_main_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698