Index: components/audio_modem/audio_recorder_impl.cc |
diff --git a/components/audio_modem/audio_recorder_impl.cc b/components/audio_modem/audio_recorder_impl.cc |
index 06bc72827fda4426d789da30b71e0745659b5c14..8d1b2c5913f34f9e975e74ba5a144134bb8b97cd 100644 |
--- a/components/audio_modem/audio_recorder_impl.cc |
+++ b/components/audio_modem/audio_recorder_impl.cc |
@@ -198,4 +198,20 @@ |
base::Unretained(this))); |
} |
+void AudioRecorderImpl::FlushAudioLoopForTesting() { |
+ if (media::AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()) |
+ return; |
+ |
+ // Queue task on the audio thread, when it is executed, that means we've |
+ // successfully executed all the tasks before us. |
+ base::RunLoop rl; |
+ media::AudioManager::Get()->GetTaskRunner()->PostTaskAndReply( |
+ FROM_HERE, |
+ base::Bind( |
+ base::IgnoreResult(&AudioRecorderImpl::FlushAudioLoopForTesting), |
+ base::Unretained(this)), |
+ rl.QuitClosure()); |
+ rl.Run(); |
+} |
+ |
} // namespace audio_modem |