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

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

Issue 2673373003: getUserMeida: report device starting states (Closed)
Patch Set: address comments on PS#4 and revise unittests Created 3 years, 10 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_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 8525a344f26038d286d27fa8a64e41416d3d8026..b70912629329a118252cf520a8296e066f4c947a 100644
--- a/content/browser/renderer_host/media/video_capture_manager_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_manager_unittest.cc
@@ -137,6 +137,7 @@ class MockMediaStreamProviderListener : public MediaStreamProviderListener {
class MockFrameObserver : public VideoCaptureControllerEventHandler {
public:
MOCK_METHOD1(OnError, void(VideoCaptureControllerID id));
+ MOCK_METHOD1(OnStarted, void(VideoCaptureControllerID id));
void OnBufferCreated(VideoCaptureControllerID id,
mojo::ScopedSharedBufferHandle handle,
@@ -281,6 +282,7 @@ class VideoCaptureManagerTest : public testing::Test {
TEST_F(VideoCaptureManagerTest, CreateAndClose) {
InSequence s;
EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _));
+ EXPECT_CALL(*frame_observer_, OnStarted(_));
EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _));
int video_session_id = vcm_->Open(devices_.front());
@@ -298,6 +300,7 @@ TEST_F(VideoCaptureManagerTest, CreateAndCloseMultipleTimes) {
InSequence s;
for (int i = 1 ; i < 3 ; ++i) {
EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, i));
+ EXPECT_CALL(*frame_observer_, OnStarted(_));
EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, i));
int video_session_id = vcm_->Open(devices_.front());
VideoCaptureControllerID client_id = StartClient(video_session_id, true);
@@ -315,6 +318,7 @@ TEST_F(VideoCaptureManagerTest, CreateAndCloseMultipleTimes) {
TEST_F(VideoCaptureManagerTest, CreateAndAbort) {
InSequence s;
EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _));
+ EXPECT_CALL(*frame_observer_, OnStarted(_));
EXPECT_CALL(*listener_, Aborted(MEDIA_DEVICE_VIDEO_CAPTURE, _));
int video_session_id = vcm_->Open(devices_.front());
@@ -407,6 +411,7 @@ TEST_F(VideoCaptureManagerTest, ManipulateDeviceAndCheckCapabilities) {
EXPECT_GT(supported_formats[1].frame_size.height(), 1);
EXPECT_GT(supported_formats[1].frame_rate, 1);
+ EXPECT_CALL(*frame_observer_, OnStarted(_));
VideoCaptureControllerID client_id = StartClient(video_session_id, true);
base::RunLoop().RunUntilIdle();
// After StartClient(), device's supported formats should stay the same.
@@ -473,6 +478,7 @@ TEST_F(VideoCaptureManagerTest,
EXPECT_GT(supported_formats[1].frame_size.height(), 1);
EXPECT_GT(supported_formats[1].frame_rate, 1);
+ EXPECT_CALL(*frame_observer_, OnStarted(_));
VideoCaptureControllerID client_id = StartClient(video_session_id, true);
base::RunLoop().RunUntilIdle();
// After StartClient(), device's supported formats should stay the same.
@@ -519,6 +525,7 @@ TEST_F(VideoCaptureManagerTest, StartDeviceAndGetDeviceFormatInUse) {
EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(video_session_id, &formats_in_use));
EXPECT_TRUE(formats_in_use.empty());
+ EXPECT_CALL(*frame_observer_, OnStarted(_));
VideoCaptureControllerID client_id = StartClient(video_session_id, true);
base::RunLoop().RunUntilIdle();
// After StartClient(), |formats_in_use| should contain one valid format.
@@ -564,6 +571,7 @@ TEST_F(VideoCaptureManagerTest,
&formats_in_use));
EXPECT_TRUE(formats_in_use.empty());
+ EXPECT_CALL(*frame_observer_, OnStarted(_));
VideoCaptureControllerID client_id = StartClient(video_session_id, true);
base::RunLoop().RunUntilIdle();
// After StartClient(), |formats_in_use| should contain one valid format.
@@ -649,6 +657,7 @@ TEST_F(VideoCaptureManagerTest, StartInvalidSession) {
TEST_F(VideoCaptureManagerTest, CloseWithoutStop) {
InSequence s;
EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _));
+ EXPECT_CALL(*frame_observer_, OnStarted(_));
EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _));
int video_session_id = vcm_->Open(devices_.front());
@@ -670,6 +679,7 @@ TEST_F(VideoCaptureManagerTest, CloseWithoutStop) {
// scenarios.
TEST_F(VideoCaptureManagerTest, PauseAndResumeClient) {
EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _));
+ EXPECT_CALL(*frame_observer_, OnStarted(_));
const int video_session_id = vcm_->Open(devices_.front());
const VideoCaptureControllerID client_id =
@@ -709,6 +719,7 @@ TEST_F(VideoCaptureManagerTest, PauseAndResumeClient) {
TEST_F(VideoCaptureManagerTest, PauseAndResumeDevice) {
InSequence s;
EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _));
+ EXPECT_CALL(*frame_observer_, OnStarted(_));
EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _));
int video_session_id = vcm_->Open(devices_.front());

Powered by Google App Engine
This is Rietveld 408576698