Home | History | Annotate | Download | only in 3_4
      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 <gmock/gmock.h>
     23 
     24 #include "v4l2_wrapper.h"
     25 
     26 namespace v4l2_camera_hal {
     27 
     28 class V4L2WrapperMock : public V4L2Wrapper {
     29  public:
     30   V4L2WrapperMock() : V4L2Wrapper("", nullptr){};
     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_METHOD2(GetFormatFrameSizes,
     40                int(uint32_t, std::set<std::array<int32_t, 2>>*));
     41   MOCK_METHOD3(GetFormatFrameDurationRange,
     42                int(uint32_t,
     43                    const std::array<int32_t, 2>&,
     44                    std::array<int64_t, 2>*));
     45   MOCK_METHOD4(SetFormat,
     46                int(int format,
     47                    uint32_t width,
     48                    uint32_t height,
     49                    uint32_t* result_max_buffers));
     50   MOCK_METHOD2(EnqueueBuffer,
     51                int(const camera3_stream_buffer_t* camera_buffer,
     52                    uint32_t* enqueued_index));
     53   MOCK_METHOD1(DequeueBuffer, int(uint32_t* dequeued_index));
     54 };
     55 
     56 }  // namespace v4l2_camera_hal
     57 
     58 #endif  // V4L2_CAMERA_HAL_V4L2_WRAPPER_MOCK_H_
     59