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

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

Issue 2538033003: Implement GetUserMedia device ID constraint processing in the renderer. (Closed)
Patch Set: hta's comments 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
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e1b1f53128f57f87fa7c7c4b188846439cf0731a..4ed80f946402f91723bf1340c55b1d146ec6d63f 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
@@ -594,9 +594,9 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithoutWaiting) {
run_loop2.Run();
}
-// Test that we can generate streams where a mandatory sourceId is specified in
+// Test that we can generate streams where a sourceId is specified in
// the request.
-TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithMandatorySourceId) {
+TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithSourceId) {
ASSERT_GE(physical_audio_devices_.size(), 1u);
ASSERT_GE(physical_video_devices_.size(), 1u);
@@ -609,7 +609,7 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithMandatorySourceId) {
audio_it->unique_id);
ASSERT_FALSE(source_id.empty());
StreamControls controls(true, true);
- controls.audio.device_ids.push_back(source_id);
+ controls.audio.device_id = source_id;
SetupFakeUI(true);
GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls);
@@ -624,7 +624,7 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithMandatorySourceId) {
video_it->device_id);
ASSERT_FALSE(source_id.empty());
StreamControls controls(true, true);
- controls.video.device_ids.push_back(source_id);
+ controls.video.device_id = source_id;
SetupFakeUI(true);
GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls);
@@ -632,86 +632,24 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithMandatorySourceId) {
}
}
-// Test that we can generate streams where a optional sourceId is specified in
-// the request.
-TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithOptionalSourceId) {
- ASSERT_GE(physical_audio_devices_.size(), 1u);
- ASSERT_GE(physical_video_devices_.size(), 1u);
-
- media::AudioDeviceNames::const_iterator audio_it =
- physical_audio_devices_.begin();
- for (; audio_it != physical_audio_devices_.end(); ++audio_it) {
- std::string source_id = content::GetHMACForMediaDeviceID(
- browser_context_.GetResourceContext()->GetMediaDeviceIDSalt(),
- origin_,
- audio_it->unique_id);
- ASSERT_FALSE(source_id.empty());
- StreamControls controls(true, true);
- controls.audio.device_ids.push_back(source_id);
-
- SetupFakeUI(true);
- GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls);
- EXPECT_EQ(host_->audio_devices_[0].device.id, source_id);
- }
-
- media::VideoCaptureDeviceDescriptors::const_iterator video_it =
- physical_video_devices_.begin();
- for (; video_it != physical_video_devices_.end(); ++video_it) {
- std::string source_id = content::GetHMACForMediaDeviceID(
- browser_context_.GetResourceContext()->GetMediaDeviceIDSalt(), origin_,
- video_it->device_id);
- ASSERT_FALSE(source_id.empty());
- StreamControls controls(true, true);
- controls.video.device_ids.push_back(source_id);
-
- SetupFakeUI(true);
- GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls);
- EXPECT_EQ(host_->video_devices_[0].device.id, source_id);
- }
-}
-
-// Test that generating a stream with an invalid mandatory video source id fail.
-TEST_F(MediaStreamDispatcherHostTest,
- GenerateStreamsWithInvalidMandatoryVideoSourceId) {
+// Test that generating a stream with an invalid video source id fail.
+TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithInvalidVideoSourceId) {
StreamControls controls(true, true);
- controls.video.device_ids.push_back("invalid source id");
+ controls.video.device_id = "invalid source id";
GenerateStreamAndWaitForFailure(kRenderId, kPageRequestId, controls,
MEDIA_DEVICE_NO_HARDWARE);
}
-// Test that generating a stream with an invalid mandatory audio source id fail.
-TEST_F(MediaStreamDispatcherHostTest,
- GenerateStreamsWithInvalidMandatoryAudioSourceId) {
+// Test that generating a stream with an invalid audio source id fail.
+TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsWithInvalidAudioSourceId) {
StreamControls controls(true, true);
- controls.audio.device_ids.push_back("invalid source id");
+ controls.audio.device_id = "invalid source id";
GenerateStreamAndWaitForFailure(kRenderId, kPageRequestId, controls,
MEDIA_DEVICE_NO_HARDWARE);
}
-// Test that generating a stream with an invalid optional video source id
-// succeed.
-TEST_F(MediaStreamDispatcherHostTest,
- GenerateStreamsWithInvalidOptionalVideoSourceId) {
- StreamControls controls(true, true);
- controls.video.alternate_device_ids.push_back("invalid source id");
-
- SetupFakeUI(true);
- GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls);
-}
-
-// Test that generating a stream with an invalid optional audio source id
-// succeed.
-TEST_F(MediaStreamDispatcherHostTest,
- GenerateStreamsWithInvalidOptionalAudioSourceId) {
- StreamControls controls(true, true);
- controls.video.alternate_device_ids.push_back("invalid source id");
-
- SetupFakeUI(true);
- GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls);
-}
-
TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsNoAvailableVideoDevice) {
physical_video_devices_.clear();
video_capture_device_factory_->set_number_of_devices(0);
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698