Camera2 Tests: fix some sanity checks
Remove the requirement of HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED and make and
fix some minor issues.
Bug: 10388724
Change-Id: I18f0ea60f87902d6c2bbaca53957a91953866c40
diff --git a/tests/camera2/CameraMetadataTests.cpp b/tests/camera2/CameraMetadataTests.cpp
index 2923de9..eddc593 100644
--- a/tests/camera2/CameraMetadataTests.cpp
+++ b/tests/camera2/CameraMetadataTests.cpp
@@ -136,10 +136,6 @@
EXPECT_TRUE(
HasElementInArrayFromStaticTag(ANDROID_SCALER_AVAILABLE_FORMATS,
- HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED));
-
- EXPECT_TRUE(
- HasElementInArrayFromStaticTag(ANDROID_SCALER_AVAILABLE_FORMATS,
HAL_PIXEL_FORMAT_BLOB)); // JPEG
if (getDeviceVersion() < CAMERA_DEVICE_API_VERSION_3_0) {
@@ -169,9 +165,11 @@
// Iff there are listed raw resolutions, the format should be available
int rawResolutionsCount =
GetEntryCountFromStaticTag(ANDROID_SCALER_AVAILABLE_RAW_SIZES);
- EXPECT_EQ(rawResolutionsCount > 0,
- HasElementInArrayFromStaticTag(ANDROID_SCALER_AVAILABLE_FORMATS,
- HAL_PIXEL_FORMAT_RAW_SENSOR));
+ if (rawResolutionsCount > 0) {
+ EXPECT_TRUE(
+ HasElementInArrayFromStaticTag(ANDROID_SCALER_AVAILABLE_FORMATS,
+ HAL_PIXEL_FORMAT_RAW_SENSOR));
+ }
// Required processed sizes.
int processedSizeCount =
diff --git a/tests/camera2/CameraModuleTests.cpp b/tests/camera2/CameraModuleTests.cpp
index e01cea4..9bd65ec 100644
--- a/tests/camera2/CameraModuleTests.cpp
+++ b/tests/camera2/CameraModuleTests.cpp
@@ -80,9 +80,7 @@
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]);
+ CreateCamera(idx[i], &mDevice);
status_t deviceInitializeCode = initializeDevice(idx[i]);
EXPECT_NE(OK, deviceInitializeCode);
EXPECT_EQ(-ENODEV, deviceInitializeCode)