From 438d77e0429f78def6c0cb3c21095202c71b8220 Mon Sep 17 00:00:00 2001 From: Zhijun He Date: Thu, 10 Apr 2014 17:09:22 -0700 Subject: MediaFrameworkTest: Fix Camera2 API unit test build breakage Change-Id: I49329e2c3bbf1290f1f6e7c64dbb56eb831e5a96 --- .../integration/CameraBinderTest.java | 48 +++++++++--- .../integration/CameraDeviceBinderTest.java | 85 +++++++++++++++------- 2 files changed, 96 insertions(+), 37 deletions(-) (limited to 'media/tests') diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java index d157478..89886ef 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraBinderTest.java @@ -23,6 +23,7 @@ import android.hardware.ICameraServiceListener; import android.hardware.IProCameraCallbacks; import android.hardware.IProCameraUser; import android.hardware.camera2.CameraMetadata; +import android.hardware.camera2.CaptureResultExtras; import android.hardware.camera2.ICameraDeviceCallbacks; import android.hardware.camera2.ICameraDeviceUser; import android.hardware.camera2.impl.CameraMetadataNative; @@ -151,21 +152,50 @@ public class CameraBinderTest extends AndroidTestCase { static class DummyCameraDeviceCallbacks extends ICameraDeviceCallbacks.Stub { - @Override - public void onCameraError(int errorCode) { - } + /* + * (non-Javadoc) + * @see + * android.hardware.camera2.ICameraDeviceCallbacks#onCameraError(int, + * android.hardware.camera2.CaptureResultExtras) + */ + public void onCameraError(int errorCode, CaptureResultExtras resultExtras) + throws RemoteException { + // TODO Auto-generated method stub - @Override - public void onCameraIdle() { } - @Override - public void onCaptureStarted(int requestId, long timestamp) { + /* + * (non-Javadoc) + * @see + * android.hardware.camera2.ICameraDeviceCallbacks#onCaptureStarted( + * android.hardware.camera2.CaptureResultExtras, long) + */ + public void onCaptureStarted(CaptureResultExtras resultExtras, long timestamp) + throws RemoteException { + // TODO Auto-generated method stub + } - @Override - public void onResultReceived(int frameId, CameraMetadataNative result) + /* + * (non-Javadoc) + * @see + * android.hardware.camera2.ICameraDeviceCallbacks#onResultReceived( + * android.hardware.camera2.impl.CameraMetadataNative, + * android.hardware.camera2.CaptureResultExtras) + */ + public void onResultReceived(CameraMetadataNative result, CaptureResultExtras resultExtras) throws RemoteException { + // TODO Auto-generated method stub + + } + + /* + * (non-Javadoc) + * @see android.hardware.camera2.ICameraDeviceCallbacks#onCameraIdle() + */ + public void onCameraIdle() throws RemoteException { + // TODO Auto-generated method stub + } } diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraDeviceBinderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraDeviceBinderTest.java index 5f3ba74..74ce997 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraDeviceBinderTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/integration/CameraDeviceBinderTest.java @@ -21,6 +21,7 @@ import android.graphics.SurfaceTexture; import android.hardware.camera2.CameraMetadata; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CaptureRequest; +import android.hardware.camera2.CaptureResultExtras; import android.hardware.camera2.ICameraDeviceCallbacks; import android.hardware.camera2.ICameraDeviceUser; import android.hardware.camera2.impl.CameraMetadataNative; @@ -84,20 +85,50 @@ public class CameraDeviceBinderTest extends AndroidTestCase { public class DummyCameraDeviceCallbacks extends ICameraDeviceCallbacks.Stub { - @Override - public void onCameraError(int errorCode) { + /* + * (non-Javadoc) + * @see + * android.hardware.camera2.ICameraDeviceCallbacks#onCameraError(int, + * android.hardware.camera2.CaptureResultExtras) + */ + public void onCameraError(int errorCode, CaptureResultExtras resultExtras) + throws RemoteException { + // TODO Auto-generated method stub + } - @Override - public void onCameraIdle() { + /* + * (non-Javadoc) + * @see android.hardware.camera2.ICameraDeviceCallbacks#onCameraIdle() + */ + public void onCameraIdle() throws RemoteException { + // TODO Auto-generated method stub + } - @Override - public void onCaptureStarted(int requestId, long timestamp) { + /* + * (non-Javadoc) + * @see + * android.hardware.camera2.ICameraDeviceCallbacks#onCaptureStarted( + * android.hardware.camera2.CaptureResultExtras, long) + */ + public void onCaptureStarted(CaptureResultExtras resultExtras, long timestamp) + throws RemoteException { + // TODO Auto-generated method stub + } - @Override - public void onResultReceived(int frameId, CameraMetadataNative result) { + /* + * (non-Javadoc) + * @see + * android.hardware.camera2.ICameraDeviceCallbacks#onResultReceived( + * android.hardware.camera2.impl.CameraMetadataNative, + * android.hardware.camera2.CaptureResultExtras) + */ + public void onResultReceived(CameraMetadataNative result, CaptureResultExtras resultExtras) + throws RemoteException { + // TODO Auto-generated method stub + } } @@ -139,7 +170,7 @@ public class CameraDeviceBinderTest extends AndroidTestCase { } private int submitCameraRequest(CaptureRequest request, boolean streaming) throws Exception { - int requestId = mCameraUser.submitRequest(request, streaming); + int requestId = mCameraUser.submitRequest(request, streaming, null); assertTrue( "Request IDs should be non-negative (expected: >= 0, actual: " + requestId + ")", requestId >= 0); @@ -252,13 +283,13 @@ public class CameraDeviceBinderTest extends AndroidTestCase { CaptureRequest.Builder builder = createDefaultBuilder(/* needStream */false); CaptureRequest request1 = builder.build(); - int status = mCameraUser.submitRequest(request1, /* streaming */false); + int status = mCameraUser.submitRequest(request1, /* streaming */false, null); assertEquals("Expected submitRequest to return BAD_VALUE " + "since we had 0 surface targets set.", CameraBinderTestUtils.BAD_VALUE, status); builder.addTarget(mSurface); CaptureRequest request2 = builder.build(); - status = mCameraUser.submitRequest(request2, /* streaming */false); + status = mCameraUser.submitRequest(request2, /* streaming */false, null); assertEquals("Expected submitRequest to return BAD_VALUE since " + "the target surface wasn't registered with createStream.", CameraBinderTestUtils.BAD_VALUE, status); @@ -292,15 +323,15 @@ public class CameraDeviceBinderTest extends AndroidTestCase { assertNotSame("Request IDs should be unique for multiple requests", requestId1, requestIdStreaming); - int status = mCameraUser.cancelRequest(-1); + int status = mCameraUser.cancelRequest(-1, null); assertEquals("Invalid request IDs should not be cancellable", CameraBinderTestUtils.BAD_VALUE, status); - status = mCameraUser.cancelRequest(requestId1); + status = mCameraUser.cancelRequest(requestId1, null); assertEquals("Non-streaming request IDs should not be cancellable", CameraBinderTestUtils.BAD_VALUE, status); - status = mCameraUser.cancelRequest(requestIdStreaming); + status = mCameraUser.cancelRequest(requestIdStreaming, null); assertEquals("Streaming request IDs should be cancellable", CameraBinderTestUtils.NO_ERROR, status); @@ -339,7 +370,7 @@ public class CameraDeviceBinderTest extends AndroidTestCase { CameraBinderTestUtils.INVALID_OPERATION, status); // Test good case, waitUntilIdle when there is no active repeating request - status = mCameraUser.cancelRequest(requestIdStreaming); + status = mCameraUser.cancelRequest(requestIdStreaming, null); assertEquals(CameraBinderTestUtils.NO_ERROR, status); status = mCameraUser.waitUntilIdle(); assertEquals(CameraBinderTestUtils.NO_ERROR, status); @@ -351,16 +382,14 @@ public class CameraDeviceBinderTest extends AndroidTestCase { CaptureRequest request = createDefaultBuilder(/* needStream */true).build(); // Test both single request and streaming request. - int requestId1 = submitCameraRequest(request, /* streaming */false); verify(mMockCb, timeout(WAIT_FOR_COMPLETE_TIMEOUT_MS).times(1)).onResultReceived( - eq(requestId1), - argThat(matcher)); + argThat(matcher), + any(CaptureResultExtras.class)); - int streamingId = submitCameraRequest(request, /* streaming */true); verify(mMockCb, timeout(WAIT_FOR_COMPLETE_TIMEOUT_MS).atLeast(NUM_CALLBACKS_CHECKED)) .onResultReceived( - eq(streamingId), - argThat(matcher)); + argThat(matcher), + any(CaptureResultExtras.class)); } @SmallTest @@ -372,13 +401,13 @@ public class CameraDeviceBinderTest extends AndroidTestCase { // Test both single request and streaming request. int requestId1 = submitCameraRequest(request, /* streaming */false); verify(mMockCb, timeout(WAIT_FOR_COMPLETE_TIMEOUT_MS).times(1)).onCaptureStarted( - eq(requestId1), + any(CaptureResultExtras.class), anyLong()); int streamingId = submitCameraRequest(request, /* streaming */true); verify(mMockCb, timeout(WAIT_FOR_COMPLETE_TIMEOUT_MS).atLeast(NUM_CALLBACKS_CHECKED)) .onCaptureStarted( - eq(streamingId), + any(CaptureResultExtras.class), timestamps.capture()); long timestamp = 0; // All timestamps should be larger than 0. @@ -401,7 +430,7 @@ public class CameraDeviceBinderTest extends AndroidTestCase { SystemClock.sleep(WAIT_FOR_WORK_MS); // Cancel and make sure we eventually quiesce - status = mCameraUser.cancelRequest(streamingId); + status = mCameraUser.cancelRequest(streamingId, null); verify(mMockCb, timeout(WAIT_FOR_IDLE_TIMEOUT_MS).times(1)).onCameraIdle(); @@ -422,14 +451,14 @@ public class CameraDeviceBinderTest extends AndroidTestCase { int status; // Initial flush should work - status = mCameraUser.flush(); + status = mCameraUser.flush(null); assertEquals(CameraBinderTestUtils.NO_ERROR, status); // Then set up a stream CaptureRequest request = createDefaultBuilder(/* needStream */true).build(); // Flush should still be a no-op, really - status = mCameraUser.flush(); + status = mCameraUser.flush(null); assertEquals(CameraBinderTestUtils.NO_ERROR, status); // Submit a few capture requests @@ -440,7 +469,7 @@ public class CameraDeviceBinderTest extends AndroidTestCase { int requestId5 = submitCameraRequest(request, /* streaming */false); // Then flush and wait for idle - status = mCameraUser.flush(); + status = mCameraUser.flush(null); assertEquals(CameraBinderTestUtils.NO_ERROR, status); verify(mMockCb, timeout(WAIT_FOR_FLUSH_TIMEOUT_MS).times(1)).onCameraIdle(); @@ -452,7 +481,7 @@ public class CameraDeviceBinderTest extends AndroidTestCase { SystemClock.sleep(WAIT_FOR_WORK_MS); // Then flush and wait for the idle callback - status = mCameraUser.flush(); + status = mCameraUser.flush(null); assertEquals(CameraBinderTestUtils.NO_ERROR, status); verify(mMockCb, timeout(WAIT_FOR_FLUSH_TIMEOUT_MS).times(2)).onCameraIdle(); -- cgit v1.1