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

Unified Diff: content/browser/renderer_host/media/media_stream_dispatcher_host_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
Index: content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
index 6e4837718aa1d775d0f161b54f6a9a241d54c446..737534df4d8ce1a4985e7363f61d39a601f52e5c 100644
--- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc
@@ -38,6 +38,7 @@
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_system_impl.h"
#include "media/audio/mock_audio_manager.h"
+#include "media/audio/test_audio_thread.h"
#include "media/base/media_switches.h"
#include "media/capture/video/fake_video_capture_device_factory.h"
#include "net/url_request/url_request_context.h"
@@ -244,8 +245,8 @@ class MediaStreamDispatcherHostTest : public testing::Test {
: thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
old_browser_client_(NULL),
origin_(GURL("https://test.com")) {
- audio_manager_.reset(
- new media::MockAudioManager(base::ThreadTaskRunnerHandle::Get()));
+ audio_manager_.reset(new media::MockAudioManager(
+ base::MakeUnique<media::TestAudioThread>()));
audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get());
// Make sure we use fake devices to avoid long delays.
base::CommandLine::ForCurrentProcess()->AppendSwitch(
@@ -272,6 +273,7 @@ class MediaStreamDispatcherHostTest : public testing::Test {
}
~MediaStreamDispatcherHostTest() override {
+ audio_manager_->Shutdown();
#if defined(OS_CHROMEOS)
chromeos::CrasAudioHandler::Shutdown();
#endif
@@ -446,8 +448,7 @@ class MediaStreamDispatcherHostTest : public testing::Test {
scoped_refptr<MockMediaStreamDispatcherHost> host_;
std::unique_ptr<MediaStreamManager> media_stream_manager_;
content::TestBrowserThreadBundle thread_bundle_;
- std::unique_ptr<media::AudioManager, media::AudioManagerDeleter>
- audio_manager_;
+ std::unique_ptr<media::AudioManager> audio_manager_;
std::unique_ptr<media::AudioSystem> audio_system_;
MockMediaStreamUIProxy* stream_ui_;
ContentBrowserClient* old_browser_client_;

Powered by Google App Engine
This is Rietveld 408576698