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

Side by Side Diff: media/capture/video/chromeos/mock_video_capture_client.cc

Issue 2936373002: Revert of media: add video capture device for ARC++ camera HAL v3 (Closed)
Patch Set: Created 3 years, 6 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 2017 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 "media/capture/video/chromeos/mock_video_capture_client.h"
6
7 #include <string>
8 #include <utility>
9
10 using testing::_;
11 using testing::Invoke;
12
13 namespace media {
14 namespace unittest_internal {
15
16 MockVideoCaptureClient::MockVideoCaptureClient() {
17 ON_CALL(*this, OnError(_, _))
18 .WillByDefault(Invoke(this, &MockVideoCaptureClient::DumpError));
19 }
20
21 MockVideoCaptureClient::~MockVideoCaptureClient() {
22 if (quit_cb_) {
23 std::move(quit_cb_).Run();
24 }
25 }
26
27 void MockVideoCaptureClient::SetFrameCb(base::OnceClosure frame_cb) {
28 frame_cb_ = std::move(frame_cb);
29 }
30
31 void MockVideoCaptureClient::SetQuitCb(base::OnceClosure quit_cb) {
32 quit_cb_ = std::move(quit_cb);
33 }
34
35 void MockVideoCaptureClient::DumpError(
36 const tracked_objects::Location& location,
37 const std::string& message) {
38 DPLOG(ERROR) << location.ToString() << " " << message;
39 }
40
41 void MockVideoCaptureClient::OnIncomingCapturedData(
42 const uint8_t* data,
43 int length,
44 const VideoCaptureFormat& format,
45 int rotation,
46 base::TimeTicks reference_time,
47 base::TimeDelta timestamp,
48 int frame_feedback_id) {
49 ASSERT_GT(length, 0);
50 ASSERT_TRUE(data);
51 if (frame_cb_) {
52 std::move(frame_cb_).Run();
53 }
54 }
55
56 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>.
57 VideoCaptureDevice::Client::Buffer MockVideoCaptureClient::ReserveOutputBuffer(
58 const gfx::Size& dimensions,
59 media::VideoPixelFormat format,
60 media::VideoPixelStorage storage,
61 int frame_feedback_id) {
62 DoReserveOutputBuffer();
63 NOTREACHED() << "This should never be called";
64 return Buffer();
65 }
66
67 void MockVideoCaptureClient::OnIncomingCapturedBuffer(
68 Buffer buffer,
69 const VideoCaptureFormat& format,
70 base::TimeTicks reference_time,
71 base::TimeDelta timestamp) {
72 DoOnIncomingCapturedBuffer();
73 }
74
75 void MockVideoCaptureClient::OnIncomingCapturedBufferExt(
76 Buffer buffer,
77 const VideoCaptureFormat& format,
78 base::TimeTicks reference_time,
79 base::TimeDelta timestamp,
80 gfx::Rect visible_rect,
81 const VideoFrameMetadata& additional_metadata) {
82 DoOnIncomingCapturedVideoFrame();
83 }
84
85 VideoCaptureDevice::Client::Buffer
86 MockVideoCaptureClient::ResurrectLastOutputBuffer(
87 const gfx::Size& dimensions,
88 media::VideoPixelFormat format,
89 media::VideoPixelStorage storage,
90 int frame_feedback_id) {
91 DoResurrectLastOutputBuffer();
92 NOTREACHED() << "This should never be called";
93 return Buffer();
94 }
95
96 } // namespace unittest_internal
97 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/chromeos/mock_video_capture_client.h ('k') | media/capture/video/chromeos/mojo/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698