| Index: media/mojo/services/test_mojo_media_client.cc
|
| diff --git a/media/mojo/services/test_mojo_media_client.cc b/media/mojo/services/test_mojo_media_client.cc
|
| index 1968e113bff74c09926197103e43ac2e9b9ebcc1..1e380c1f527a177b74c422fde8c908d18d16a680 100644
|
| --- a/media/mojo/services/test_mojo_media_client.cc
|
| +++ b/media/mojo/services/test_mojo_media_client.cc
|
| @@ -27,11 +27,11 @@
|
|
|
| TestMojoMediaClient::~TestMojoMediaClient() {
|
| DVLOG(1) << __func__;
|
| -
|
| - if (audio_manager_) {
|
| - audio_manager_->Shutdown();
|
| - audio_manager_.reset();
|
| - }
|
| + // AudioManager destructor requires MessageLoop.
|
| + // Destroy it before the message loop goes away.
|
| + audio_manager_.reset();
|
| + // Flush the message loop to ensure that the audio manager is destroyed.
|
| + base::RunLoop().RunUntilIdle();
|
| }
|
|
|
| void TestMojoMediaClient::Initialize(
|
| @@ -44,6 +44,7 @@
|
| if (!audio_manager) {
|
| audio_manager_ = media::AudioManager::CreateForTesting(
|
| base::MakeUnique<AudioThreadImpl>());
|
| + audio_manager = audio_manager_.get();
|
| // Flush the message loop to ensure that the audio manager is initialized.
|
| base::RunLoop().RunUntilIdle();
|
| }
|
|
|