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

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

Issue 2721113002: getUserMedia: handle the device starting status report. (Closed)
Patch Set: address nits Created 3 years, 9 months 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/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..f9449706189611b99f2e88cee3da895473705110 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,35 @@ TEST_F(VideoCaptureControllerTest,
Mock::VerifyAndClearExpectations(client_a_.get());
}
+// Tests that the VideoCaptureController reports OnStarted() to all clients,
+// even if they connect after VideoCaptureController::OnStarted() has been
+// invoked.
+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

Powered by Google App Engine
This is Rietveld 408576698