Xavier Lepaul a76ae851ad 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}
2022-03-23 10:01:04 +00:00

71 lines
2.4 KiB
Java

/*
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package org.webrtc;
import static com.google.common.truth.Truth.assertThat;
import androidx.test.filters.SmallTest;
import org.junit.Before;
import org.junit.Test;
import org.webrtc.PeerConnection;
import org.webrtc.RtcCertificatePem;
/** Tests for RtcCertificatePem.java. */
public class RtcCertificatePemTest {
@Before
public void setUp() {
System.loadLibrary(TestConstants.NATIVE_LIBRARY);
}
@Test
@SmallTest
public void testConstructor() {
RtcCertificatePem original = RtcCertificatePem.generateCertificate();
RtcCertificatePem recreated = new RtcCertificatePem(original.privateKey, original.certificate);
assertThat(original.privateKey).isEqualTo(recreated.privateKey);
assertThat(original.certificate).isEqualTo(recreated.certificate);
}
@Test
@SmallTest
public void testGenerateCertificateDefaults() {
RtcCertificatePem rtcCertificate = RtcCertificatePem.generateCertificate();
assertThat(rtcCertificate.privateKey).isNotEmpty();
assertThat(rtcCertificate.certificate).isNotEmpty();
}
@Test
@SmallTest
public void testGenerateCertificateCustomKeyTypeDefaultExpires() {
RtcCertificatePem rtcCertificate =
RtcCertificatePem.generateCertificate(PeerConnection.KeyType.RSA);
assertThat(rtcCertificate.privateKey).isNotEmpty();
assertThat(rtcCertificate.certificate).isNotEmpty();
}
@Test
@SmallTest
public void testGenerateCertificateCustomExpiresDefaultKeyType() {
RtcCertificatePem rtcCertificate = RtcCertificatePem.generateCertificate(60 * 60 * 24);
assertThat(rtcCertificate.privateKey).isNotEmpty();
assertThat(rtcCertificate.certificate).isNotEmpty();
}
@Test
@SmallTest
public void testGenerateCertificateCustomKeyTypeAndExpires() {
RtcCertificatePem rtcCertificate =
RtcCertificatePem.generateCertificate(PeerConnection.KeyType.RSA, 60 * 60 * 24);
assertThat(rtcCertificate.privateKey).isNotEmpty();
assertThat(rtcCertificate.certificate).isNotEmpty();
}
}