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

Unified Diff: services/video_capture/fake_device_test.cc

Issue 2486543002: [Mojo Video Capture] Add test ReceiveFramesFromFakeCaptureDevice (Closed)
Patch Set: mcasas comments mk2 Created 4 years, 1 month 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
« no previous file with comments | « services/video_capture/fake_device_test.h ('k') | services/video_capture/fake_device_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/video_capture/fake_device_test.cc
diff --git a/services/video_capture/fake_device_test.cc b/services/video_capture/fake_device_test.cc
index 19be586d2511d280bbca6b536d56aa547b115f5e..793d3e4f3dbfd1ae936ddade26fa616dd08870ca 100644
--- a/services/video_capture/fake_device_test.cc
+++ b/services/video_capture/fake_device_test.cc
@@ -11,6 +11,12 @@ using testing::Invoke;
namespace video_capture {
+FakeDeviceTest::MockSupportedFormatsReceiver::MockSupportedFormatsReceiver() =
+ default;
+
+FakeDeviceTest::MockSupportedFormatsReceiver::~MockSupportedFormatsReceiver() =
+ default;
+
FakeDeviceTest::FakeDeviceTest() : FakeDeviceDescriptorTest() {}
FakeDeviceTest::~FakeDeviceTest() = default;
@@ -18,6 +24,26 @@ FakeDeviceTest::~FakeDeviceTest() = default;
void FakeDeviceTest::SetUp() {
FakeDeviceDescriptorTest::SetUp();
+ // Query factory for supported formats of fake device
+ base::RunLoop wait_loop;
+ EXPECT_CALL(supported_formats_receiver_, OnGetSupportedFormatsCallback(_))
+ .WillOnce(Invoke(
+ [this, &wait_loop](const std::vector<VideoCaptureFormat>& formats) {
+ fake_device_first_supported_format_ = formats[0];
+ wait_loop.Quit();
+ }));
+ factory_->GetSupportedFormats(
+ fake_device_descriptor_,
+ base::Bind(&MockSupportedFormatsReceiver::OnGetSupportedFormatsCallback,
+ base::Unretained(&supported_formats_receiver_)));
+ wait_loop.Run();
+
+ requestable_settings_.format = fake_device_first_supported_format_;
+ requestable_settings_.resolution_change_policy =
+ media::RESOLUTION_POLICY_FIXED_RESOLUTION;
+ requestable_settings_.power_line_frequency =
+ media::PowerLineFrequency::FREQUENCY_DEFAULT;
+
factory_->CreateDeviceProxy(
std::move(fake_device_descriptor_), mojo::GetProxy(&fake_device_proxy_),
base::Bind([](mojom::DeviceAccessResultCode result_code) {
« no previous file with comments | « services/video_capture/fake_device_test.h ('k') | services/video_capture/fake_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698