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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 throw new IllegalArgumentException("Unknown protocol: " + pr
otocol); | 182 throw new IllegalArgumentException("Unknown protocol: " + pr
otocol); |
183 } | 183 } |
184 try { | 184 try { |
185 mUrl = new URL(scheme, host, port, resource); | 185 mUrl = new URL(scheme, host, port, resource); |
186 } catch (MalformedURLException e) { | 186 } catch (MalformedURLException e) { |
187 throw new IllegalArgumentException( | 187 throw new IllegalArgumentException( |
188 "Bad URL: " + host + ":" + port + "/" + resource); | 188 "Bad URL: " + host + ":" + port + "/" + resource); |
189 } | 189 } |
190 final CronetEngine.Builder cronetEngineBuilder = | 190 final CronetEngine.Builder cronetEngineBuilder = |
191 new CronetEngine.Builder(CronetPerfTestActivity.this); | 191 new CronetEngine.Builder(CronetPerfTestActivity.this); |
192 cronetEngineBuilder.setLibraryName("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 cronetEngineBuilder.setMockCertVerifierForTesting( | 196 cronetEngineBuilder.setMockCertVerifierForTesting( |
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); | 202 JSONObject quicParams = new JSONObject().put("host_whitelist", h
ost); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 public void onCreate(Bundle savedInstanceState) { | 620 public void onCreate(Bundle savedInstanceState) { |
621 super.onCreate(savedInstanceState); | 621 super.onCreate(savedInstanceState); |
622 // Initializing application context here due to lack of custom CronetPer
fTestApplication. | 622 // Initializing application context here due to lack of custom CronetPer
fTestApplication. |
623 ContextUtils.initApplicationContext(getApplicationContext()); | 623 ContextUtils.initApplicationContext(getApplicationContext()); |
624 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); | 624 PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); |
625 mConfig = getIntent().getData(); | 625 mConfig = getIntent().getData(); |
626 // Execute benchmarks on another thread to avoid networking on main thre
ad. | 626 // Execute benchmarks on another thread to avoid networking on main thre
ad. |
627 new BenchmarkTask().execute(); | 627 new BenchmarkTask().execute(); |
628 } | 628 } |
629 } | 629 } |
OLD | NEW |