Camera2: Tests: ModuleTests should not return OK for bad indices: DO NOT MERGE

Change-Id: Ie2a0558104c13fe881d90ababf66a54f810f12aa
This commit is contained in:
Igor Murashkin 2012-12-20 17:11:56 -08:00
parent 2d3c3e1455
commit 2dc781d20e

View file

@ -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;
}
};