| 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_video_capture_service_test.h" | 5 #include "services/video_capture/fake_device_descriptor_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 FakeDeviceVideoCaptureServiceTest::FakeDeviceVideoCaptureServiceTest() | 14 FakeDeviceDescriptorTest::FakeDeviceDescriptorTest() |
| 15 : VideoCaptureServiceTest() {} | 15 : VideoCaptureServiceTest() {} |
| 16 | 16 |
| 17 FakeDeviceVideoCaptureServiceTest::~FakeDeviceVideoCaptureServiceTest() = | 17 FakeDeviceDescriptorTest::~FakeDeviceDescriptorTest() = default; |
| 18 default; | |
| 19 | 18 |
| 20 void FakeDeviceVideoCaptureServiceTest::SetUp() { | 19 void FakeDeviceDescriptorTest::SetUp() { |
| 21 VideoCaptureServiceTest::SetUp(); | 20 VideoCaptureServiceTest::SetUp(); |
| 22 | 21 |
| 23 base::RunLoop wait_loop; | 22 base::RunLoop wait_loop; |
| 24 mojom::VideoCaptureDeviceDescriptorPtr fake_device_descriptor; | |
| 25 EXPECT_CALL(descriptor_receiver_, OnEnumerateDeviceDescriptorsCallback(_)) | 23 EXPECT_CALL(descriptor_receiver_, OnEnumerateDeviceDescriptorsCallback(_)) |
| 26 .WillOnce(Invoke([&wait_loop, &fake_device_descriptor]( | 24 .WillOnce(Invoke([this, &wait_loop]( |
| 27 const std::vector<mojom::VideoCaptureDeviceDescriptorPtr>& | 25 const std::vector<mojom::VideoCaptureDeviceDescriptorPtr>& |
| 28 descriptors) { | 26 descriptors) { |
| 29 fake_device_descriptor = descriptors[0].Clone(); | 27 fake_device_descriptor_ = descriptors[0].Clone(); |
| 30 wait_loop.Quit(); | 28 wait_loop.Quit(); |
| 31 })); | 29 })); |
| 32 factory_->EnumerateDeviceDescriptors(base::Bind( | 30 factory_->EnumerateDeviceDescriptors(base::Bind( |
| 33 &MockDeviceDescriptorReceiver::HandleEnumerateDeviceDescriptorsCallback, | 31 &MockDeviceDescriptorReceiver::HandleEnumerateDeviceDescriptorsCallback, |
| 34 base::Unretained(&descriptor_receiver_))); | 32 base::Unretained(&descriptor_receiver_))); |
| 35 wait_loop.Run(); | 33 wait_loop.Run(); |
| 36 | |
| 37 factory_->CreateDeviceProxy( | |
| 38 std::move(fake_device_descriptor), mojo::GetProxy(&fake_device_proxy_), | |
| 39 base::Bind([](mojom::DeviceAccessResultCode result_code) { | |
| 40 ASSERT_EQ(mojom::DeviceAccessResultCode::SUCCESS, result_code); | |
| 41 })); | |
| 42 } | 34 } |
| 43 | 35 |
| 44 } // namespace video_capture | 36 } // namespace video_capture |
| OLD | NEW |