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

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

Issue 2238083004: Video Capture Mojo (1.4b): Implement ability to use fake device instance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FillServicePart1
Patch Set: Fix control reached end of non-void function. Created 4 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/memory/ref_counted.h"
6 #include "base/run_loop.h"
7 #include "services/video_capture/fake_device_video_capture_service_test.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"
10 #include "services/video_capture/video_capture_service_test.h"
11
12 using testing::_;
13 using testing::InvokeWithoutArgs;
14
15 namespace video_capture {
16
17 TEST_F(FakeDeviceVideoCaptureServiceTest, FrameCallbacksArrive) {
18 auto arbitrary_requested_format = mojom::VideoCaptureFormat::New();
19 arbitrary_requested_format->frame_size.SetSize(640, 480);
20 arbitrary_requested_format->frame_rate = 15;
21 arbitrary_requested_format->pixel_format = media::mojom::VideoFormat::I420;
22 arbitrary_requested_format->pixel_storage = mojom::VideoPixelStorage::CPU;
23
24 base::RunLoop wait_loop;
25 const int kNumFramesToWaitFor = 3;
26 int num_frames_arrived = 0;
27 mojom::VideoCaptureDeviceClientPtr client_proxy;
28 MockVideoCaptureDeviceClient client(mojo::GetProxy(&client_proxy));
29 EXPECT_CALL(client, OnFrameAvailablePtr(_))
30 .WillRepeatedly(InvokeWithoutArgs(
31 [&wait_loop, &kNumFramesToWaitFor, &num_frames_arrived]() {
32 num_frames_arrived += 1;
33 if (num_frames_arrived >= kNumFramesToWaitFor) {
34 wait_loop.Quit();
35 }
36 }));
37
38 fake_device_proxy_->Start(std::move(arbitrary_requested_format),
39 mojom::ResolutionChangePolicy::FIXED_RESOLUTION,
40 mojom::PowerLineFrequency::DEFAULT,
41 std::move(client_proxy));
42 wait_loop.Run();
43 }
44
45 } // namespace video_capture
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698