summaryrefslogtreecommitdiffstats
path: root/tests/camera2/CameraModuleTests.cpp
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2013-06-25 18:12:19 -0700
committerEino-Ville Talvala <etalvala@google.com>2013-06-27 18:02:24 -0700
commit4c543a1456cd34a94e2c3a09879aa65ed8cd2f3a (patch)
tree15bf4a8edf1aecdf2bf59b3f88c5ba3e07a923b6 /tests/camera2/CameraModuleTests.cpp
parent1a70c0fd39eed070c2c28fc0731fa689d15931c4 (diff)
downloadhardware_libhardware-4c543a1456cd34a94e2c3a09879aa65ed8cd2f3a.zip
hardware_libhardware-4c543a1456cd34a94e2c3a09879aa65ed8cd2f3a.tar.gz
hardware_libhardware-4c543a1456cd34a94e2c3a09879aa65ed8cd2f3a.tar.bz2
Enable native HAL tests to work for camera3 devices
Change-Id: Ie11270cc8cf301ec94795b595f0517ee3bad2817
Diffstat (limited to 'tests/camera2/CameraModuleTests.cpp')
-rw-r--r--tests/camera2/CameraModuleTests.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/tests/camera2/CameraModuleTests.cpp b/tests/camera2/CameraModuleTests.cpp
index fc6fd36..44d3e3b 100644
--- a/tests/camera2/CameraModuleTests.cpp
+++ b/tests/camera2/CameraModuleTests.cpp
@@ -23,7 +23,7 @@
#include "hardware/hardware.h"
#include "hardware/camera2.h"
-#include "Camera2Device.h"
+#include "CameraDeviceBase.h"
#include "utils/StrongPointer.h"
#include "CameraModuleFixture.h"
@@ -54,13 +54,6 @@ public:
return stat;
}
- int getDeviceVersion(int cameraId, status_t* status) {
- camera_info info;
- *status = mModule->get_camera_info(cameraId, &info);
-
- return info.device_version;
- }
-
bool isDeviceVersionHal2(int cameraId, status_t* status) {
return getDeviceVersion(cameraId, status)
>= CAMERA_DEVICE_API_VERSION_2_0;
@@ -72,8 +65,7 @@ TEST_F(CameraModuleTest, LoadModule) {
TEST_EXTENSION_FORKING_INIT;
for (int i = 0; i < mNumberOfCameras; ++i) {
- mDevice = new Camera2Device(i);
-
+ CreateCamera(i, &mDevice);
ASSERT_EQ(OK, initializeDevice(i))
<< "Failed to initialize device " << i;
mDevice.clear();
@@ -88,6 +80,8 @@ TEST_F(CameraModuleTest, LoadModuleBadIndices) {
int idx[] = { -1, mNumberOfCameras, mNumberOfCameras + 1 };
for (unsigned i = 0; i < sizeof(idx)/sizeof(idx[0]); ++i) {
+ // Since the initialization should fail at device open(), it doesn't
+ // matter which version of CameraNDevice is used here
mDevice = new Camera2Device(idx[i]);
status_t deviceInitializeCode = initializeDevice(idx[i]);
EXPECT_NE(OK, deviceInitializeCode);
@@ -136,4 +130,3 @@ TEST_F(CameraModuleTest, GetCameraInfoBadIndices) {
}
}
}
-