summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2013-03-27 22:43:14 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-03-27 22:43:14 +0000
commit8d012b56cbd49f33841c13aaa5b7b42020de82ed (patch)
tree240cbe1534e19bd52b6f55e5d9623de2a7fea010 /camera
parentac51135d48ded504af38f0bc7fda47823419332f (diff)
parenta36381479c5c546a01188390f1e0d2e280a3dbd8 (diff)
downloadframeworks_av-8d012b56cbd49f33841c13aaa5b7b42020de82ed.zip
frameworks_av-8d012b56cbd49f33841c13aaa5b7b42020de82ed.tar.gz
frameworks_av-8d012b56cbd49f33841c13aaa5b7b42020de82ed.tar.bz2
Merge "Camera: Add hotplug support (for fixed # of cameras)" into jb-mr2-dev
Diffstat (limited to 'camera')
-rw-r--r--camera/tests/ProCameraTests.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/camera/tests/ProCameraTests.cpp b/camera/tests/ProCameraTests.cpp
index 87f817a..2b5f3ad 100644
--- a/camera/tests/ProCameraTests.cpp
+++ b/camera/tests/ProCameraTests.cpp
@@ -587,14 +587,19 @@ TEST_F(ProCameraTest, DISABLED_StreamingImageSingle) {
sp<ServiceListener> listener = new ServiceListener();
EXPECT_OK(ProCamera::addServiceListener(listener));
- ServiceListener::Status currentStatus = ServiceListener::STATUS_AVAILABLE;
+ ServiceListener::Status currentStatus;
+
+ // when subscribing a new listener,
+ // we immediately get a callback to the current status
+ while (listener->waitForStatusChange(/*out*/currentStatus) != OK);
+ EXPECT_EQ(ServiceListener::STATUS_PRESENT, currentStatus);
dout << "Will now stream and resume infinitely..." << std::endl;
while (true) {
- if (currentStatus == ServiceListener::STATUS_AVAILABLE) {
+ if (currentStatus == ServiceListener::STATUS_PRESENT) {
- EXPECT_OK(mCamera->createStream(mDisplayW, mDisplayH, mDisplayFmt,
+ ASSERT_OK(mCamera->createStream(mDisplayW, mDisplayH, mDisplayFmt,
surface,
&depthStreamId));
EXPECT_NE(-1, depthStreamId);
@@ -613,12 +618,15 @@ TEST_F(ProCameraTest, DISABLED_StreamingImageSingle) {
while (listener->waitForStatusChange(/*out*/stat) != OK);
if (currentStatus != stat) {
- if (stat == ServiceListener::STATUS_AVAILABLE) {
+ if (stat == ServiceListener::STATUS_PRESENT) {
dout << "Reconnecting to camera" << std::endl;
mCamera = ProCamera::connect(CAMERA_ID);
} else if (stat == ServiceListener::STATUS_NOT_AVAILABLE) {
dout << "Disconnecting from camera" << std::endl;
mCamera->disconnect();
+ } else if (stat == ServiceListener::STATUS_NOT_PRESENT) {
+ dout << "Camera unplugged" << std::endl;
+ mCamera = NULL;
} else {
dout << "Unknown status change "
<< std::hex << stat << std::endl;
@@ -1219,7 +1227,7 @@ TEST_F(ProCameraTest, ServiceListenersFunctional) {
}
EXPECT_OK(listener->waitForStatusChange(/*out*/stat));
- EXPECT_EQ(ServiceListener::STATUS_AVAILABLE, stat);
+ EXPECT_EQ(ServiceListener::STATUS_PRESENT, stat);
EXPECT_OK(ProCamera::removeServiceListener(listener));
}