Revert "Cronet: add test server"

This reverts commit a0f25c4ed0.

Reason for revert: breaking in postsubmit. See b/262291156

Change-Id: I1ba3bcc5e25b384b18112371e4835ba25c40ad44
This commit is contained in:
Chidera Olibie
2022-12-12 23:34:54 +00:00
parent a0f25c4ed0
commit a0fdf1e70e
6 changed files with 9 additions and 90 deletions

View File

@@ -20,14 +20,10 @@ package {
java_library { java_library {
name: "CronetApiCommonTests", name: "CronetApiCommonTests",
srcs: [ srcs: ["src/**/*.java"],
"src/**/*.java",
"src/**/*.kt"
],
static_libs: [ static_libs: [
"androidx.test.rules", "androidx.test.rules",
"androidx.core_core", "androidx.core_core",
"ctstestserver",
"junit", "junit",
], ],
libs: [ libs: [
@@ -36,7 +32,6 @@ java_library {
"android.test.mock", "android.test.mock",
"androidx.annotation_annotation", "androidx.annotation_annotation",
"framework-cronet", "framework-cronet",
"org.apache.http.legacy",
], ],
} }

View File

@@ -18,18 +18,18 @@
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.chromium.net.test"> package="org.chromium.net.test">
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:networkSecurityConfig="@xml/network_security_config"> <application>
<uses-library android:name="android.test.runner"/> <uses-library android:name="android.test.runner" />
<uses-library android:name="framework-cronet"/> <uses-library android:name="framework-cronet" />
</application> </application>
<instrumentation <instrumentation
android:name="androidx.test.runner.AndroidJUnitRunner" android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="org.chromium.net.test" android:targetPackage="org.chromium.net.test"
android:label="Cronet API Networking Tests"/> android:label="Cronet API Networking Tests" />
</manifest> </manifest>

View File

@@ -1,24 +0,0 @@
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<html>
<head>
<title>hello world</title>
</head>
<body>
<h3>hello world</h3><br>
</body>
</html>

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
</domain-config>
</network-security-config>

View File

@@ -29,7 +29,6 @@ import androidx.test.runner.AndroidJUnit4;
import org.chromium.net.CronetEngine; import org.chromium.net.CronetEngine;
import org.chromium.net.UrlRequest; import org.chromium.net.UrlRequest;
import org.chromium.net.UrlResponseInfo; import org.chromium.net.UrlResponseInfo;
import org.chromium.net.test.util.CronetCtsTestServer;
import org.chromium.net.test.util.TestUrlRequestCallback; import org.chromium.net.test.util.TestUrlRequestCallback;
import org.chromium.net.test.util.TestUrlRequestCallback.ResponseStep; import org.chromium.net.test.util.TestUrlRequestCallback.ResponseStep;
import org.junit.Before; import org.junit.Before;
@@ -46,7 +45,6 @@ public class CronetUrlRequestTest {
private final String[] mTestDomains = {"www.google.com", "www.android.com"}; private final String[] mTestDomains = {"www.google.com", "www.android.com"};
@NonNull private CronetEngine mCronetEngine; @NonNull private CronetEngine mCronetEngine;
@NonNull private ConnectivityManager mCm; @NonNull private ConnectivityManager mCm;
@NonNull private CronetCtsTestServer mTestServer;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
@@ -58,7 +56,6 @@ public class CronetUrlRequestTest {
// .enableBrotli(true) // .enableBrotli(true)
.enableQuic(true); .enableQuic(true);
mCronetEngine = builder.build(); mCronetEngine = builder.build();
mTestServer = new CronetCtsTestServer(context);
} }
private static void assertGreaterThan(String msg, int first, int second) { private static void assertGreaterThan(String msg, int first, int second) {
@@ -77,7 +74,7 @@ public class CronetUrlRequestTest {
@Test @Test
public void testUrlRequestGet_CompletesSuccessfully() throws Exception { public void testUrlRequestGet_CompletesSuccessfully() throws Exception {
assertHasTestableNetworks(); assertHasTestableNetworks();
String url = mTestServer.getSuccessUrl(); String url = HTTPS_PREFIX + getRandomDomain();
TestUrlRequestCallback callback = new TestUrlRequestCallback(); TestUrlRequestCallback callback = new TestUrlRequestCallback();
UrlRequest.Builder builder = mCronetEngine.newUrlRequestBuilder(url, callback, UrlRequest.Builder builder = mCronetEngine.newUrlRequestBuilder(url, callback,
callback.getExecutor()); callback.getExecutor());

View File

@@ -1,26 +0,0 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chromium.net.test.util
import android.content.Context
import android.webkit.cts.CtsTestServer
/** Extends CtsTestServer to handle POST requests and other cronet specific test requests */
class CronetCtsTestServer(context: Context) : CtsTestServer(context) {
val successUrl: String = getAssetUrl("html/hello_world.html")
}