Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java

Issue 2071803002: Move Camera1 specific methods to Camera1Enumerator and create CameraEnumerator interface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@size_master
Patch Set: Rebase. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java
diff --git a/webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java b/webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java
index 30119e5a1f87d60142fc759395e6263c778beaa2..43ee88d0d48d7e1b0b26396f8eddc5517f890c8d 100644
--- a/webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java
+++ b/webrtc/api/androidtests/src/org/webrtc/CameraVideoCapturerTestFixtures.java
@@ -240,19 +240,55 @@ class CameraVideoCapturerTestFixtures {
public FakeAsyncRenderer fakeAsyncRenderer;
}
- public interface TestObjectFactory {
- CameraVideoCapturer createCapturer(
- String name, CameraVideoCapturer.CameraEventsHandler eventsHandler);
- String getNameOfFrontFacingDevice();
- String getNameOfBackFacingDevice();
- boolean haveTwoCameras();
- boolean isCapturingToTexture();
- Context getAppContext();
+ public abstract static class TestObjectFactory {
+ final CameraEnumerator cameraEnumerator;
+
+ TestObjectFactory() {
+ cameraEnumerator = getCameraEnumerator();
+ }
+
+ public CameraVideoCapturer createCapturer(
+ String name,
+ CameraVideoCapturer.CameraEventsHandler eventsHandler) {
+ return cameraEnumerator.createCapturer(name, eventsHandler);
+ }
+
+ public String getNameOfFrontFacingDevice() {
+ for (String deviceName : cameraEnumerator.getDeviceNames()) {
+ if (cameraEnumerator.isFrontFacing(deviceName)) {
+ return deviceName;
+ }
+ }
+
+ return null;
+ }
+
+ public String getNameOfBackFacingDevice() {
+ for (String deviceName : cameraEnumerator.getDeviceNames()) {
+ if (cameraEnumerator.isBackFacing(deviceName)) {
+ return deviceName;
+ }
+ }
+
+ return null;
+ }
+
+ public boolean haveTwoCameras() {
+ return cameraEnumerator.getDeviceNames().length >= 2;
+ }
+
+ public boolean isCapturingToTexture() {
+ // In the future, we plan to only support capturing to texture, so default to true
+ return true;
+ }
+
+ abstract public CameraEnumerator getCameraEnumerator();
+ abstract public Context getAppContext();
// CameraVideoCapturer API is too slow for some of our tests where we need to open a competing
// camera. These methods are used instead.
- Object rawOpenCamera(String cameraName);
- void rawCloseCamera(Object camera);
+ abstract public Object rawOpenCamera(String cameraName);
+ abstract public void rawCloseCamera(Object camera);
}
private PeerConnectionFactory peerConnectionFactory;

Powered by Google App Engine
This is Rietveld 408576698