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 android.content.Context; | 13 import android.content.Context; |
14 import android.test.InstrumentationTestCase; | 14 import android.test.InstrumentationTestCase; |
15 import android.test.suitebuilder.annotation.LargeTest; | 15 import android.test.suitebuilder.annotation.LargeTest; |
16 import android.test.suitebuilder.annotation.MediumTest; | 16 import android.test.suitebuilder.annotation.MediumTest; |
17 import android.test.suitebuilder.annotation.SmallTest; | 17 import android.test.suitebuilder.annotation.SmallTest; |
18 | 18 |
19 public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
{ | 19 public class Camera1CapturerUsingByteBufferTest extends InstrumentationTestCase
{ |
20 static final String TAG = "Camera1CapturerUsingByteBufferTest"; | 20 static final String TAG = "Camera1CapturerUsingByteBufferTest"; |
21 | 21 |
22 private class TestObjectFactory | 22 private class TestObjectFactory |
23 extends CameraVideoCapturerTestFixtures.TestObjectFactory { | 23 extends CameraVideoCapturerTestFixtures.TestObjectFactory { |
24 @Override | 24 @Override |
25 public CameraVideoCapturer createCapturer( | |
26 String name, | |
27 CameraVideoCapturer.CameraEventsHandler eventsHandler) { | |
28 return new VideoCapturerAndroid(name, eventsHandler, isCapturingToTexture(
)); | |
29 } | |
30 | |
31 @Override | |
32 public boolean isCapturingToTexture() { | 25 public boolean isCapturingToTexture() { |
33 return false; | 26 return false; |
34 } | 27 } |
35 | 28 |
36 @Override | 29 @Override |
37 public CameraEnumerator getCameraEnumerator() { | 30 public CameraEnumerator getCameraEnumerator() { |
38 return new Camera1Enumerator(); | 31 return new Camera1Enumerator(false); |
39 } | 32 } |
40 | 33 |
41 @Override | 34 @Override |
42 public Context getAppContext() { | 35 public Context getAppContext() { |
43 return getInstrumentation().getTargetContext(); | 36 return getInstrumentation().getTargetContext(); |
44 } | 37 } |
45 | 38 |
46 @SuppressWarnings("deprecation") | 39 @SuppressWarnings("deprecation") |
47 @Override | 40 @Override |
48 public Object rawOpenCamera(String cameraName) { | 41 public Object rawOpenCamera(String cameraName) { |
(...skipping 13 matching lines...) Expand all Loading... |
62 protected void setUp() { | 55 protected void setUp() { |
63 fixtures = new CameraVideoCapturerTestFixtures(new TestObjectFactory()); | 56 fixtures = new CameraVideoCapturerTestFixtures(new TestObjectFactory()); |
64 } | 57 } |
65 | 58 |
66 @Override | 59 @Override |
67 protected void tearDown() { | 60 protected void tearDown() { |
68 fixtures.dispose(); | 61 fixtures.dispose(); |
69 } | 62 } |
70 | 63 |
71 @SmallTest | 64 @SmallTest |
72 public void testCreateAndDispose() { | 65 public void testCreateAndDispose() throws InterruptedException { |
73 fixtures.createCapturerAndDispose(); | 66 fixtures.createCapturerAndDispose(); |
74 } | 67 } |
75 | 68 |
76 @SmallTest | 69 @SmallTest |
77 public void testCreateNonExistingCamera() { | 70 public void testCreateNonExistingCamera() throws InterruptedException { |
78 fixtures.createNonExistingCamera(); | 71 fixtures.createNonExistingCamera(); |
79 } | 72 } |
80 | 73 |
81 // This test that the camera can be started and that the frames are forwarded | 74 // This test that the camera can be started and that the frames are forwarded |
82 // to a Java video renderer using a "default" capturer. | 75 // to a Java video renderer using a "default" capturer. |
83 // It tests both the Java and the C++ layer. | 76 // It tests both the Java and the C++ layer. |
84 @MediumTest | 77 @MediumTest |
85 public void testCreateCapturerAndRender() throws InterruptedException { | 78 public void testCreateCapturerAndRender() throws InterruptedException { |
86 fixtures.createCapturerAndRender(); | 79 fixtures.createCapturerAndRender(); |
87 } | 80 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 fixtures.startWhileCameraIsAlreadyOpenAndCloseCamera(); | 164 fixtures.startWhileCameraIsAlreadyOpenAndCloseCamera(); |
172 } | 165 } |
173 | 166 |
174 // This test that CameraVideoCapturer.stop can be called while CameraVideoCapt
urer is | 167 // This test that CameraVideoCapturer.stop can be called while CameraVideoCapt
urer is |
175 // re-trying to start. | 168 // re-trying to start. |
176 @MediumTest | 169 @MediumTest |
177 public void testStartWhileCameraIsAlreadyOpenAndStop() throws InterruptedExcep
tion { | 170 public void testStartWhileCameraIsAlreadyOpenAndStop() throws InterruptedExcep
tion { |
178 fixtures.startWhileCameraIsAlreadyOpenAndStop(); | 171 fixtures.startWhileCameraIsAlreadyOpenAndStop(); |
179 } | 172 } |
180 } | 173 } |
OLD | NEW |