Chromium Code Reviews| Index: content/browser/renderer_host/media/video_capture_manager_unittest.cc |
| diff --git a/content/browser/renderer_host/media/video_capture_manager_unittest.cc b/content/browser/renderer_host/media/video_capture_manager_unittest.cc |
| index a986e0bc3702eca982798687eb0dbc9f17821b82..15695ebbbb5f126a4852dbcbbb1feee89fd0ebbe 100644 |
| --- a/content/browser/renderer_host/media/video_capture_manager_unittest.cc |
| +++ b/content/browser/renderer_host/media/video_capture_manager_unittest.cc |
| @@ -167,7 +167,7 @@ TEST_F(VideoCaptureManagerTest, OpenTwice) { |
| InSequence s; |
| EXPECT_CALL(*listener_, DevicesEnumerated(MEDIA_DEVICE_VIDEO_CAPTURE, _)) |
| - .Times(1).WillOnce(SaveArg<1>(&devices)); |
| + .Times(1).WillOnce(SaveArg<1>(&devices)); |
|
perkj_chrome
2013/11/06 17:05:51
indentation was right from the beginning.
mcasas
2013/11/06 20:10:20
Done.
|
| EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)).Times(2); |
| EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _)).Times(2); |
| @@ -191,6 +191,64 @@ TEST_F(VideoCaptureManagerTest, OpenTwice) { |
| vcm_->Unregister(); |
| } |
| +// Enumerate devices and open the first, then check the capabilities. Then start |
| +// the opened device. The capability list should be reduced to just one format, |
| +// and this should be the one used when configuring-starting the device. Finally |
| +// stop the device and check that the capabilities have been restored. |
| +TEST_F(VideoCaptureManagerTest, ManipulateDeviceAndCheckCapabilities) { |
| + StreamDeviceInfoArray devices; |
| + |
| + InSequence s; |
| + EXPECT_CALL(*listener_, DevicesEnumerated(MEDIA_DEVICE_VIDEO_CAPTURE, _)) |
| + .Times(1) |
| + .WillOnce(SaveArg<1>(&devices)); |
| + vcm_->EnumerateDevices(MEDIA_DEVICE_VIDEO_CAPTURE); |
| + message_loop_->RunUntilIdle(); |
| + |
| + EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)).Times(1); |
| + int video_session_id = vcm_->Open(devices.front()); |
| + message_loop_->RunUntilIdle(); |
| + |
| + // When the device has been opened, we should see all the devices' |
| + // capabilities. |
| + media::VideoCaptureCapabilities device_capabilities; |
| + vcm_->GetDeviceCapabilities(video_session_id, &device_capabilities); |
| + ASSERT_GT(device_capabilities.size(), 1u); |
| + EXPECT_GT(device_capabilities[0].width, 1); |
| + EXPECT_GT(device_capabilities[0].height, 1); |
| + EXPECT_GT(device_capabilities[0].frame_rate, 1); |
| + EXPECT_GT(device_capabilities[1].width, 1); |
| + EXPECT_GT(device_capabilities[1].height, 1); |
| + EXPECT_GT(device_capabilities[1].frame_rate, 1); |
| + |
| + VideoCaptureControllerID client_id = StartClient(video_session_id, true); |
| + message_loop_->RunUntilIdle(); |
| + // After StartClient(), the device's capabilities should be reduced to one. |
| + vcm_->GetDeviceCapabilities(video_session_id, &device_capabilities); |
| + ASSERT_EQ(device_capabilities.size(), 1u); |
| + EXPECT_GT(device_capabilities[0].width, 1); |
| + EXPECT_GT(device_capabilities[0].height, 1); |
| + EXPECT_GT(device_capabilities[0].frame_rate, 1); |
| + |
| + EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _)).Times(1); |
| + StopClient(client_id); |
| + message_loop_->RunUntilIdle(); |
| + // After StopClient(), the device's list of capabilities should be restored |
| + // to the original one. |
| + vcm_->GetDeviceCapabilities(video_session_id, &device_capabilities); |
| + ASSERT_GT(device_capabilities.size(), 1u); |
| + EXPECT_GT(device_capabilities[0].width, 1); |
| + EXPECT_GT(device_capabilities[0].height, 1); |
| + EXPECT_GT(device_capabilities[0].frame_rate, 1); |
| + EXPECT_GT(device_capabilities[1].width, 1); |
| + EXPECT_GT(device_capabilities[1].height, 1); |
| + EXPECT_GT(device_capabilities[1].frame_rate, 1); |
| + |
| + vcm_->Close(video_session_id); |
| + message_loop_->RunUntilIdle(); |
| + vcm_->Unregister(); |
| +} |
| + |
| // Open two different devices. |
| TEST_F(VideoCaptureManagerTest, OpenTwo) { |
| StreamDeviceInfoArray devices; |