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

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

Issue 2561343002: Revert making trying to authorize a nonsense device id a bad_message. (Closed)
Patch Set: Created 4 years 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 9b5c54d0580f7bf1004c10dd6fdc209cde16eee7..e0e42c501f3ccbc8e6a4496533b9e65f7d2a010d 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
@@ -260,8 +260,7 @@ TEST_F(AudioOutputAuthorizationHandlerTest,
SyncWithAllThreads();
}
-TEST_F(AudioOutputAuthorizationHandlerTest,
- AuthorizeInvalidDeviceId_BadMessage) {
+TEST_F(AudioOutputAuthorizationHandlerTest, AuthorizeInvalidDeviceId_NotFound) {
std::unique_ptr<TestBrowserContext> context =
base::MakeUnique<TestBrowserContext>();
std::unique_ptr<MockRenderProcessHost> RPH =
@@ -272,7 +271,10 @@ TEST_F(AudioOutputAuthorizationHandlerTest,
GetAudioManager(), GetMediaStreamManager(), RPH->GetID(), kSalt);
EXPECT_EQ(RPH->bad_msg_count(), 0);
- EXPECT_CALL(listener, MockAuthorizationCallback(_, _, _, _)).Times(0);
+ EXPECT_CALL(listener,
+ MockAuthorizationCallback(
+ media::OUTPUT_DEVICE_STATUS_ERROR_NOT_FOUND, _, _, _))
+ .Times(1);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@@ -281,7 +283,9 @@ TEST_F(AudioOutputAuthorizationHandlerTest,
kInvalidDeviceId, SecurityOrigin(), listener.GetCallback())));
SyncWithAllThreads();
- EXPECT_EQ(RPH->bad_msg_count(), 1);
+ // It is possible to request an invalid device id from JS APIs,
+ // so we don't want to crash the renderer for this.
+ EXPECT_EQ(RPH->bad_msg_count(), 0);
BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, handler.release());
SyncWithAllThreads();
RPH.reset();

Powered by Google App Engine
This is Rietveld 408576698