Run instrumentation tests with the default runner

This migrates all tests that work by just changing their runner.

This excludes tests using `@RunWith(ParameterizedRunner.class)`, and a
few other non-parameterized tests that fail with the default runner.

Bug: webrtc:13662
Change-Id: Ia0b7c80e04a6a6b7a51348b3a7f587d10061b58e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256367
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Xavier Lepaul‎ <xalep@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36298}
This commit is contained in:
Xavier Lepaul
2022-03-23 09:13:45 +01:00
committed by WebRTC LUCI CQ
parent e7d7497e34
commit a76ae851ad
23 changed files with 0 additions and 74 deletions

View File

@ -15,10 +15,7 @@ import static com.google.common.truth.Truth.assertThat;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public final class BuiltinAudioCodecsFactoryFactoryTest { public final class BuiltinAudioCodecsFactoryFactoryTest {
@Before @Before
public void setUp() { public void setUp() {

View File

@ -15,13 +15,10 @@ import android.support.test.InstrumentationRegistry;
import androidx.test.filters.LargeTest; import androidx.test.filters.LargeTest;
import androidx.test.filters.MediumTest; import androidx.test.filters.MediumTest;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BaseJUnit4ClassRunner.class)
public class Camera1CapturerUsingByteBufferTest { public class Camera1CapturerUsingByteBufferTest {
static final String TAG = "Camera1CapturerUsingByteBufferTest"; static final String TAG = "Camera1CapturerUsingByteBufferTest";

View File

@ -15,13 +15,10 @@ import android.support.test.InstrumentationRegistry;
import androidx.test.filters.LargeTest; import androidx.test.filters.LargeTest;
import androidx.test.filters.MediumTest; import androidx.test.filters.MediumTest;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BaseJUnit4ClassRunner.class)
public class Camera1CapturerUsingTextureTest { public class Camera1CapturerUsingTextureTest {
static final String TAG = "Camera1CapturerUsingTextureTest"; static final String TAG = "Camera1CapturerUsingTextureTest";

View File

@ -24,13 +24,10 @@ import androidx.test.filters.LargeTest;
import androidx.test.filters.MediumTest; import androidx.test.filters.MediumTest;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BaseJUnit4ClassRunner.class)
public class Camera2CapturerTest { public class Camera2CapturerTest {
static final String TAG = "Camera2CapturerTest"; static final String TAG = "Camera2CapturerTest";

View File

@ -16,13 +16,10 @@ import androidx.annotation.Nullable;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
/** Unit tests for {@link DefaultVideoEncoderFactory}. */ /** Unit tests for {@link DefaultVideoEncoderFactory}. */
@RunWith(BaseJUnit4ClassRunner.class)
public class DefaultVideoEncoderFactoryTest { public class DefaultVideoEncoderFactoryTest {
static class CustomHardwareVideoEncoderFactory implements VideoEncoderFactory { static class CustomHardwareVideoEncoderFactory implements VideoEncoderFactory {
private ArrayList<VideoCodecInfo> codecs = new ArrayList<>(); private ArrayList<VideoCodecInfo> codecs = new ArrayList<>();

View File

@ -27,14 +27,11 @@ import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
// EmptyActivity is needed for the surface. // EmptyActivity is needed for the surface.
@RunWith(BaseJUnit4ClassRunner.class)
public class EglRendererTest { public class EglRendererTest {
private final static String TAG = "EglRendererTest"; private final static String TAG = "EglRendererTest";
private final static int RENDER_WAIT_MS = 1000; private final static int RENDER_WAIT_MS = 1000;

View File

@ -19,12 +19,9 @@ import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BaseJUnit4ClassRunner.class)
public class FileVideoCapturerTest { public class FileVideoCapturerTest {
public static class MockCapturerObserver implements CapturerObserver { public static class MockCapturerObserver implements CapturerObserver {
private final ArrayList<VideoFrame> frames = new ArrayList<VideoFrame>(); private final ArrayList<VideoFrame> frames = new ArrayList<VideoFrame>();

View File

@ -19,11 +19,8 @@ import androidx.test.filters.MediumTest;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Random; import java.util.Random;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BaseJUnit4ClassRunner.class)
public class GlRectDrawerTest { public class GlRectDrawerTest {
// Resolution of the test image. // Resolution of the test image.
private static final int WIDTH = 16; private static final int WIDTH = 16;

View File

@ -14,16 +14,13 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import java.util.ArrayList; import java.util.ArrayList;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.webrtc.Loggable; import org.webrtc.Loggable;
import org.webrtc.Logging.Severity; import org.webrtc.Logging.Severity;
import org.webrtc.PeerConnectionFactory; import org.webrtc.PeerConnectionFactory;
@RunWith(AndroidJUnit4.class)
public class LoggableTest { public class LoggableTest {
private static String TAG = "LoggableTest"; private static String TAG = "LoggableTest";
private static String NATIVE_FILENAME_TAG = "loggable_test.cc"; private static String NATIVE_FILENAME_TAG = "loggable_test.cc";

View File

@ -38,12 +38,9 @@ import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.UiThreadTest;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.webrtc.NetworkChangeDetector.ConnectionType; import org.webrtc.NetworkChangeDetector.ConnectionType;
import org.webrtc.NetworkChangeDetector.NetworkInformation; import org.webrtc.NetworkChangeDetector.NetworkInformation;
import org.webrtc.NetworkMonitorAutoDetect.ConnectivityManagerDelegate; import org.webrtc.NetworkMonitorAutoDetect.ConnectivityManagerDelegate;
@ -58,7 +55,6 @@ import org.webrtc.NetworkMonitorAutoDetect.SimpleNetworkCallback;
* class is used in practice in WebRTC. * class is used in practice in WebRTC.
*/ */
@SuppressLint("NewApi") @SuppressLint("NewApi")
@RunWith(BaseJUnit4ClassRunner.class)
public class NetworkMonitorTest { public class NetworkMonitorTest {
private static final long INVALID_NET_ID = -1; private static final long INVALID_NET_ID = -1;
private NetworkChangeDetector detector; private NetworkChangeDetector detector;
@ -226,7 +222,6 @@ public class NetworkMonitorTest {
* Tests that the receiver registers for connectivity intents during construction. * Tests that the receiver registers for connectivity intents during construction.
*/ */
@Test @Test
@UiThreadTest
@SmallTest @SmallTest
public void testNetworkMonitorRegistersInConstructor() throws InterruptedException { public void testNetworkMonitorRegistersInConstructor() throws InterruptedException {
Context context = InstrumentationRegistry.getTargetContext(); Context context = InstrumentationRegistry.getTargetContext();
@ -243,7 +238,6 @@ public class NetworkMonitorTest {
* notification to Java observers. * notification to Java observers.
*/ */
@Test @Test
@UiThreadTest
@MediumTest @MediumTest
public void testNetworkMonitorJavaObservers() throws InterruptedException { public void testNetworkMonitorJavaObservers() throws InterruptedException {
// Initialize the NetworkMonitor with a connection. // Initialize the NetworkMonitor with a connection.
@ -290,7 +284,6 @@ public class NetworkMonitorTest {
* that the functions don't crash. * that the functions don't crash.
*/ */
@Test @Test
@UiThreadTest
@SmallTest @SmallTest
public void testConnectivityManagerDelegateDoesNotCrash() { public void testConnectivityManagerDelegateDoesNotCrash() {
ConnectivityManagerDelegate delegate = new ConnectivityManagerDelegate( ConnectivityManagerDelegate delegate = new ConnectivityManagerDelegate(
@ -376,7 +369,6 @@ public class NetworkMonitorTest {
* least check that the functions don't crash. * least check that the functions don't crash.
*/ */
@Test @Test
@UiThreadTest
@SmallTest @SmallTest
public void testQueryableAPIsDoNotCrash() { public void testQueryableAPIsDoNotCrash() {
NetworkMonitorAutoDetect.Observer observer = new TestNetworkMonitorAutoDetectObserver(); NetworkMonitorAutoDetect.Observer observer = new TestNetworkMonitorAutoDetectObserver();

View File

@ -36,17 +36,14 @@ import java.util.Queue;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.webrtc.PeerConnection.IceConnectionState; import org.webrtc.PeerConnection.IceConnectionState;
import org.webrtc.PeerConnection.IceGatheringState; import org.webrtc.PeerConnection.IceGatheringState;
import org.webrtc.PeerConnection.PeerConnectionState; import org.webrtc.PeerConnection.PeerConnectionState;
import org.webrtc.PeerConnection.SignalingState; import org.webrtc.PeerConnection.SignalingState;
/** End-to-end tests for {@link PeerConnection}. */ /** End-to-end tests for {@link PeerConnection}. */
@RunWith(BaseJUnit4ClassRunner.class)
public class PeerConnectionEndToEndTest { public class PeerConnectionEndToEndTest {
private static final String TAG = "PeerConnectionEndToEndTest"; private static final String TAG = "PeerConnectionEndToEndTest";
private static final int DEFAULT_TIMEOUT_SECONDS = 20; private static final int DEFAULT_TIMEOUT_SECONDS = 20;

View File

@ -11,12 +11,9 @@
package org.webrtc; package org.webrtc;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class PeerConnectionFactoryTest { public class PeerConnectionFactoryTest {
@SmallTest @SmallTest
@Test @Test

View File

@ -22,14 +22,11 @@ import android.support.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.webrtc.PeerConnection.TlsCertPolicy; import org.webrtc.PeerConnection.TlsCertPolicy;
/** Unit tests for {@link PeerConnection}. */ /** Unit tests for {@link PeerConnection}. */
@RunWith(BaseJUnit4ClassRunner.class)
public class PeerConnectionTest { public class PeerConnectionTest {
@Before @Before
public void setUp() { public void setUp() {

View File

@ -20,11 +20,8 @@ import static org.webrtc.RendererCommon.getLayoutMatrix;
import android.graphics.Point; import android.graphics.Point;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BaseJUnit4ClassRunner.class)
public class RendererCommonTest { public class RendererCommonTest {
@Test @Test
@SmallTest @SmallTest

View File

@ -13,15 +13,12 @@ package org.webrtc;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.webrtc.PeerConnection; import org.webrtc.PeerConnection;
import org.webrtc.RtcCertificatePem; import org.webrtc.RtcCertificatePem;
/** Tests for RtcCertificatePem.java. */ /** Tests for RtcCertificatePem.java. */
@RunWith(BaseJUnit4ClassRunner.class)
public class RtcCertificatePemTest { public class RtcCertificatePemTest {
@Before @Before
public void setUp() { public void setUp() {

View File

@ -19,14 +19,11 @@ import static org.mockito.Mockito.mock;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import java.util.Arrays; import java.util.Arrays;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.webrtc.RtpParameters.DegradationPreference; import org.webrtc.RtpParameters.DegradationPreference;
/** Unit-tests for {@link RtpSender}. */ /** Unit-tests for {@link RtpSender}. */
@RunWith(BaseJUnit4ClassRunner.class)
public class RtpSenderTest { public class RtpSenderTest {
private PeerConnectionFactory factory; private PeerConnectionFactory factory;
private PeerConnection pc; private PeerConnection pc;

View File

@ -19,15 +19,12 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.webrtc.RtpParameters.Encoding; import org.webrtc.RtpParameters.Encoding;
import org.webrtc.RtpTransceiver.RtpTransceiverInit; import org.webrtc.RtpTransceiver.RtpTransceiverInit;
/** Unit-tests for {@link RtpTransceiver}. */ /** Unit-tests for {@link RtpTransceiver}. */
@RunWith(BaseJUnit4ClassRunner.class)
public class RtpTransceiverTest { public class RtpTransceiverTest {
private PeerConnectionFactory factory; private PeerConnectionFactory factory;
private PeerConnection pc; private PeerConnection pc;

View File

@ -21,12 +21,9 @@ import androidx.test.filters.MediumTest;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BaseJUnit4ClassRunner.class)
public class SurfaceTextureHelperTest { public class SurfaceTextureHelperTest {
/** /**
* Mock texture listener with blocking wait functionality. * Mock texture listener with blocking wait functionality.

View File

@ -11,12 +11,9 @@
package org.webrtc; package org.webrtc;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.chromium.base.test.params.BaseJUnit4RunnerDelegate;
import org.chromium.base.test.params.ParameterAnnotations.UseRunnerDelegate;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@UseRunnerDelegate(BaseJUnit4RunnerDelegate.class)
public class TimestampAlignerTest { public class TimestampAlignerTest {
@BeforeClass @BeforeClass
public static void setUp() { public static void setUp() {

View File

@ -19,12 +19,9 @@ import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BaseJUnit4ClassRunner.class)
public class VideoFileRendererTest { public class VideoFileRendererTest {
@Before @Before
public void setUp() { public void setUp() {

View File

@ -15,13 +15,10 @@ import static org.junit.Assert.fail;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
/** Unit tests for {@link VideoTrack}. */ /** Unit tests for {@link VideoTrack}. */
@RunWith(BaseJUnit4ClassRunner.class)
public class VideoTrackTest { public class VideoTrackTest {
private PeerConnectionFactory factory; private PeerConnectionFactory factory;
private VideoSource videoSource; private VideoSource videoSource;

View File

@ -11,16 +11,13 @@
package org.webrtc; package org.webrtc;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.webrtc.PeerConnectionFactory; import org.webrtc.PeerConnectionFactory;
// This test is intended to run on ARM and catch LoadLibrary errors when we load the WebRTC // This test is intended to run on ARM and catch LoadLibrary errors when we load the WebRTC
// JNI. It can't really be setting up calls since ARM emulators are too slow, but instantiating // JNI. It can't really be setting up calls since ARM emulators are too slow, but instantiating
// a peer connection isn't timing-sensitive, so we can at least do that. // a peer connection isn't timing-sensitive, so we can at least do that.
@RunWith(AndroidJUnit4.class)
public class WebRtcJniBootTest { public class WebRtcJniBootTest {
@Test @Test
@SmallTest @SmallTest

View File

@ -15,12 +15,9 @@ import static org.junit.Assert.assertTrue;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BaseJUnit4ClassRunner.class)
public class YuvHelperTest { public class YuvHelperTest {
private static final int TEST_WIDTH = 3; private static final int TEST_WIDTH = 3;
private static final int TEST_HEIGHT = 3; private static final int TEST_HEIGHT = 3;