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