| 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 if (mProtocol == Protocol.QUIC) { | 192 if (mProtocol == Protocol.QUIC) { |
| 193 cronetEngineBuilder.enableQUIC(true); | 193 cronetEngineBuilder.enableQUIC(true); |
| 194 cronetEngineBuilder.addQuicHint(host, port, port); | 194 cronetEngineBuilder.addQuicHint(host, port, port); |
| 195 cronetEngineBuilder.setMockCertVerifierForTesting( | 195 cronetEngineBuilder.setMockCertVerifierForTesting( |
| 196 MockCertVerifier.createMockCertVerifier( | 196 MockCertVerifier.createMockCertVerifier( |
| 197 new String[] {getConfigString("QUIC_CERT_FILE")}
, true)); | 197 new String[] {getConfigString("QUIC_CERT_FILE")}
, true)); |
| 198 } | 198 } |
| 199 | 199 |
| 200 try { | 200 try { |
| 201 JSONObject quicParams = new JSONObject().put("host_whitelist", h
ost); | 201 JSONObject quicParams = new JSONObject().put("host_whitelist", h
ost); |
| 202 JSONObject experimentalOptions = new JSONObject().put("QUIC", qu
icParams); | 202 JSONObject hostResolverParams = |
| 203 CronetTestUtil.generateHostResolverRules(getConfigString
("HOST_IP")); |
| 204 JSONObject experimentalOptions = |
| 205 new JSONObject() |
| 206 .put("QUIC", quicParams) |
| 207 .put("HostResolverRules", hostResolverParams); |
| 203 cronetEngineBuilder.setExperimentalOptions(experimentalOptions.t
oString()); | 208 cronetEngineBuilder.setExperimentalOptions(experimentalOptions.t
oString()); |
| 204 } catch (JSONException e) { | 209 } catch (JSONException e) { |
| 205 throw new IllegalStateException("JSON failed: " + e); | 210 throw new IllegalStateException("JSON failed: " + e); |
| 206 } | 211 } |
| 207 mCronetEngine = cronetEngineBuilder.build(); | 212 mCronetEngine = cronetEngineBuilder.build(); |
| 208 CronetTestUtil.registerHostResolverProc(mCronetEngine, getConfigStri
ng("HOST_IP")); | |
| 209 mName = buildBenchmarkName(mode, direction, protocol, concurrency, m
Iterations); | 213 mName = buildBenchmarkName(mode, direction, protocol, concurrency, m
Iterations); |
| 210 mConcurrency = concurrency; | 214 mConcurrency = concurrency; |
| 211 mResults = results; | 215 mResults = results; |
| 212 mBufferSize = mLength > getConfigInt("MAX_BUFFER_SIZE") | 216 mBufferSize = mLength > getConfigInt("MAX_BUFFER_SIZE") |
| 213 ? getConfigInt("MAX_BUFFER_SIZE") | 217 ? getConfigInt("MAX_BUFFER_SIZE") |
| 214 : mLength; | 218 : mLength; |
| 215 mUseNetworkThread = getConfigBoolean("CRONET_ASYNC_USE_NETWORK_THREA
D"); | 219 mUseNetworkThread = getConfigBoolean("CRONET_ASYNC_USE_NETWORK_THREA
D"); |
| 216 } | 220 } |
| 217 | 221 |
| 218 private void startTimer() { | 222 private void startTimer() { |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 613 |
| 610 @Override | 614 @Override |
| 611 public void onCreate(Bundle savedInstanceState) { | 615 public void onCreate(Bundle savedInstanceState) { |
| 612 super.onCreate(savedInstanceState); | 616 super.onCreate(savedInstanceState); |
| 613 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, t
his); | 617 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, t
his); |
| 614 mConfig = getIntent().getData(); | 618 mConfig = getIntent().getData(); |
| 615 // Execute benchmarks on another thread to avoid networking on main thre
ad. | 619 // Execute benchmarks on another thread to avoid networking on main thre
ad. |
| 616 new BenchmarkTask().execute(); | 620 new BenchmarkTask().execute(); |
| 617 } | 621 } |
| 618 } | 622 } |
| OLD | NEW |