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

Unified Diff: media/audio/mac/audio_low_latency_input_mac_unittest.cc

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: rebase 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/mac/audio_auhal_mac_unittest.cc ('k') | media/audio/mac/audio_manager_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mac/audio_low_latency_input_mac_unittest.cc
diff --git a/media/audio/mac/audio_low_latency_input_mac_unittest.cc b/media/audio/mac/audio_low_latency_input_mac_unittest.cc
index f8e3c83f428dd795c68d79fdc02fb24d0721c3d6..6002e2030e0c65e6c999e61a871ecda5a12eb6a8 100644
--- a/media/audio/mac/audio_low_latency_input_mac_unittest.cc
+++ b/media/audio/mac/audio_low_latency_input_mac_unittest.cc
@@ -7,6 +7,7 @@
#include <memory>
#include "base/environment.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
@@ -18,6 +19,7 @@
#include "media/audio/audio_manager_base.h"
#include "media/audio/audio_unittest_util.h"
#include "media/audio/mac/audio_low_latency_input_mac.h"
+#include "media/audio/test_audio_thread.h"
#include "media/base/seekable_buffer.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -112,16 +114,13 @@ class MacAudioInputTest : public testing::Test {
protected:
MacAudioInputTest()
: message_loop_(base::MessageLoop::TYPE_UI),
- audio_manager_(
- AudioManager::CreateForTesting(message_loop_.task_runner())) {
+ audio_manager_(AudioManager::CreateForTesting(
+ base::MakeUnique<TestAudioThread>())) {
// Wait for the AudioManager to finish any initialization on the audio loop.
base::RunLoop().RunUntilIdle();
}
- ~MacAudioInputTest() override {
- audio_manager_.reset();
- base::RunLoop().RunUntilIdle();
- }
+ ~MacAudioInputTest() override { audio_manager_->Shutdown(); }
bool InputDevicesAvailable() {
return AudioDeviceInfoAccessorForTests(audio_manager_.get())
@@ -160,7 +159,7 @@ class MacAudioInputTest : public testing::Test {
void OnLogMessage(const std::string& message) { log_message_ = message; }
base::MessageLoop message_loop_;
- ScopedAudioManagerPtr audio_manager_;
+ std::unique_ptr<AudioManager> audio_manager_;
std::string log_message_;
};
« no previous file with comments | « media/audio/mac/audio_auhal_mac_unittest.cc ('k') | media/audio/mac/audio_manager_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698