cronet tests: Do not run integration tests on R

CtsNetHttpTestCases were missing a DevSdkIgnoreRule after updating the
min_sdk version to R+ (which made it installable on R where the cronet
classes are not in the bootclasspath.)

Test: atest CtsNetHttpTestCases
Bug: 259632936
(cherry picked from https://android-review.googlesource.com/q/commit:92c4636c5cda994f0ad9508e3cd5e26ea727079f)
Merged-In: I706ff92376227c1759fd6e542066fcff3a7cf052
Change-Id: I706ff92376227c1759fd6e542066fcff3a7cf052
This commit is contained in:
Patrick Rohr 2023-06-05 15:27:26 -07:00 committed by Cherrypicker Worker
parent 042c8a7b1f
commit 04d72a0cde
11 changed files with 53 additions and 20 deletions

View File

@ -37,6 +37,7 @@ android_library {
"junit",
"kotlin-test",
"mockito-target",
"net-tests-utils",
"truth",
],
libs: [

View File

@ -23,8 +23,10 @@ import android.net.http.cts.util.TestBidirectionalStreamCallback
import android.net.http.cts.util.TestBidirectionalStreamCallback.ResponseStep
import android.net.http.cts.util.assumeOKStatusCode
import android.net.http.cts.util.skipIfNoInternetConnection
import android.os.Build
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.testutils.DevSdkIgnoreRule
import com.android.testutils.DevSdkIgnoreRunner
import kotlin.test.Test
import kotlin.test.assertEquals
import org.hamcrest.MatcherAssert
@ -39,7 +41,8 @@ private const val URL = "https://source.android.com"
* This tests uses a non-hermetic server. Instead of asserting, assume the next callback. This way,
* if the request were to fail, the test would just be skipped instead of failing.
*/
@RunWith(AndroidJUnit4::class)
@RunWith(DevSdkIgnoreRunner::class)
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
class BidirectionalStreamTest {
private val context: Context = ApplicationProvider.getApplicationContext()
private val callback = TestBidirectionalStreamCallback()

View File

@ -23,8 +23,10 @@ import android.net.http.cts.util.HttpCtsTestServer
import android.net.http.cts.util.TestUrlRequestCallback
import android.net.http.cts.util.TestUrlRequestCallback.FailureType
import android.net.http.cts.util.TestUrlRequestCallback.ResponseStep
import android.os.Build
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.testutils.DevSdkIgnoreRule
import com.android.testutils.DevSdkIgnoreRunner
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertIs
@ -32,7 +34,8 @@ import kotlin.test.assertSame
import kotlin.test.assertTrue
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@RunWith(DevSdkIgnoreRunner::class)
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
class CallbackExceptionTest {
@Test

View File

@ -19,12 +19,15 @@ package android.net.http.cts
import android.net.http.ConnectionMigrationOptions
import android.net.http.ConnectionMigrationOptions.MIGRATION_OPTION_ENABLED
import android.net.http.ConnectionMigrationOptions.MIGRATION_OPTION_UNSPECIFIED
import androidx.test.ext.junit.runners.AndroidJUnit4
import android.os.Build
import com.android.testutils.DevSdkIgnoreRule
import com.android.testutils.DevSdkIgnoreRunner
import kotlin.test.Test
import kotlin.test.assertEquals
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@RunWith(DevSdkIgnoreRunner::class)
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
class ConnectionMigrationOptionsTest {
@Test

View File

@ -19,7 +19,9 @@ package android.net.http.cts
import android.net.http.DnsOptions
import android.net.http.DnsOptions.DNS_OPTION_ENABLED
import android.net.http.DnsOptions.DNS_OPTION_UNSPECIFIED
import androidx.test.ext.junit.runners.AndroidJUnit4
import android.os.Build
import com.android.testutils.DevSdkIgnoreRule
import com.android.testutils.DevSdkIgnoreRunner
import java.time.Duration
import kotlin.test.Test
import kotlin.test.assertEquals
@ -27,7 +29,8 @@ import kotlin.test.assertNotNull
import kotlin.test.assertNull
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@RunWith(DevSdkIgnoreRunner::class)
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
class DnsOptionsTest {
@Test

View File

@ -40,9 +40,12 @@ import android.net.http.UrlResponseInfo;
import android.net.http.cts.util.HttpCtsTestServer;
import android.net.http.cts.util.TestUrlRequestCallback;
import android.net.http.cts.util.TestUrlRequestCallback.ResponseStep;
import android.os.Build;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.testutils.DevSdkIgnoreRule;
import com.android.testutils.DevSdkIgnoreRunner;
import org.junit.After;
import org.junit.Before;
@ -55,7 +58,8 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Set;
@RunWith(AndroidJUnit4.class)
@RunWith(DevSdkIgnoreRunner.class)
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
public class HttpEngineTest {
private static final String HOST = "source.android.com";
private static final String URL = "https://" + HOST;

View File

@ -19,8 +19,10 @@ package android.net.http.cts
import android.net.http.HttpEngine
import android.net.http.NetworkException
import android.net.http.cts.util.TestUrlRequestCallback
import android.os.Build
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.testutils.DevSdkIgnoreRule
import com.android.testutils.DevSdkIgnoreRunner
import kotlin.test.assertEquals
import kotlin.test.assertIs
import kotlin.test.assertSame
@ -28,7 +30,8 @@ import kotlin.test.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@RunWith(DevSdkIgnoreRunner::class)
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
class NetworkExceptionTest {
@Test

View File

@ -17,12 +17,15 @@
package android.net.http.cts
import android.net.http.QuicException
import androidx.test.ext.junit.runners.AndroidJUnit4
import android.os.Build
import com.android.testutils.DevSdkIgnoreRule
import com.android.testutils.DevSdkIgnoreRunner
import kotlin.test.Test
import kotlin.test.assertEquals
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@RunWith(DevSdkIgnoreRunner::class)
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
class QuicExceptionTest {
@Test

View File

@ -16,7 +16,9 @@
package android.net.http.cts
import android.net.http.QuicOptions
import androidx.test.ext.junit.runners.AndroidJUnit4
import android.os.Build
import com.android.testutils.DevSdkIgnoreRule
import com.android.testutils.DevSdkIgnoreRunner
import com.google.common.truth.Truth.assertThat
import java.time.Duration
import kotlin.test.assertFailsWith
@ -25,7 +27,8 @@ import kotlin.test.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@RunWith(DevSdkIgnoreRunner::class)
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
class QuicOptionsTest {
@Test
fun testQuicOptions_defaultValues() {

View File

@ -42,12 +42,15 @@ import android.net.http.cts.util.TestStatusListener;
import android.net.http.cts.util.TestUrlRequestCallback;
import android.net.http.cts.util.TestUrlRequestCallback.ResponseStep;
import android.net.http.cts.util.UploadDataProviders;
import android.os.Build;
import android.webkit.cts.CtsTestServer;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.testutils.DevSdkIgnoreRule;
import com.android.testutils.DevSdkIgnoreRunner;
import com.google.common.base.Strings;
@ -70,7 +73,8 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@RunWith(AndroidJUnit4.class)
@RunWith(DevSdkIgnoreRunner.class)
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
public class UrlRequestTest {
private static final Executor DIRECT_EXECUTOR = Runnable::run;

View File

@ -21,15 +21,18 @@ import android.net.http.HttpEngine
import android.net.http.cts.util.HttpCtsTestServer
import android.net.http.cts.util.TestUrlRequestCallback
import android.net.http.cts.util.TestUrlRequestCallback.ResponseStep
import android.os.Build
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.android.testutils.DevSdkIgnoreRule
import com.android.testutils.DevSdkIgnoreRunner
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@RunWith(DevSdkIgnoreRunner::class)
@DevSdkIgnoreRule.IgnoreUpTo(Build.VERSION_CODES.R)
class UrlResponseInfoTest {
@Test