am 024c1534
: Camera: HAL3: device test fixture and a test.
* commit '024c15346b00c2ac7d6b53e78422570bbc4245c7': Camera: HAL3: device test fixture and a test.
This commit is contained in:
commit
f49598e058
2 changed files with 43 additions and 5 deletions
|
@ -26,12 +26,12 @@ namespace tests {
|
|||
static const int kMmaxCams = 2;
|
||||
static const uint16_t kVersion3_0 = HARDWARE_MODULE_API_VERSION(3, 0);
|
||||
|
||||
class Camera3Test : public testing::Test {
|
||||
class Camera3Module : public testing::Test {
|
||||
public:
|
||||
Camera3Test() :
|
||||
Camera3Module() :
|
||||
num_cams_(0),
|
||||
cam_module_(NULL) {}
|
||||
~Camera3Test() {}
|
||||
~Camera3Module() {}
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
const hw_module_t *hw_module = NULL;
|
||||
|
@ -52,6 +52,31 @@ class Camera3Test : public testing::Test {
|
|||
const camera_module_t *cam_module_;
|
||||
};
|
||||
|
||||
class Camera3Device : public Camera3Module {
|
||||
public:
|
||||
Camera3Device() :
|
||||
cam_device_(NULL) {}
|
||||
~Camera3Device() {}
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
Camera3Module::SetUp();
|
||||
hw_device_t *device = NULL;
|
||||
ASSERT_TRUE(NULL != cam_module()->common.methods->open)
|
||||
<< "Camera open() is unimplemented";
|
||||
ASSERT_EQ(0, cam_module()->common.methods->open(
|
||||
(const hw_module_t*)cam_module(), "0", &device))
|
||||
<< "Can't open camera device";
|
||||
ASSERT_TRUE(NULL != device)
|
||||
<< "Camera open() returned a NULL device";
|
||||
ASSERT_EQ(kVersion3_0, device->version)
|
||||
<< "The device does not support HAL3";
|
||||
cam_device_ = reinterpret_cast<camera3_device_t*>(device);
|
||||
}
|
||||
camera3_device_t* cam_device() { return cam_device_; }
|
||||
private:
|
||||
camera3_device *cam_device_;
|
||||
};
|
||||
|
||||
} // namespace tests
|
||||
|
||||
#endif // __ANDROID_HAL_CAMERA3_TEST_COMMON__
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
namespace tests {
|
||||
|
||||
TEST_F(Camera3Test, NumberOfCameras) {
|
||||
TEST_F(Camera3Module, NumberOfCameras) {
|
||||
ASSERT_LT(0, num_cams()) << "No cameras found";
|
||||
ASSERT_GE(kMmaxCams, num_cams()) << "Too many cameras found";
|
||||
}
|
||||
|
||||
TEST_F(Camera3Test, IsActiveArraySizeSubsetPixelArraySize) {
|
||||
TEST_F(Camera3Module, IsActiveArraySizeSubsetPixelArraySize) {
|
||||
for (int i = 0; i < num_cams(); ++i) {
|
||||
ASSERT_TRUE(NULL != cam_module()->get_camera_info)
|
||||
<< "get_camera_info is not implemented";
|
||||
|
@ -55,4 +55,17 @@ TEST_F(Camera3Test, IsActiveArraySizeSubsetPixelArraySize) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(Camera3Device, DefaultSettingsStillCaptureHasAndroidControlMode) {
|
||||
ASSERT_TRUE(NULL != cam_device()->ops) << "Camera device ops are NULL";
|
||||
const camera_metadata_t *default_settings =
|
||||
cam_device()->ops->construct_default_request_settings(cam_device(),
|
||||
CAMERA3_TEMPLATE_STILL_CAPTURE);
|
||||
ASSERT_TRUE(NULL != default_settings) << "Camera default settings are NULL";
|
||||
camera_metadata_entry entry;
|
||||
ASSERT_EQ(0, find_camera_metadata_entry(
|
||||
const_cast<camera_metadata_t*>(default_settings),
|
||||
ANDROID_CONTROL_MODE, &entry))
|
||||
<< "Can't find ANDROID_CONTROL_MODE in default settings.";
|
||||
}
|
||||
|
||||
} // namespace tests
|
||||
|
|
Loading…
Reference in a new issue