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

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

Issue 2379253003: Video Capture Service: typemap video_capture's and media's VideoCaptureFormat (Closed)
Patch Set: more traits methods inlining Created 4 years, 2 months 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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "services/video_capture/fake_device_test.h" 7 #include "services/video_capture/fake_device_test.h"
8 #include "services/video_capture/mock_video_capture_device_client.h" 8 #include "services/video_capture/mock_video_capture_device_client.h"
9 #include "services/video_capture/public/interfaces/video_capture_device_factory. mojom.h" 9 #include "services/video_capture/public/interfaces/video_capture_device_factory. mojom.h"
10 #include "services/video_capture/video_capture_service_test.h" 10 #include "services/video_capture/video_capture_service_test.h"
11 11
12 using testing::_; 12 using testing::_;
13 using testing::InvokeWithoutArgs; 13 using testing::InvokeWithoutArgs;
14 14
15 namespace video_capture { 15 namespace video_capture {
16 16
17 TEST_F(FakeDeviceTest, FrameCallbacksArrive) { 17 TEST_F(FakeDeviceTest, FrameCallbacksArrive) {
18 auto arbitrary_requested_format = mojom::VideoCaptureFormat::New(); 18 media::VideoCaptureFormat arbitrary_requested_format;
19 arbitrary_requested_format->frame_size.SetSize(640, 480); 19 arbitrary_requested_format.frame_size.SetSize(640, 480);
20 arbitrary_requested_format->frame_rate = 15; 20 arbitrary_requested_format.frame_rate = 15;
21 arbitrary_requested_format->pixel_format = media::mojom::VideoFormat::I420; 21 arbitrary_requested_format.pixel_format = media::PIXEL_FORMAT_I420;
22 arbitrary_requested_format->pixel_storage = mojom::VideoPixelStorage::CPU; 22 arbitrary_requested_format.pixel_storage = media::PIXEL_STORAGE_CPU;
23 23
24 base::RunLoop wait_loop; 24 base::RunLoop wait_loop;
25 const int kNumFramesToWaitFor = 3; 25 const int kNumFramesToWaitFor = 3;
26 int num_frames_arrived = 0; 26 int num_frames_arrived = 0;
27 mojom::VideoCaptureDeviceClientPtr client_proxy; 27 mojom::VideoCaptureDeviceClientPtr client_proxy;
28 MockVideoCaptureDeviceClient client(mojo::GetProxy(&client_proxy)); 28 MockVideoCaptureDeviceClient client(mojo::GetProxy(&client_proxy));
29 EXPECT_CALL(client, OnFrameAvailablePtr(_)) 29 EXPECT_CALL(client, OnFrameAvailablePtr(_))
30 .WillRepeatedly(InvokeWithoutArgs( 30 .WillRepeatedly(InvokeWithoutArgs(
31 [&wait_loop, &kNumFramesToWaitFor, &num_frames_arrived]() { 31 [&wait_loop, &kNumFramesToWaitFor, &num_frames_arrived]() {
32 num_frames_arrived += 1; 32 num_frames_arrived += 1;
33 if (num_frames_arrived >= kNumFramesToWaitFor) { 33 if (num_frames_arrived >= kNumFramesToWaitFor) {
34 wait_loop.Quit(); 34 wait_loop.Quit();
35 } 35 }
36 })); 36 }));
37 37
38 fake_device_proxy_->Start(std::move(arbitrary_requested_format), 38 fake_device_proxy_->Start(arbitrary_requested_format,
39 mojom::ResolutionChangePolicy::FIXED_RESOLUTION, 39 mojom::ResolutionChangePolicy::FIXED_RESOLUTION,
40 mojom::PowerLineFrequency::DEFAULT, 40 mojom::PowerLineFrequency::DEFAULT,
41 std::move(client_proxy)); 41 std::move(client_proxy));
42 wait_loop.Run(); 42 wait_loop.Run();
43 } 43 }
44 44
45 } // namespace video_capture 45 } // namespace video_capture
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698