| 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());
 | 
|  
 | 
| 
 |