| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/video_capture/test/fake_device_test.h" | 5 #include "services/video_capture/test/fake_device_test.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 | 8 |
| 9 using testing::_; | 9 using testing::_; |
| 10 using testing::Invoke; | 10 using testing::Invoke; |
| 11 | 11 |
| 12 namespace video_capture { | 12 namespace video_capture { |
| 13 | 13 |
| 14 FakeDeviceTest::FakeDeviceTest() : FakeDeviceDescriptorTest() {} | 14 FakeDeviceTest::FakeDeviceTest() : FakeDeviceDescriptorTest() {} |
| 15 | 15 |
| 16 FakeDeviceTest::~FakeDeviceTest() = default; | 16 FakeDeviceTest::~FakeDeviceTest() = default; |
| 17 | 17 |
| 18 void FakeDeviceTest::SetUp() { | 18 void FakeDeviceTest::SetUp() { |
| 19 FakeDeviceDescriptorTest::SetUp(); | 19 FakeDeviceDescriptorTest::SetUp(); |
| 20 | 20 |
| 21 // Query factory for supported formats of fake device | 21 ASSERT_LE(1u, fake_device_info_.supported_formats.size()); |
| 22 base::RunLoop wait_loop; | 22 fake_device_first_supported_format_ = fake_device_info_.supported_formats[0]; |
| 23 EXPECT_CALL(supported_formats_receiver_, Run(_)) | |
| 24 .WillOnce(Invoke( | |
| 25 [this, &wait_loop](const std::vector<I420CaptureFormat>& formats) { | |
| 26 fake_device_first_supported_format_ = formats[0]; | |
| 27 wait_loop.Quit(); | |
| 28 })); | |
| 29 factory_->GetSupportedFormats(fake_device_descriptor_.device_id, | |
| 30 supported_formats_receiver_.Get()); | |
| 31 wait_loop.Run(); | |
| 32 | 23 |
| 33 requestable_settings_.format = fake_device_first_supported_format_; | 24 requestable_settings_.requested_format = fake_device_first_supported_format_; |
| 34 requestable_settings_.resolution_change_policy = | 25 requestable_settings_.resolution_change_policy = |
| 35 media::RESOLUTION_POLICY_FIXED_RESOLUTION; | 26 media::RESOLUTION_POLICY_FIXED_RESOLUTION; |
| 36 requestable_settings_.power_line_frequency = | 27 requestable_settings_.power_line_frequency = |
| 37 media::PowerLineFrequency::FREQUENCY_DEFAULT; | 28 media::PowerLineFrequency::FREQUENCY_DEFAULT; |
| 38 | 29 |
| 39 factory_->CreateDevice( | 30 factory_->CreateDevice( |
| 40 std::move(fake_device_descriptor_.device_id), | 31 std::move(fake_device_info_.descriptor.device_id), |
| 41 mojo::MakeRequest(&fake_device_proxy_), | 32 mojo::MakeRequest(&fake_device_proxy_), |
| 42 base::Bind([](mojom::DeviceAccessResultCode result_code) { | 33 base::Bind([](mojom::DeviceAccessResultCode result_code) { |
| 43 ASSERT_EQ(mojom::DeviceAccessResultCode::SUCCESS, result_code); | 34 ASSERT_EQ(mojom::DeviceAccessResultCode::SUCCESS, result_code); |
| 44 })); | 35 })); |
| 45 } | 36 } |
| 46 | 37 |
| 47 } // namespace video_capture | 38 } // namespace video_capture |
| OLD | NEW |