Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Unified Diff: components/cronet/android/test/javaperftests/src/org/chromium/net/CronetPerfTestActivity.java

Issue 1650773003: Revert of [Cronet] Get Cronet performance test running again (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/test/javaperftests/src/org/chromium/net/CronetPerfTestActivity.java
diff --git a/components/cronet/android/test/javaperftests/src/org/chromium/net/CronetPerfTestActivity.java b/components/cronet/android/test/javaperftests/src/org/chromium/net/CronetPerfTestActivity.java
index 8000aeb71ca889abac0a2433ffbda5d2c8a93287..775974e3f6c560202c38d5f671539af13773d71d 100644
--- a/components/cronet/android/test/javaperftests/src/org/chromium/net/CronetPerfTestActivity.java
+++ b/components/cronet/android/test/javaperftests/src/org/chromium/net/CronetPerfTestActivity.java
@@ -10,8 +10,6 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Debug;
-
-import org.chromium.base.PathUtils;
import org.json.JSONException;
import org.json.JSONObject;
@@ -40,7 +38,6 @@
* Runs networking benchmarks and saves results to a file.
*/
public class CronetPerfTestActivity extends Activity {
- private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "cronet_perf_test";
// Benchmark configuration passed down from host via Intent data.
// Call getConfig*(key) to extract individual configuration values.
private Uri mConfig;
@@ -163,49 +160,31 @@
default:
throw new IllegalArgumentException("Unknown size: " + size);
}
- final String scheme;
- final String host;
final int port;
switch (protocol) {
case HTTP:
- scheme = "http";
- host = getConfigString("HOST_IP");
port = getConfigInt("HTTP_PORT");
break;
case QUIC:
- scheme = "https";
- host = getConfigString("HOST");
port = getConfigInt("QUIC_PORT");
break;
default:
throw new IllegalArgumentException("Unknown protocol: " + protocol);
}
try {
- mUrl = new URL(scheme, host, port, resource);
+ mUrl = new URL("http", getConfigString("HOST"), port, resource);
} catch (MalformedURLException e) {
- throw new IllegalArgumentException(
- "Bad URL: " + host + ":" + port + "/" + resource);
+ throw new IllegalArgumentException("Bad URL: " + getConfigString("HOST") + ":"
+ + port + "/" + resource);
}
final CronetEngine.Builder cronetEngineBuilder =
new CronetEngine.Builder(CronetPerfTestActivity.this);
- cronetEngineBuilder.setLibraryName("cronet_tests");
if (mProtocol == Protocol.QUIC) {
cronetEngineBuilder.enableQUIC(true);
- cronetEngineBuilder.addQuicHint(host, port, port);
- cronetEngineBuilder.setMockCertVerifierForTesting(
- MockCertVerifier.createMockCertVerifier(
- new String[] {getConfigString("QUIC_CERT_FILE")}));
- }
-
- try {
- JSONObject quicParams = new JSONObject().put("host_whitelist", host);
- JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams);
- cronetEngineBuilder.setExperimentalOptions(experimentalOptions.toString());
- } catch (JSONException e) {
- throw new IllegalStateException("JSON failed: " + e);
+ cronetEngineBuilder.addQuicHint(getConfigString("HOST"), getConfigInt("QUIC_PORT"),
+ getConfigInt("QUIC_PORT"));
}
mCronetEngine = cronetEngineBuilder.build();
- CronetTestUtil.registerHostResolverProc(mCronetEngine, getConfigString("HOST_IP"));
mName = buildBenchmarkName(mode, direction, protocol, concurrency, mIterations);
mConcurrency = concurrency;
mResults = results;
@@ -404,7 +383,6 @@
private class Callback extends UrlRequest.Callback {
private final ByteBuffer mBuffer;
private final Runnable mCompletionCallback;
- private int mBytesReceived;
Callback(ByteBuffer buffer, Runnable completionCallback) {
mBuffer = buffer;
@@ -426,18 +404,12 @@
@Override
public void onReadCompleted(
UrlRequest request, UrlResponseInfo info, ByteBuffer byteBuffer) {
- mBytesReceived += byteBuffer.position();
mBuffer.clear();
request.readNew(mBuffer);
}
@Override
public void onSucceeded(UrlRequest request, UrlResponseInfo info) {
- if (info.getHttpStatusCode() != 200 || mBytesReceived != mLength) {
- System.out.println("Failed: response code: " + info.getHttpStatusCode()
- + " bytes: " + mBytesReceived);
- mFailed = true;
- }
mCompletionCallback.run();
}
@@ -610,7 +582,6 @@
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, this);
mConfig = getIntent().getData();
// Execute benchmarks on another thread to avoid networking on main thread.
new BenchmarkTask().execute();

Powered by Google App Engine
This is Rietveld 408576698