ronnie
2022-10-14 1504bb53e29d3d46222c0b3ea994fc494b48e153
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Copyright (c) 2021 by Allwinnertech Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
// Mock for wrapper class used to communicate with V4L2 devices.
 
#ifndef V4L2_CAMERA_HAL_V4L2_WRAPPER_MOCK_H_
#define V4L2_CAMERA_HAL_V4L2_WRAPPER_MOCK_H_
 
#include <gmock/gmock.h>
 
#include <set>
 
#include "v4l2_wrapper.h"
 
namespace v4l2_camera_hal {
 
class V4L2WrapperMock : public V4L2Wrapper {
 public:
  V4L2WrapperMock() : V4L2Wrapper("", nullptr) {}
  MOCK_METHOD0(StreamOn, int());
  MOCK_METHOD0(StreamOff, int());
  MOCK_METHOD2(QueryControl,
               int(uint32_t control_id, v4l2_query_ext_ctrl* result));
  MOCK_METHOD2(GetControl, int(uint32_t control_id, int32_t* value));
  MOCK_METHOD3(SetControl,
               int(uint32_t control_id, int32_t desired, int32_t* result));
  MOCK_METHOD1(GetFormats, int(std::set<uint32_t>*));
  MOCK_METHOD2(GetFormatFrameSizes,
               int(uint32_t, std::set<std::array<int32_t, 2>>*));
  MOCK_METHOD3(GetFormatFrameDurationRange,
               int(uint32_t,
                   const std::array<int32_t, 2>&,
                   std::array<int64_t, 2>*));
  MOCK_METHOD4(SetFormat,
               int(int format,
                   uint32_t width,
                   uint32_t height,
                   uint32_t* result_max_buffers));
  MOCK_METHOD2(EnqueueBuffer,
               int(const camera3_stream_buffer_t* camera_buffer,
                   uint32_t* enqueued_index));
  MOCK_METHOD1(DequeueBuffer, int(uint32_t* dequeued_index));
};
 
}  // namespace v4l2_camera_hal
 
#endif  // V4L2_CAMERA_HAL_V4L2_WRAPPER_MOCK_H_