| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.net; | 5 package org.chromium.net; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.net.Uri; | 9 import android.net.Uri; |
| 10 import android.os.AsyncTask; | 10 import android.os.AsyncTask; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 System.loadLibrary("cronet_tests"); | 192 System.loadLibrary("cronet_tests"); |
| 193 if (mProtocol == Protocol.QUIC) { | 193 if (mProtocol == Protocol.QUIC) { |
| 194 cronetEngineBuilder.enableQuic(true); | 194 cronetEngineBuilder.enableQuic(true); |
| 195 cronetEngineBuilder.addQuicHint(host, port, port); | 195 cronetEngineBuilder.addQuicHint(host, port, port); |
| 196 CronetTestUtil.setMockCertVerifierForTesting(cronetEngineBuilder
, | 196 CronetTestUtil.setMockCertVerifierForTesting(cronetEngineBuilder
, |
| 197 MockCertVerifier.createMockCertVerifier( | 197 MockCertVerifier.createMockCertVerifier( |
| 198 new String[] {getConfigString("QUIC_CERT_FILE")}
, true)); | 198 new String[] {getConfigString("QUIC_CERT_FILE")}
, true)); |
| 199 } | 199 } |
| 200 | 200 |
| 201 try { | 201 try { |
| 202 JSONObject quicParams = new JSONObject().put("host_whitelist", h
ost); | |
| 203 JSONObject hostResolverParams = | 202 JSONObject hostResolverParams = |
| 204 CronetTestUtil.generateHostResolverRules(getConfigString
("HOST_IP")); | 203 CronetTestUtil.generateHostResolverRules(getConfigString
("HOST_IP")); |
| 205 JSONObject experimentalOptions = | 204 JSONObject experimentalOptions = |
| 206 new JSONObject() | 205 new JSONObject() |
| 207 .put("QUIC", quicParams) | |
| 208 .put("HostResolverRules", hostResolverParams); | 206 .put("HostResolverRules", hostResolverParams); |
| 209 cronetEngineBuilder.setExperimentalOptions(experimentalOptions.t
oString()); | 207 cronetEngineBuilder.setExperimentalOptions(experimentalOptions.t
oString()); |
| 210 } catch (JSONException e) { | 208 } catch (JSONException e) { |
| 211 throw new IllegalStateException("JSON failed: " + e); | 209 throw new IllegalStateException("JSON failed: " + e); |
| 212 } | 210 } |
| 213 mCronetEngine = cronetEngineBuilder.build(); | 211 mCronetEngine = cronetEngineBuilder.build(); |
| 214 mName = buildBenchmarkName(mode, direction, protocol, concurrency, m
Iterations); | 212 mName = buildBenchmarkName(mode, direction, protocol, concurrency, m
Iterations); |
| 215 mConcurrency = concurrency; | 213 mConcurrency = concurrency; |
| 216 mResults = results; | 214 mResults = results; |
| 217 mBufferSize = mLength > getConfigInt("MAX_BUFFER_SIZE") | 215 mBufferSize = mLength > getConfigInt("MAX_BUFFER_SIZE") |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 public void onCreate(Bundle savedInstanceState) { | 617 public void onCreate(Bundle savedInstanceState) { |
| 620 super.onCreate(savedInstanceState); | 618 super.onCreate(savedInstanceState); |
| 621 // Initializing application context here due to lack of custom CronetPer
fTestApplication. | 619 // Initializing application context here due to lack of custom CronetPer
fTestApplication. |
| 622 ContextUtils.initApplicationContext(getApplicationContext()); | 620 ContextUtils.initApplicationContext(getApplicationContext()); |
| 623 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); | 621 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); |
| 624 mConfig = getIntent().getData(); | 622 mConfig = getIntent().getData(); |
| 625 // Execute benchmarks on another thread to avoid networking on main thre
ad. | 623 // Execute benchmarks on another thread to avoid networking on main thre
ad. |
| 626 new BenchmarkTask().execute(); | 624 new BenchmarkTask().execute(); |
| 627 } | 625 } |
| 628 } | 626 } |
| OLD | NEW |