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 static org.junit.Assert.assertEquals; | 13 import static org.junit.Assert.assertEquals; |
14 import static org.junit.Assert.assertFalse; | 14 import static org.junit.Assert.assertFalse; |
15 import static org.junit.Assert.fail; | 15 import static org.junit.Assert.fail; |
16 | 16 |
| 17 import android.annotation.TargetApi; |
17 import android.content.Context; | 18 import android.content.Context; |
18 import android.hardware.camera2.CameraAccessException; | 19 import android.hardware.camera2.CameraAccessException; |
19 import android.hardware.camera2.CameraDevice; | 20 import android.hardware.camera2.CameraDevice; |
20 import android.hardware.camera2.CameraManager; | 21 import android.hardware.camera2.CameraManager; |
21 import android.os.Handler; | 22 import android.os.Handler; |
22 import android.os.Looper; | 23 import android.os.Looper; |
23 import android.support.test.InstrumentationRegistry; | 24 import android.support.test.InstrumentationRegistry; |
24 import android.support.test.filters.LargeTest; | 25 import android.support.test.filters.LargeTest; |
25 import android.support.test.filters.MediumTest; | 26 import android.support.test.filters.MediumTest; |
26 import android.support.test.filters.SmallTest; | 27 import android.support.test.filters.SmallTest; |
27 import java.util.concurrent.CountDownLatch; | 28 import java.util.concurrent.CountDownLatch; |
28 import org.chromium.base.test.BaseJUnit4ClassRunner; | 29 import org.chromium.base.test.BaseJUnit4ClassRunner; |
29 import org.junit.After; | 30 import org.junit.After; |
30 import org.junit.Before; | 31 import org.junit.Before; |
31 import org.junit.Test; | 32 import org.junit.Test; |
32 import org.junit.runner.RunWith; | 33 import org.junit.runner.RunWith; |
33 | 34 |
| 35 @TargetApi(21) |
34 @RunWith(BaseJUnit4ClassRunner.class) | 36 @RunWith(BaseJUnit4ClassRunner.class) |
35 public class Camera2CapturerTest { | 37 public class Camera2CapturerTest { |
36 static final String TAG = "Camera2CapturerTest"; | 38 static final String TAG = "Camera2CapturerTest"; |
37 | 39 |
38 /** | 40 /** |
39 * Simple camera2 implementation that only knows how to open the camera and cl
ose it. | 41 * Simple camera2 implementation that only knows how to open the camera and cl
ose it. |
40 */ | 42 */ |
41 private class SimpleCamera2 { | 43 private class SimpleCamera2 { |
42 final CameraManager cameraManager; | 44 final CameraManager cameraManager; |
43 final LooperThread looperThread; | 45 final LooperThread looperThread; |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 } | 317 } |
316 | 318 |
317 // This test that CameraVideoCapturer.stop can be called while CameraVideoCapt
urer is | 319 // This test that CameraVideoCapturer.stop can be called while CameraVideoCapt
urer is |
318 // re-trying to start. | 320 // re-trying to start. |
319 @Test | 321 @Test |
320 @MediumTest | 322 @MediumTest |
321 public void testStartWhileCameraIsAlreadyOpenAndStop() throws InterruptedExcep
tion { | 323 public void testStartWhileCameraIsAlreadyOpenAndStop() throws InterruptedExcep
tion { |
322 fixtures.startWhileCameraIsAlreadyOpenAndStop(); | 324 fixtures.startWhileCameraIsAlreadyOpenAndStop(); |
323 } | 325 } |
324 } | 326 } |
OLD | NEW |