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.annotation.TargetApi; |
18 import android.content.Context; | 18 import android.content.Context; |
19 import android.hardware.camera2.CameraAccessException; | 19 import android.hardware.camera2.CameraAccessException; |
20 import android.hardware.camera2.CameraDevice; | 20 import android.hardware.camera2.CameraDevice; |
21 import android.hardware.camera2.CameraManager; | 21 import android.hardware.camera2.CameraManager; |
22 import android.os.Handler; | 22 import android.os.Handler; |
23 import android.os.Looper; | 23 import android.os.Looper; |
24 import android.support.test.InstrumentationRegistry; | 24 import android.support.test.InstrumentationRegistry; |
25 import android.support.test.filters.LargeTest; | 25 import android.support.test.filters.LargeTest; |
26 import android.support.test.filters.MediumTest; | 26 import android.support.test.filters.MediumTest; |
27 import android.support.test.filters.SmallTest; | 27 import android.support.test.filters.SmallTest; |
| 28 import java.io.IOException; |
28 import java.util.concurrent.CountDownLatch; | 29 import java.util.concurrent.CountDownLatch; |
29 import org.chromium.base.test.BaseJUnit4ClassRunner; | 30 import org.chromium.base.test.BaseJUnit4ClassRunner; |
30 import org.junit.After; | 31 import org.junit.After; |
31 import org.junit.Before; | 32 import org.junit.Before; |
32 import org.junit.Test; | 33 import org.junit.Test; |
33 import org.junit.runner.RunWith; | 34 import org.junit.runner.RunWith; |
34 | 35 |
35 @TargetApi(21) | 36 @TargetApi(21) |
36 @RunWith(BaseJUnit4ClassRunner.class) | 37 @RunWith(BaseJUnit4ClassRunner.class) |
37 public class Camera2CapturerTest { | 38 public class Camera2CapturerTest { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 public void testSwitchVideoCapturer() throws InterruptedException { | 238 public void testSwitchVideoCapturer() throws InterruptedException { |
238 fixtures.switchCamera(); | 239 fixtures.switchCamera(); |
239 } | 240 } |
240 | 241 |
241 @Test | 242 @Test |
242 @MediumTest | 243 @MediumTest |
243 public void testCameraEvents() throws InterruptedException { | 244 public void testCameraEvents() throws InterruptedException { |
244 fixtures.cameraEventsInvoked(); | 245 fixtures.cameraEventsInvoked(); |
245 } | 246 } |
246 | 247 |
| 248 @Test |
| 249 @MediumTest |
| 250 public void testUpdateMediaRecorder() throws InterruptedException, IOException
{ |
| 251 fixtures.updateMediaRecorder(true /* useSurfaceCapture */); |
| 252 } |
| 253 |
247 // Test what happens when attempting to call e.g. switchCamera() after camera
has been stopped. | 254 // Test what happens when attempting to call e.g. switchCamera() after camera
has been stopped. |
248 @Test | 255 @Test |
249 @MediumTest | 256 @MediumTest |
250 public void testCameraCallsAfterStop() throws InterruptedException { | 257 public void testCameraCallsAfterStop() throws InterruptedException { |
251 fixtures.cameraCallsAfterStop(); | 258 fixtures.cameraCallsAfterStop(); |
252 } | 259 } |
253 | 260 |
254 // This test that the VideoSource that the CameraVideoCapturer is connected to
can | 261 // This test that the VideoSource that the CameraVideoCapturer is connected to
can |
255 // be stopped and restarted. It tests both the Java and the C++ layer. | 262 // be stopped and restarted. It tests both the Java and the C++ layer. |
256 @Test | 263 @Test |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 324 } |
318 | 325 |
319 // This test that CameraVideoCapturer.stop can be called while CameraVideoCapt
urer is | 326 // This test that CameraVideoCapturer.stop can be called while CameraVideoCapt
urer is |
320 // re-trying to start. | 327 // re-trying to start. |
321 @Test | 328 @Test |
322 @MediumTest | 329 @MediumTest |
323 public void testStartWhileCameraIsAlreadyOpenAndStop() throws InterruptedExcep
tion { | 330 public void testStartWhileCameraIsAlreadyOpenAndStop() throws InterruptedExcep
tion { |
324 fixtures.startWhileCameraIsAlreadyOpenAndStop(); | 331 fixtures.startWhileCameraIsAlreadyOpenAndStop(); |
325 } | 332 } |
326 } | 333 } |
OLD | NEW |