| Index: webrtc/sdk/android/instrumentationtests/src/org/webrtc/Camera1CapturerUsingByteBufferTest.java
|
| diff --git a/webrtc/sdk/android/instrumentationtests/src/org/webrtc/Camera1CapturerUsingByteBufferTest.java b/webrtc/sdk/android/instrumentationtests/src/org/webrtc/Camera1CapturerUsingByteBufferTest.java
|
| index 6163f5a9586e837834ff8bb24fcbe7a1e7ee459b..a64ac17f0879a57ba8a4d4890970565a16bc5dea 100644
|
| --- a/webrtc/sdk/android/instrumentationtests/src/org/webrtc/Camera1CapturerUsingByteBufferTest.java
|
| +++ b/webrtc/sdk/android/instrumentationtests/src/org/webrtc/Camera1CapturerUsingByteBufferTest.java
|
| @@ -11,12 +11,18 @@
|
| package org.webrtc;
|
|
|
| import android.content.Context;
|
| -import android.test.InstrumentationTestCase;
|
| -import android.test.suitebuilder.annotation.LargeTest;
|
| -import android.test.suitebuilder.annotation.MediumTest;
|
| -import android.test.suitebuilder.annotation.SmallTest;
|
| -
|
| -public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase {
|
| +import android.support.test.InstrumentationRegistry;
|
| +import android.support.test.filters.LargeTest;
|
| +import android.support.test.filters.MediumTest;
|
| +import android.support.test.filters.SmallTest;
|
| +import org.chromium.base.test.BaseJUnit4ClassRunner;
|
| +import org.junit.After;
|
| +import org.junit.Before;
|
| +import org.junit.Test;
|
| +import org.junit.runner.RunWith;
|
| +
|
| +@RunWith(BaseJUnit4ClassRunner.class)
|
| +public class Camera1CapturerUsingByteBufferTest {
|
| static final String TAG = "Camera1CapturerUsingByteBufferTest";
|
|
|
| private class TestObjectFactory extends CameraVideoCapturerTestFixtures.TestObjectFactory {
|
| @@ -32,7 +38,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
|
|
| @Override
|
| public Context getAppContext() {
|
| - return getInstrumentation().getTargetContext();
|
| + return InstrumentationRegistry.getTargetContext();
|
| }
|
|
|
| @SuppressWarnings("deprecation")
|
| @@ -50,21 +56,23 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
|
|
| private CameraVideoCapturerTestFixtures fixtures;
|
|
|
| - @Override
|
| - protected void setUp() {
|
| + @Before
|
| + public void setUp() {
|
| fixtures = new CameraVideoCapturerTestFixtures(new TestObjectFactory());
|
| }
|
|
|
| - @Override
|
| - protected void tearDown() {
|
| + @After
|
| + public void tearDown() {
|
| fixtures.dispose();
|
| }
|
|
|
| + @Test
|
| @SmallTest
|
| public void testCreateAndDispose() throws InterruptedException {
|
| fixtures.createCapturerAndDispose();
|
| }
|
|
|
| + @Test
|
| @SmallTest
|
| public void testCreateNonExistingCamera() throws InterruptedException {
|
| fixtures.createNonExistingCamera();
|
| @@ -73,6 +81,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
| // This test that the camera can be started and that the frames are forwarded
|
| // to a Java video renderer using a "default" capturer.
|
| // It tests both the Java and the C++ layer.
|
| + @Test
|
| @MediumTest
|
| public void testCreateCapturerAndRender() throws InterruptedException {
|
| fixtures.createCapturerAndRender();
|
| @@ -81,6 +90,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
| // This test that the camera can be started and that the frames are forwarded
|
| // to a Java video renderer using the front facing video capturer.
|
| // It tests both the Java and the C++ layer.
|
| + @Test
|
| @MediumTest
|
| public void testStartFrontFacingVideoCapturer() throws InterruptedException {
|
| fixtures.createFrontFacingCapturerAndRender();
|
| @@ -89,6 +99,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
| // This test that the camera can be started and that the frames are forwarded
|
| // to a Java video renderer using the back facing video capturer.
|
| // It tests both the Java and the C++ layer.
|
| + @Test
|
| @MediumTest
|
| public void testStartBackFacingVideoCapturer() throws InterruptedException {
|
| fixtures.createBackFacingCapturerAndRender();
|
| @@ -97,17 +108,20 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
| // This test that the default camera can be started and that the camera can
|
| // later be switched to another camera.
|
| // It tests both the Java and the C++ layer.
|
| + @Test
|
| @MediumTest
|
| public void testSwitchVideoCapturer() throws InterruptedException {
|
| fixtures.switchCamera();
|
| }
|
|
|
| + @Test
|
| @MediumTest
|
| public void testCameraEvents() throws InterruptedException {
|
| fixtures.cameraEventsInvoked();
|
| }
|
|
|
| // Test what happens when attempting to call e.g. switchCamera() after camera has been stopped.
|
| + @Test
|
| @MediumTest
|
| public void testCameraCallsAfterStop() throws InterruptedException {
|
| fixtures.cameraCallsAfterStop();
|
| @@ -115,6 +129,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
|
|
| // This test that the VideoSource that the CameraVideoCapturer is connected to can
|
| // be stopped and restarted. It tests both the Java and the C++ layer.
|
| + @Test
|
| @LargeTest
|
| public void testStopRestartVideoSource() throws InterruptedException {
|
| fixtures.stopRestartVideoSource();
|
| @@ -122,6 +137,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
|
|
| // This test that the camera can be started at different resolutions.
|
| // It does not test or use the C++ layer.
|
| + @Test
|
| @LargeTest
|
| public void testStartStopWithDifferentResolutions() throws InterruptedException {
|
| fixtures.startStopWithDifferentResolutions();
|
| @@ -129,6 +145,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
|
|
| // This test what happens if buffers are returned after the capturer have
|
| // been stopped and restarted. It does not test or use the C++ layer.
|
| + @Test
|
| @LargeTest
|
| public void testReturnBufferLate() throws InterruptedException {
|
| fixtures.returnBufferLate();
|
| @@ -137,6 +154,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
| // This test that we can capture frames, keep the frames in a local renderer, stop capturing,
|
| // and then return the frames. The difference between the test testReturnBufferLate() is that we
|
| // also test the JNI and C++ AndroidVideoCapturer parts.
|
| + @Test
|
| @MediumTest
|
| public void testReturnBufferLateEndToEnd() throws InterruptedException {
|
| fixtures.returnBufferLateEndToEnd();
|
| @@ -144,6 +162,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
|
|
| // This test that frames forwarded to a renderer is scaled if adaptOutputFormat is
|
| // called. This test both Java and C++ parts of of the stack.
|
| + @Test
|
| @MediumTest
|
| public void testScaleCameraOutput() throws InterruptedException {
|
| fixtures.scaleCameraOutput();
|
| @@ -151,6 +170,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
|
|
| // This test that an error is reported if the camera is already opened
|
| // when CameraVideoCapturer is started.
|
| + @Test
|
| @LargeTest
|
| public void testStartWhileCameraIsAlreadyOpen() throws InterruptedException {
|
| fixtures.startWhileCameraIsAlreadyOpen();
|
| @@ -158,6 +178,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
|
|
| // This test that CameraVideoCapturer can be started, even if the camera is already opened
|
| // if the camera is closed while CameraVideoCapturer is re-trying to start.
|
| + @Test
|
| @LargeTest
|
| public void testStartWhileCameraIsAlreadyOpenAndCloseCamera() throws InterruptedException {
|
| fixtures.startWhileCameraIsAlreadyOpenAndCloseCamera();
|
| @@ -165,6 +186,7 @@ public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
|
|
|
| // This test that CameraVideoCapturer.stop can be called while CameraVideoCapturer is
|
| // re-trying to start.
|
| + @Test
|
| @MediumTest
|
| public void testStartWhileCameraIsAlreadyOpenAndStop() throws InterruptedException {
|
| fixtures.startWhileCameraIsAlreadyOpenAndStop();
|
|
|