Search in sources :

Example 1 with ICameraServiceListener

use of android.hardware.ICameraServiceListener in project android_frameworks_base by ResurrectionRemix.

the class CameraBinderTest method testAddRemoveListeners.

/**
     * <pre>
     * adb shell am instrument \
     *   -e class 'com.android.mediaframeworktest.integration.CameraBinderTest#testAddRemoveListeners' \
     *   -w com.android.mediaframeworktest/.MediaFrameworkIntegrationTestRunner
     * </pre>
     */
@SmallTest
public void testAddRemoveListeners() throws Exception {
    for (int cameraId = 0; cameraId < mUtils.getGuessedNumCameras(); ++cameraId) {
        ICameraServiceListener listener = new DummyCameraServiceListener();
        try {
            mUtils.getCameraService().removeListener(listener);
            fail("Listener was removed before added");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was removed before added", e.errorCode, ICameraService.ERROR_ILLEGAL_ARGUMENT);
        }
        mUtils.getCameraService().addListener(listener);
        try {
            mUtils.getCameraService().addListener(listener);
            fail("Listener was wrongly added again");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was wrongly added again", e.errorCode, ICameraService.ERROR_ALREADY_EXISTS);
        }
        mUtils.getCameraService().removeListener(listener);
        try {
            mUtils.getCameraService().removeListener(listener);
            fail("Listener was wrongly removed twice");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was wrongly removed twice", e.errorCode, ICameraService.ERROR_ILLEGAL_ARGUMENT);
        }
    }
}
Also used : ICameraServiceListener(android.hardware.ICameraServiceListener) ServiceSpecificException(android.os.ServiceSpecificException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 2 with ICameraServiceListener

use of android.hardware.ICameraServiceListener in project android_frameworks_base by AOSPA.

the class CameraBinderTest method testAddRemoveListeners.

/**
     * <pre>
     * adb shell am instrument \
     *   -e class 'com.android.mediaframeworktest.integration.CameraBinderTest#testAddRemoveListeners' \
     *   -w com.android.mediaframeworktest/.MediaFrameworkIntegrationTestRunner
     * </pre>
     */
@SmallTest
public void testAddRemoveListeners() throws Exception {
    for (int cameraId = 0; cameraId < mUtils.getGuessedNumCameras(); ++cameraId) {
        ICameraServiceListener listener = new DummyCameraServiceListener();
        try {
            mUtils.getCameraService().removeListener(listener);
            fail("Listener was removed before added");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was removed before added", e.errorCode, ICameraService.ERROR_ILLEGAL_ARGUMENT);
        }
        mUtils.getCameraService().addListener(listener);
        try {
            mUtils.getCameraService().addListener(listener);
            fail("Listener was wrongly added again");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was wrongly added again", e.errorCode, ICameraService.ERROR_ALREADY_EXISTS);
        }
        mUtils.getCameraService().removeListener(listener);
        try {
            mUtils.getCameraService().removeListener(listener);
            fail("Listener was wrongly removed twice");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was wrongly removed twice", e.errorCode, ICameraService.ERROR_ILLEGAL_ARGUMENT);
        }
    }
}
Also used : ICameraServiceListener(android.hardware.ICameraServiceListener) ServiceSpecificException(android.os.ServiceSpecificException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 3 with ICameraServiceListener

use of android.hardware.ICameraServiceListener in project android_frameworks_base by crdroidandroid.

the class CameraBinderTest method testAddRemoveListeners.

/**
     * <pre>
     * adb shell am instrument \
     *   -e class 'com.android.mediaframeworktest.integration.CameraBinderTest#testAddRemoveListeners' \
     *   -w com.android.mediaframeworktest/.MediaFrameworkIntegrationTestRunner
     * </pre>
     */
@SmallTest
public void testAddRemoveListeners() throws Exception {
    for (int cameraId = 0; cameraId < mUtils.getGuessedNumCameras(); ++cameraId) {
        ICameraServiceListener listener = new DummyCameraServiceListener();
        try {
            mUtils.getCameraService().removeListener(listener);
            fail("Listener was removed before added");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was removed before added", e.errorCode, ICameraService.ERROR_ILLEGAL_ARGUMENT);
        }
        mUtils.getCameraService().addListener(listener);
        try {
            mUtils.getCameraService().addListener(listener);
            fail("Listener was wrongly added again");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was wrongly added again", e.errorCode, ICameraService.ERROR_ALREADY_EXISTS);
        }
        mUtils.getCameraService().removeListener(listener);
        try {
            mUtils.getCameraService().removeListener(listener);
            fail("Listener was wrongly removed twice");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was wrongly removed twice", e.errorCode, ICameraService.ERROR_ILLEGAL_ARGUMENT);
        }
    }
}
Also used : ICameraServiceListener(android.hardware.ICameraServiceListener) ServiceSpecificException(android.os.ServiceSpecificException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 4 with ICameraServiceListener

use of android.hardware.ICameraServiceListener in project platform_frameworks_base by android.

the class CameraBinderTest method testAddRemoveListeners.

/**
     * <pre>
     * adb shell am instrument \
     *   -e class 'com.android.mediaframeworktest.integration.CameraBinderTest#testAddRemoveListeners' \
     *   -w com.android.mediaframeworktest/.MediaFrameworkIntegrationTestRunner
     * </pre>
     */
@SmallTest
public void testAddRemoveListeners() throws Exception {
    for (int cameraId = 0; cameraId < mUtils.getGuessedNumCameras(); ++cameraId) {
        ICameraServiceListener listener = new DummyCameraServiceListener();
        try {
            mUtils.getCameraService().removeListener(listener);
            fail("Listener was removed before added");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was removed before added", e.errorCode, ICameraService.ERROR_ILLEGAL_ARGUMENT);
        }
        mUtils.getCameraService().addListener(listener);
        try {
            mUtils.getCameraService().addListener(listener);
            fail("Listener was wrongly added again");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was wrongly added again", e.errorCode, ICameraService.ERROR_ALREADY_EXISTS);
        }
        mUtils.getCameraService().removeListener(listener);
        try {
            mUtils.getCameraService().removeListener(listener);
            fail("Listener was wrongly removed twice");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was wrongly removed twice", e.errorCode, ICameraService.ERROR_ILLEGAL_ARGUMENT);
        }
    }
}
Also used : ICameraServiceListener(android.hardware.ICameraServiceListener) ServiceSpecificException(android.os.ServiceSpecificException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 5 with ICameraServiceListener

use of android.hardware.ICameraServiceListener in project android_frameworks_base by DirtyUnicorns.

the class CameraBinderTest method testAddRemoveListeners.

/**
     * <pre>
     * adb shell am instrument \
     *   -e class 'com.android.mediaframeworktest.integration.CameraBinderTest#testAddRemoveListeners' \
     *   -w com.android.mediaframeworktest/.MediaFrameworkIntegrationTestRunner
     * </pre>
     */
@SmallTest
public void testAddRemoveListeners() throws Exception {
    for (int cameraId = 0; cameraId < mUtils.getGuessedNumCameras(); ++cameraId) {
        ICameraServiceListener listener = new DummyCameraServiceListener();
        try {
            mUtils.getCameraService().removeListener(listener);
            fail("Listener was removed before added");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was removed before added", e.errorCode, ICameraService.ERROR_ILLEGAL_ARGUMENT);
        }
        mUtils.getCameraService().addListener(listener);
        try {
            mUtils.getCameraService().addListener(listener);
            fail("Listener was wrongly added again");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was wrongly added again", e.errorCode, ICameraService.ERROR_ALREADY_EXISTS);
        }
        mUtils.getCameraService().removeListener(listener);
        try {
            mUtils.getCameraService().removeListener(listener);
            fail("Listener was wrongly removed twice");
        } catch (ServiceSpecificException e) {
            assertEquals("Listener was wrongly removed twice", e.errorCode, ICameraService.ERROR_ILLEGAL_ARGUMENT);
        }
    }
}
Also used : ICameraServiceListener(android.hardware.ICameraServiceListener) ServiceSpecificException(android.os.ServiceSpecificException) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

ICameraServiceListener (android.hardware.ICameraServiceListener)5 ServiceSpecificException (android.os.ServiceSpecificException)5 SmallTest (android.test.suitebuilder.annotation.SmallTest)5