• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef UTEST_CAMERA_HDI_BASE_H
17 #define UTEST_CAMERA_HDI_BASE_H
18 
19 #include <thread>
20 #include <unistd.h>
21 #include <vector>
22 #include <map>
23 #include <gtest/gtest.h>
24 #include <hdf_log.h>
25 #include <osal_mem.h>
26 #include "securec.h"
27 
28 #include "camera.h"
29 #include "camera_metadata_info.h"
30 #include "ibuffer.h"
31 #include "if_system_ability_manager.h"
32 #include "ioffline_stream_operator.h"
33 #include "iservice_registry.h"
34 #include <surface.h>
35 #include <display_type.h>
36 #include <fcntl.h>
37 #include <stdio.h>
38 #include <sys/ioctl.h>
39 #include <sys/wait.h>
40 #include <unistd.h>
41 
42 #include "icamera_host.h"
43 #include "camera_host_proxy.h"
44 #include "camera_host_callback.h"
45 #include "camera_device_callback.h"
46 #include "icamera_device.h"
47 #include "stream_operator_callback.h"
48 #include "istream_operator_callback.h"
49 
50 using namespace OHOS;
51 using namespace testing::ext;
52 using namespace OHOS::Camera;
53 
54 class CameraHdiBaseTest : public testing::Test {
55 public:
56     static void SetUpTestCase(void);
57     static void TearDownTestCase(void);
58 
59     void SetUp(void);
60     void TearDown(void);
61 
62 protected:
63     virtual bool InitCameraHost();
64     virtual bool GetCameraDevice();
65     virtual bool GetStreamOperator();
66     virtual bool GetCameraIds();
67     int32_t SaveToFile(const std::string path, const void* buffer, int32_t size);
68     uint64_t GetCurrentLocalTimeStamp();
69 
70 protected:
71     sptr<ICameraHost> cameraHost_ = nullptr;
72     sptr<ICameraDevice> cameraDevice_ = nullptr;
73     sptr<IStreamOperator> streamOperator_ = nullptr;
74 
75     std::vector<std::string> cameraIds_;
76 };
77 #endif // UTEST_CAMERA_HDI_BASE_H
78