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