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

Side by Side Diff: services/video_capture/fake_device_test.cc

Issue 2486543002: [Mojo Video Capture] Add test ReceiveFramesFromFakeCaptureDevice (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
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
22 base::RunLoop wait_loop;
23 EXPECT_CALL(supported_formats_receiver_, OnGetSupportedFormatsCallback(_))
24 .WillOnce(Invoke(
25 [this, &wait_loop](const std::vector<VideoCaptureFormat>& formats) {
26 fake_device_first_supported_format_ = formats[0];
27 wait_loop.Quit();
28 }));
29 factory_->GetSupportedFormats(
30 fake_device_descriptor_,
31 base::Bind(&MockSupportedFormatsReceiver::OnGetSupportedFormatsCallback,
32 base::Unretained(&supported_formats_receiver_)));
33 wait_loop.Run();
34
35 requestable_settings_.format = fake_device_first_supported_format_;
36 requestable_settings_.resolution_change_policy =
37 media::RESOLUTION_POLICY_FIXED_RESOLUTION;
38 requestable_settings_.power_line_frequency =
39 media::PowerLineFrequency::FREQUENCY_DEFAULT;
40
21 factory_->CreateDeviceProxy( 41 factory_->CreateDeviceProxy(
22 std::move(fake_device_descriptor_), mojo::GetProxy(&fake_device_proxy_), 42 std::move(fake_device_descriptor_), mojo::GetProxy(&fake_device_proxy_),
23 base::Bind([](mojom::DeviceAccessResultCode result_code) { 43 base::Bind([](mojom::DeviceAccessResultCode result_code) {
24 ASSERT_EQ(mojom::DeviceAccessResultCode::SUCCESS, result_code); 44 ASSERT_EQ(mojom::DeviceAccessResultCode::SUCCESS, result_code);
25 })); 45 }));
26 } 46 }
27 47
28 } // namespace video_capture 48 } // namespace video_capture
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698