| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 package org.webrtc; | 11 package org.webrtc; |
| 12 | 12 |
| 13 import org.webrtc.CameraEnumerationAndroid.CaptureFormat; | 13 import org.webrtc.CameraEnumerationAndroid.CaptureFormat; |
| 14 | 14 |
| 15 import android.content.Context; | 15 import android.content.Context; |
| 16 import android.hardware.camera2.CameraAccessException; |
| 16 import android.hardware.camera2.CameraDevice; | 17 import android.hardware.camera2.CameraDevice; |
| 17 import android.hardware.camera2.CameraManager; | 18 import android.hardware.camera2.CameraManager; |
| 18 import android.hardware.camera2.CameraAccessException; | |
| 19 import android.os.Handler; | 19 import android.os.Handler; |
| 20 import android.os.Looper; | 20 import android.os.Looper; |
| 21 import android.test.InstrumentationTestCase; | 21 import android.test.InstrumentationTestCase; |
| 22 import android.test.suitebuilder.annotation.LargeTest; |
| 23 import android.test.suitebuilder.annotation.MediumTest; |
| 22 import android.test.suitebuilder.annotation.SmallTest; | 24 import android.test.suitebuilder.annotation.SmallTest; |
| 23 import android.test.suitebuilder.annotation.MediumTest; | |
| 24 import android.test.suitebuilder.annotation.LargeTest; | |
| 25 | 25 |
| 26 import java.util.concurrent.CountDownLatch; | 26 import java.util.concurrent.CountDownLatch; |
| 27 | 27 |
| 28 public class Camera2CapturerTest extends InstrumentationTestCase { | 28 public class Camera2CapturerTest extends InstrumentationTestCase { |
| 29 static final String TAG = "Camera2CapturerTest"; | 29 static final String TAG = "Camera2CapturerTest"; |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * Simple camera2 implementation that only knows how to open the camera and cl
ose it. | 32 * Simple camera2 implementation that only knows how to open the camera and cl
ose it. |
| 33 */ | 33 */ |
| 34 private class SimpleCamera2 { | 34 private class SimpleCamera2 { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // It does not test or use the C++ layer. | 246 // It does not test or use the C++ layer. |
| 247 @LargeTest | 247 @LargeTest |
| 248 public void testStartStopWithDifferentResolutions() throws InterruptedExceptio
n { | 248 public void testStartStopWithDifferentResolutions() throws InterruptedExceptio
n { |
| 249 fixtures.startStopWithDifferentResolutions(); | 249 fixtures.startStopWithDifferentResolutions(); |
| 250 } | 250 } |
| 251 | 251 |
| 252 // This test what happens if buffers are returned after the capturer have | 252 // This test what happens if buffers are returned after the capturer have |
| 253 // been stopped and restarted. It does not test or use the C++ layer. | 253 // been stopped and restarted. It does not test or use the C++ layer. |
| 254 @LargeTest | 254 @LargeTest |
| 255 public void testReturnBufferLate() throws InterruptedException { | 255 public void testReturnBufferLate() throws InterruptedException { |
| 256 fixtures.returnBufferLateEndToEnd(); | 256 fixtures.returnBufferLate(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 // This test that we can capture frames, keep the frames in a local renderer,
stop capturing, | 259 // This test that we can capture frames, keep the frames in a local renderer,
stop capturing, |
| 260 // and then return the frames. The difference between the test testReturnBuffe
rLate() is that we | 260 // and then return the frames. The difference between the test testReturnBuffe
rLate() is that we |
| 261 // also test the JNI and C++ AndroidVideoCapturer parts. | 261 // also test the JNI and C++ AndroidVideoCapturer parts. |
| 262 @MediumTest | 262 @MediumTest |
| 263 public void testReturnBufferLateEndToEnd() throws InterruptedException { | 263 public void testReturnBufferLateEndToEnd() throws InterruptedException { |
| 264 fixtures.returnBufferLateEndToEnd(); | 264 fixtures.returnBufferLateEndToEnd(); |
| 265 } | 265 } |
| 266 | 266 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 292 fixtures.startWhileCameraIsAlreadyOpenAndCloseCamera(); | 292 fixtures.startWhileCameraIsAlreadyOpenAndCloseCamera(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 // This test that CameraVideoCapturer.stop can be called while CameraVideoCapt
urer is | 295 // This test that CameraVideoCapturer.stop can be called while CameraVideoCapt
urer is |
| 296 // re-trying to start. | 296 // re-trying to start. |
| 297 @MediumTest | 297 @MediumTest |
| 298 public void testStartWhileCameraIsAlreadyOpenAndStop() throws InterruptedExcep
tion { | 298 public void testStartWhileCameraIsAlreadyOpenAndStop() throws InterruptedExcep
tion { |
| 299 fixtures.startWhileCameraIsAlreadyOpenAndStop(); | 299 fixtures.startWhileCameraIsAlreadyOpenAndStop(); |
| 300 } | 300 } |
| 301 } | 301 } |
| OLD | NEW |