blob: e25880da22c8dc57598b4ba2f02b2f4f5603f20a [file] [log] [blame]
Sasha Levitskiy4a7b2172013-12-10 09:37:58 -08001/*
2 * Copyright (C) 2013 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#ifndef __ANDROID_HAL_CAMERA3_TEST_COMMON__
18#define __ANDROID_HAL_CAMERA3_TEST_COMMON__
19
20#include <gtest/gtest.h>
21#include <hardware/hardware.h>
22#include <hardware/camera3.h>
23
24namespace tests {
25
26static const int kMmaxCams = 2;
27static const uint16_t kVersion3_0 = HARDWARE_MODULE_API_VERSION(3, 0);
28
29class Camera3Test : public testing::Test {
30 public:
31 Camera3Test() :
32 num_cams_(0),
33 cam_module_(NULL) {}
34 ~Camera3Test() {}
35 protected:
36 virtual void SetUp() {
37 const hw_module_t *hw_module = NULL;
38 ASSERT_EQ(0, hw_get_module(CAMERA_HARDWARE_MODULE_ID, &hw_module))
39 << "Can't get camera module";
40 ASSERT_TRUE(NULL != hw_module)
41 << "hw_get_module didn't return a valid camera module";
42
43 cam_module_ = reinterpret_cast<const camera_module_t*>(hw_module);
44 ASSERT_TRUE(NULL != cam_module_->get_number_of_cameras)
45 << "get_number_of_cameras is not implemented";
46 num_cams_ = cam_module_->get_number_of_cameras();
47 }
48 int num_cams() { return num_cams_; }
49 const camera_module_t * cam_module() { return cam_module_; }
50 private:
51 int num_cams_;
52 const camera_module_t *cam_module_;
53};
54
55} // namespace tests
56
57#endif // __ANDROID_HAL_CAMERA3_TEST_COMMON__