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

Unified Diff: talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java

Issue 1350663002: VideoCapturerAndroid: Add test for making calls on stopped camera (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase and also test onOutputFormatRequest() and changeCaptureFormat() Created 5 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java
diff --git a/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java b/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java
index 3702feaf3cef8ef6b4faa551f6272d7e0dad2f6e..0fe827d1f9c658151dd05cb10edf0106e218700d 100644
--- a/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java
+++ b/talk/app/webrtc/androidtests/src/org/webrtc/VideoCapturerAndroidTest.java
@@ -292,6 +292,32 @@ public class VideoCapturerAndroidTest extends ActivityTestCase {
assertTrue(capturer.isReleased());
}
+ @MediumTest
+ // Test what happens when attempting to call e.g. switchCamera() after camera has been stopped.
+ public void testCameraCallsAfterStop() throws InterruptedException {
+ final String deviceName = CameraEnumerationAndroid.getDeviceName(0);
+ final VideoCapturerAndroid capturer = VideoCapturerAndroid.create(deviceName, null);
+ final List<CaptureFormat> formats = CameraEnumerationAndroid.getSupportedFormats(0);
+ final CameraEnumerationAndroid.CaptureFormat format = formats.get(0);
+
+ final FakeCapturerObserver observer = new FakeCapturerObserver();
+ capturer.startCapture(format.width, format.height, format.maxFramerate,
+ getInstrumentation().getContext(), observer);
+ // Make sure camera is started and then stop it.
+ assertTrue(observer.WaitForCapturerToStart());
+ capturer.stopCapture();
+ for (long timeStamp : observer.getCopyAndResetListOftimeStamps()) {
+ capturer.returnBuffer(timeStamp);
+ }
+ // We can't change |capturer| at this point, but we should not crash.
+ capturer.switchCamera(null);
+ capturer.onOutputFormatRequest(640, 480, 15);
+ capturer.changeCaptureFormat(640, 480, 15);
+
+ capturer.dispose();
+ assertTrue(capturer.isReleased());
+ }
+
@SmallTest
// This test that the VideoSource that the VideoCapturer is connected to can
// be stopped and restarted. It tests both the Java and the C++ layer.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698