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

Unified Diff: content/browser/renderer_host/media/media_stream_manager_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_manager_unittest.cc
diff --git a/content/browser/renderer_host/media/media_stream_manager_unittest.cc b/content/browser/renderer_host/media/media_stream_manager_unittest.cc
index e798e73ab8e9c1ab77d9ea15f53c08ae54e9d841..754c99dc1ca5686dfd4b2a128764e993fd6ef6aa 100644
--- a/content/browser/renderer_host/media/media_stream_manager_unittest.cc
+++ b/content/browser/renderer_host/media/media_stream_manager_unittest.cc
@@ -25,6 +25,7 @@
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_system_impl.h"
#include "media/audio/fake_audio_log_factory.h"
+#include "media/audio/test_audio_thread.h"
#include "media/base/media_switches.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -68,8 +69,7 @@ const char kMockSalt[] = "";
class MockAudioManager : public AudioManagerPlatform {
public:
MockAudioManager()
- : AudioManagerPlatform(base::ThreadTaskRunnerHandle::Get(),
- base::ThreadTaskRunnerHandle::Get(),
+ : AudioManagerPlatform(base::MakeUnique<media::TestAudioThread>(),
&fake_audio_log_factory_),
num_output_devices_(2),
num_input_devices_(2) {}
@@ -173,7 +173,7 @@ class MediaStreamManagerTest : public ::testing::Test {
base::RunLoop().RunUntilIdle();
}
- ~MediaStreamManagerTest() override {}
+ ~MediaStreamManagerTest() override { audio_manager_->Shutdown(); }
MOCK_METHOD1(Response, void(int index));
void ResponseCallback(int index,
@@ -204,7 +204,7 @@ class MediaStreamManagerTest : public ::testing::Test {
// thread_bundle_ because it uses the underlying message loop.
std::unique_ptr<MediaStreamManager> media_stream_manager_;
content::TestBrowserThreadBundle thread_bundle_;
- std::unique_ptr<MockAudioManager, media::AudioManagerDeleter> audio_manager_;
+ std::unique_ptr<MockAudioManager> audio_manager_;
std::unique_ptr<media::AudioSystem> audio_system_;
base::RunLoop run_loop_;

Powered by Google App Engine
This is Rietveld 408576698