diff options
author | Igor Murashkin <iam@google.com> | 2012-12-20 17:11:56 -0800 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2012-12-20 17:11:56 -0800 |
commit | e9b0eaaec6ac6bc988a52b6ce61b87334dc71bfc (patch) | |
tree | 22ea2d06a657abb7c8fa8507101388e39eb93b2c /tests/camera2 | |
parent | 599b76fec79b9ed111676bed9004c35ab8c5adea (diff) | |
download | hardware_libhardware-e9b0eaaec6ac6bc988a52b6ce61b87334dc71bfc.zip hardware_libhardware-e9b0eaaec6ac6bc988a52b6ce61b87334dc71bfc.tar.gz hardware_libhardware-e9b0eaaec6ac6bc988a52b6ce61b87334dc71bfc.tar.bz2 |
Camera2: Tests: ModuleTests should not return OK for bad indices
Change-Id: Ia7a199d091edb4054dcd2d7164e57b3b653c5a64
Diffstat (limited to 'tests/camera2')
-rw-r--r-- | tests/camera2/CameraModuleTests.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/camera2/CameraModuleTests.cpp b/tests/camera2/CameraModuleTests.cpp index cf34f04..fc6fd36 100644 --- a/tests/camera2/CameraModuleTests.cpp +++ b/tests/camera2/CameraModuleTests.cpp @@ -46,23 +46,24 @@ public: status_t initializeDevice(int cameraId) { // ignore HAL1s. count as test pass - if (!isDeviceVersionHal2(cameraId)) { - return OK; + status_t stat; + if (isDeviceVersionHal2(cameraId, &stat) && stat == OK) { + stat = mDevice->initialize(mModule); } - return mDevice->initialize(mModule); + return stat; } - int getDeviceVersion(int cameraId) { + int getDeviceVersion(int cameraId, status_t* status) { camera_info info; - status_t res = mModule->get_camera_info(cameraId, &info); - EXPECT_EQ(OK, res); + *status = mModule->get_camera_info(cameraId, &info); return info.device_version; } - bool isDeviceVersionHal2(int cameraId) { - return getDeviceVersion(cameraId) >= CAMERA_DEVICE_API_VERSION_2_0; + bool isDeviceVersionHal2(int cameraId, status_t* status) { + return getDeviceVersion(cameraId, status) + >= CAMERA_DEVICE_API_VERSION_2_0; } }; |