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

Unified Diff: media/capture/video/fake_video_capture_device_unittest.cc

Issue 2673373003: getUserMeida: report device starting states (Closed)
Patch Set: address comments on PS#7 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: media/capture/video/fake_video_capture_device_unittest.cc
diff --git a/media/capture/video/fake_video_capture_device_unittest.cc b/media/capture/video/fake_video_capture_device_unittest.cc
index 5a6974caa8c4d863d71119f426a5920221e60cc9..7a93494d9f9fd307db771831315712ba7c37dc9f 100644
--- a/media/capture/video/fake_video_capture_device_unittest.cc
+++ b/media/capture/video/fake_video_capture_device_unittest.cc
@@ -102,6 +102,7 @@ class MockClient : public VideoCaptureDevice::Client {
MOCK_METHOD2(OnError,
void(const tracked_objects::Location& from_here,
const std::string& reason));
+ MOCK_METHOD0(OnStarted, void(void));
explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb)
: frame_cb_(frame_cb) {}
@@ -294,6 +295,7 @@ TEST_P(FakeVideoCaptureDeviceTest, CaptureUsing) {
for (const auto& resolution : resolutions_to_test) {
auto client = CreateClient();
EXPECT_CALL(*client, OnError(_, _)).Times(0);
+ EXPECT_CALL(*client, OnStarted());
VideoCaptureParams capture_params;
capture_params.requested_format.frame_size = resolution.first;
@@ -383,6 +385,7 @@ TEST_F(FakeVideoCaptureDeviceTest, GetAndSetCapabilities) {
VideoCaptureParams capture_params;
capture_params.requested_format.frame_size.SetSize(640, 480);
capture_params.requested_format.frame_rate = 30.0;
+ EXPECT_CALL(*client_, OnStarted());
device->AllocateAndStart(capture_params, std::move(client_));
VideoCaptureDevice::GetPhotoCapabilitiesCallback scoped_get_callback(
@@ -494,6 +497,7 @@ TEST_F(FakeVideoCaptureDeviceTest, TakePhoto) {
VideoCaptureParams capture_params;
capture_params.requested_format.frame_size.SetSize(640, 480);
capture_params.requested_format.frame_rate = 30.0;
+ EXPECT_CALL(*client_, OnStarted());
device->AllocateAndStart(capture_params, std::move(client_));
VideoCaptureDevice::TakePhotoCallback scoped_callback(
@@ -549,7 +553,9 @@ TEST_P(FakeVideoCaptureDeviceFactoryTest, FrameRateAndDeviceCount) {
capture_params.requested_format.frame_rate = GetParam().expected_fps;
capture_params.requested_format.pixel_format =
GetParam().expected_pixel_formats[device_index];
- device->AllocateAndStart(capture_params, CreateClient());
+ auto client = CreateClient();
dcheng 2017/02/25 07:27:03 Ditto about auto: it's not really obvious what Cre
braveyao 2017/02/27 23:18:53 auto is used a lot in this unittest. And in this c
dcheng 2017/02/27 23:22:31 I understand that, but I think the style in this r
braveyao 2017/02/28 23:57:23 Acknowledged. Addressed in the following up cl. Wi
+ EXPECT_CALL(*client, OnStarted());
+ device->AllocateAndStart(capture_params, std::move(client));
WaitForCapturedFrame();
EXPECT_EQ(1280, last_format().frame_size.width());
EXPECT_EQ(720, last_format().frame_size.height());

Powered by Google App Engine
This is Rietveld 408576698