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

Unified Diff: content/browser/renderer_host/media/audio_output_authorization_handler_unittest.cc

Issue 2529853002: Fix shutdown crash in AudioOutputAuthorizationHandler. (Closed)
Patch Set: . Created 4 years, 1 month 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/audio_output_authorization_handler_unittest.cc
diff --git a/content/browser/renderer_host/media/audio_output_authorization_handler_unittest.cc b/content/browser/renderer_host/media/audio_output_authorization_handler_unittest.cc
index 6a7e8a8c1afc2d81d6fb399768f2028c3abfc35f..77edb06a4871fd23c864cf4a47a3f2128c28f929 100644
--- a/content/browser/renderer_host/media/audio_output_authorization_handler_unittest.cc
+++ b/content/browser/renderer_host/media/audio_output_authorization_handler_unittest.cc
@@ -101,6 +101,8 @@ class AudioOutputAuthorizationHandlerTest : public testing::Test {
return media_stream_manager_.get();
}
+ media::AudioManager* GetAudioManager() { return audio_manager_.get(); }
+
void SyncWithAllThreads() {
// New tasks might be posted while we are syncing, but in
// every iteration at least one task will be run. 20 iterations should be
@@ -172,7 +174,7 @@ TEST_F(AudioOutputAuthorizationHandlerTest, AuthorizeDefaultDevice_Ok) {
.Times(1);
std::unique_ptr<AudioOutputAuthorizationHandler> handler =
base::MakeUnique<AudioOutputAuthorizationHandler>(
- GetMediaStreamManager(), kRenderProcessId, kSalt);
+ GetAudioManager(), GetMediaStreamManager(), kRenderProcessId, kSalt);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@@ -194,7 +196,7 @@ TEST_F(AudioOutputAuthorizationHandlerTest,
.Times(1);
std::unique_ptr<AudioOutputAuthorizationHandler> handler =
base::MakeUnique<AudioOutputAuthorizationHandler>(
- GetMediaStreamManager(), kRenderProcessId, kSalt);
+ GetAudioManager(), GetMediaStreamManager(), kRenderProcessId, kSalt);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@@ -216,7 +218,7 @@ TEST_F(AudioOutputAuthorizationHandlerTest,
MockListener listener;
std::unique_ptr<AudioOutputAuthorizationHandler> handler =
base::MakeUnique<AudioOutputAuthorizationHandler>(
- GetMediaStreamManager(), kRenderProcessId, kSalt);
+ GetAudioManager(), GetMediaStreamManager(), kRenderProcessId, kSalt);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(
@@ -248,7 +250,7 @@ TEST_F(AudioOutputAuthorizationHandlerTest,
MockListener listener;
std::unique_ptr<AudioOutputAuthorizationHandler> handler =
base::MakeUnique<AudioOutputAuthorizationHandler>(
- GetMediaStreamManager(), kRenderProcessId, kSalt);
+ GetAudioManager(), GetMediaStreamManager(), kRenderProcessId, kSalt);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(
@@ -279,8 +281,8 @@ TEST_F(AudioOutputAuthorizationHandlerTest,
base::MakeUnique<MockRenderProcessHost>(context.get());
MockListener listener;
std::unique_ptr<AudioOutputAuthorizationHandler> handler =
- base::MakeUnique<AudioOutputAuthorizationHandler>(GetMediaStreamManager(),
- RPH->GetID(), kSalt);
+ base::MakeUnique<AudioOutputAuthorizationHandler>(
+ GetAudioManager(), GetMediaStreamManager(), RPH->GetID(), kSalt);
EXPECT_EQ(RPH->bad_msg_count(), 0);
EXPECT_CALL(listener, MockAuthorizationCallback(_, _, _, _)).Times(0);
@@ -310,8 +312,8 @@ TEST_F(AudioOutputAuthorizationHandlerTest,
base::MakeUnique<MockRenderProcessHost>(context.get());
MockListener listener;
std::unique_ptr<AudioOutputAuthorizationHandler> handler =
- base::MakeUnique<AudioOutputAuthorizationHandler>(GetMediaStreamManager(),
- RPH->GetID(), kSalt);
+ base::MakeUnique<AudioOutputAuthorizationHandler>(
+ GetAudioManager(), GetMediaStreamManager(), RPH->GetID(), kSalt);
EXPECT_EQ(RPH->bad_msg_count(), 0);
EXPECT_CALL(listener, MockAuthorizationCallback(_, _, _, _)).Times(0);
@@ -335,7 +337,7 @@ TEST_F(AudioOutputAuthorizationHandlerTest,
MockListener listener;
std::unique_ptr<AudioOutputAuthorizationHandler> handler =
base::MakeUnique<AudioOutputAuthorizationHandler>(
- GetMediaStreamManager(), kRenderProcessId, kSalt);
+ GetAudioManager(), GetMediaStreamManager(), kRenderProcessId, kSalt);
EXPECT_CALL(listener,
MockAuthorizationCallback(media::OUTPUT_DEVICE_STATUS_OK, false,

Powered by Google App Engine
This is Rietveld 408576698