Skip to content
Snippets Groups Projects
Commit 4ce71881 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

Bug 42616: Remove VideoCaptureTest.kt.

This is a workaround to fix the GeckoView build with WebRTC disabled.
We should replace this workaround with a proper solution, that
excludes this test when MOZ_WEBRTC is undefined/False.
parent 67a9459b
No related branches found
No related tags found
No related merge requests found
Pipeline #186220 passed
package org.mozilla.geckoview.test
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.webrtc.CameraEnumerationAndroid.CaptureFormat
import org.webrtc.CameraEnumerator
import org.webrtc.CameraVideoCapturer
import org.webrtc.CameraVideoCapturer.CameraEventsHandler
import org.webrtc.videoengine.VideoCaptureAndroid
@RunWith(AndroidJUnit4::class)
@SmallTest
class VideoCaptureTest {
// Always throw exception.
class BadCameraEnumerator : CameraEnumerator {
override fun getDeviceNames(): Array<String?>? {
throw java.lang.RuntimeException("")
}
override fun isFrontFacing(deviceName: String?): Boolean {
throw java.lang.RuntimeException("")
}
override fun isBackFacing(deviceName: String?): Boolean {
throw java.lang.RuntimeException("")
}
override fun isInfrared(deviceName: String?): Boolean {
throw java.lang.RuntimeException("")
}
override fun getSupportedFormats(deviceName: String?): List<CaptureFormat?>? {
throw java.lang.RuntimeException("")
}
override fun createCapturer(
deviceName: String?,
eventsHandler: CameraEventsHandler?,
): CameraVideoCapturer? {
throw java.lang.RuntimeException("")
}
}
@Test
fun constructWithBadEnumerator() {
val ctr = VideoCaptureAndroid::class.java.getDeclaredConstructors()[0].apply { isAccessible = true }
val capture = ctr.newInstance(
InstrumentationRegistry.getInstrumentation().targetContext,
"my camera",
BadCameraEnumerator(),
) as VideoCaptureAndroid
assertEquals(false, capture.canCapture())
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment