diff options
author | Igor Murashkin <iam@google.com> | 2012-12-20 17:11:56 -0800 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2013-01-10 11:46:23 -0800 |
commit | 2dc781d20e8321aada3e8f46f76414c8dd3229da (patch) | |
tree | 7c226e095cc5b30afeef69047c8e5c06e7f41cb5 | |
parent | 2d3c3e145545f0920f38340a8702d39e5ae8a792 (diff) | |
download | libhardware-2dc781d20e8321aada3e8f46f76414c8dd3229da.tar.gz |
Camera2: Tests: ModuleTests should not return OK for bad indices: DO NOT MERGE
Change-Id: Ie2a0558104c13fe881d90ababf66a54f810f12aa
-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 cf34f04c..fc6fd362 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; } }; |