Chromium Code Reviews| Index: content/browser/renderer_host/media/video_capture_controller_unittest.cc |
| diff --git a/content/browser/renderer_host/media/video_capture_controller_unittest.cc b/content/browser/renderer_host/media/video_capture_controller_unittest.cc |
| index eacde473aaba2d0af6af532539f5bf958e39d3ad..e3c2305be643dc8be222fc2a41f5478b529565a6 100644 |
| --- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc |
| +++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc |
| @@ -803,4 +803,34 @@ TEST_F(VideoCaptureControllerTest, |
| Mock::VerifyAndClearExpectations(client_a_.get()); |
| } |
| +// Because OnStarted event will be called only once from each device, it's the |
| +// job of VideoCaptureController to report OnStarted event to all the clients. |
|
chfremer
2017/03/02 17:56:10
I like the test!
For the description comment here
braveyao
2017/03/03 17:53:12
Done.
|
| +TEST_F(VideoCaptureControllerTest, OnStartedForMultipleClients) { |
| + media::VideoCaptureParams session_100; |
| + session_100.requested_format = media::VideoCaptureFormat( |
| + gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420); |
| + media::VideoCaptureParams session_200 = session_100; |
| + media::VideoCaptureParams session_300 = session_100; |
| + |
| + const VideoCaptureControllerID client_a_route_1(1); |
| + const VideoCaptureControllerID client_a_route_2(2); |
| + const VideoCaptureControllerID client_b_route_1(3); |
| + |
| + controller_->AddClient(client_a_route_1, client_a_.get(), 100, session_100); |
| + controller_->AddClient(client_b_route_1, client_b_.get(), 300, session_300); |
| + ASSERT_EQ(2, controller_->GetClientCount()); |
| + |
| + { |
| + InSequence s; |
| + // Simulate the OnStarted event from device. |
| + EXPECT_CALL(*client_a_, OnStarted(_)); |
| + EXPECT_CALL(*client_b_, OnStarted(_)); |
| + device_client_->OnStarted(); |
| + |
| + // VideoCaptureController will take care of the OnStarted event for the |
| + // clients who join later. |
| + EXPECT_CALL(*client_a_, OnStarted(_)); |
| + controller_->AddClient(client_a_route_2, client_a_.get(), 200, session_200); |
| + } |
| +} |
| } // namespace content |