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/fake_device_test.h" | 5 #include "services/video_capture/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 // Query factory for supported formats of fake device |
22 base::RunLoop wait_loop; | 22 base::RunLoop wait_loop; |
23 EXPECT_CALL(supported_formats_receiver_, OnGetSupportedFormatsCallback(_)) | 23 EXPECT_CALL(supported_formats_receiver_, OnGetSupportedFormatsCallback(_)) |
24 .WillOnce(Invoke([this, &wait_loop]( | 24 .WillOnce(Invoke([this, &wait_loop]( |
25 const std::vector<mojom::VideoCaptureFormatPtr>& | 25 const std::vector<media::VideoCaptureFormat>& |
26 formats) { | 26 formats) { |
27 fake_device_first_supported_format_ = formats[0].Clone(); | 27 fake_device_first_supported_format_ = formats[0]; |
28 wait_loop.Quit(); | 28 wait_loop.Quit(); |
29 })); | 29 })); |
30 factory_->GetSupportedFormats( | 30 factory_->GetSupportedFormats( |
31 fake_device_descriptor_.Clone(), | 31 fake_device_descriptor_, |
32 base::Bind(&MockSupportedFormatsReceiver::HandleGetSupportedFormatsCallbac
k, | 32 base::Bind(&MockSupportedFormatsReceiver::OnGetSupportedFormatsCallback, |
33 base::Unretained(&supported_formats_receiver_))); | 33 base::Unretained(&supported_formats_receiver_))); |
34 wait_loop.Run(); | 34 wait_loop.Run(); |
35 | 35 |
36 requestable_settings_ = mojom::VideoCaptureSettings::New(); | 36 requestable_settings_.requested_format = fake_device_first_supported_format_; |
37 requestable_settings_->format = fake_device_first_supported_format_.Clone(); | 37 requestable_settings_.resolution_change_policy = |
38 requestable_settings_->resolution_change_policy = | 38 media::RESOLUTION_POLICY_FIXED_RESOLUTION; |
39 mojom::ResolutionChangePolicy::FIXED_RESOLUTION; | 39 requestable_settings_.power_line_frequency = |
40 requestable_settings_->power_line_frequency = | 40 media::PowerLineFrequency::FREQUENCY_DEFAULT; |
41 mojom::PowerLineFrequency::DEFAULT; | |
42 | 41 |
43 factory_->CreateDeviceProxy( | 42 factory_->CreateDeviceProxy( |
44 std::move(fake_device_descriptor_), mojo::GetProxy(&fake_device_proxy_), | 43 std::move(fake_device_descriptor_), mojo::GetProxy(&fake_device_proxy_), |
45 base::Bind([](mojom::DeviceAccessResultCode result_code) { | 44 base::Bind([](mojom::DeviceAccessResultCode result_code) { |
46 ASSERT_EQ(mojom::DeviceAccessResultCode::SUCCESS, result_code); | 45 ASSERT_EQ(mojom::DeviceAccessResultCode::SUCCESS, result_code); |
47 })); | 46 })); |
48 } | 47 } |
49 | 48 |
50 } // namespace video_capture | 49 } // namespace video_capture |
OLD | NEW |