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.test.suitebuilder.annotation.LargeTest; | 7 import android.test.suitebuilder.annotation.LargeTest; |
8 import android.test.suitebuilder.annotation.SmallTest; | 8 import android.test.suitebuilder.annotation.SmallTest; |
9 | 9 |
10 import org.chromium.base.Log; | 10 import org.chromium.base.Log; |
(...skipping 20 matching lines...) Expand all Loading... |
31 super.setUp(); | 31 super.setUp(); |
32 // Load library first, since we need the Quic test server's URL. | 32 // Load library first, since we need the Quic test server's URL. |
33 System.loadLibrary("cronet_tests"); | 33 System.loadLibrary("cronet_tests"); |
34 QuicTestServer.startQuicTestServer(getContext()); | 34 QuicTestServer.startQuicTestServer(getContext()); |
35 | 35 |
36 CronetEngine.Builder builder = new CronetEngine.Builder(getContext()); | 36 CronetEngine.Builder builder = new CronetEngine.Builder(getContext()); |
37 builder.enableQUIC(true); | 37 builder.enableQUIC(true); |
38 builder.addQuicHint(QuicTestServer.getServerHost(), QuicTestServer.getSe
rverPort(), | 38 builder.addQuicHint(QuicTestServer.getServerHost(), QuicTestServer.getSe
rverPort(), |
39 QuicTestServer.getServerPort()); | 39 QuicTestServer.getServerPort()); |
40 | 40 |
41 JSONObject quicParams = new JSONObject() | 41 JSONObject quicParams = |
42 .put("connection_options", "PACE,IW10,FO
O,DEADBEEF") | 42 new JSONObject().put("connection_options", "PACE,IW10,FOO,DEADBE
EF"); |
43 .put("store_server_configs_in_properties
", true) | |
44 .put("delay_tcp_race", true) | |
45 .put("max_number_of_lossy_connections",
10) | |
46 .put("packet_loss_threshold", 0.5); | |
47 JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams
); | 43 JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams
); |
48 builder.setExperimentalOptions(experimentalOptions.toString()); | 44 builder.setExperimentalOptions(experimentalOptions.toString()); |
49 | 45 |
50 builder.setMockCertVerifierForTesting(MockCertVerifier.createMockCertVer
ifier(CERTS_USED)); | 46 builder.setMockCertVerifierForTesting(MockCertVerifier.createMockCertVer
ifier(CERTS_USED)); |
51 builder.setStoragePath(CronetTestFramework.getTestStorage(getContext()))
; | 47 builder.setStoragePath(CronetTestFramework.getTestStorage(getContext()))
; |
52 builder.enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK_NO_HTTP, 10
00 * 1024); | 48 builder.enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK_NO_HTTP, 10
00 * 1024); |
53 | 49 |
54 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n
ull, builder); | 50 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n
ull, builder); |
55 } | 51 } |
56 | 52 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") | 155 @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") |
160 private boolean fileContainsString(String filename, String content) throws I
OException { | 156 private boolean fileContainsString(String filename, String content) throws I
OException { |
161 File file = new File(CronetTestFramework.getTestStorage(getContext()) +
"/" + filename); | 157 File file = new File(CronetTestFramework.getTestStorage(getContext()) +
"/" + filename); |
162 FileInputStream fileInputStream = new FileInputStream(file); | 158 FileInputStream fileInputStream = new FileInputStream(file); |
163 byte[] data = new byte[(int) file.length()]; | 159 byte[] data = new byte[(int) file.length()]; |
164 fileInputStream.read(data); | 160 fileInputStream.read(data); |
165 fileInputStream.close(); | 161 fileInputStream.close(); |
166 return new String(data, "UTF-8").contains(content); | 162 return new String(data, "UTF-8").contains(content); |
167 } | 163 } |
168 } | 164 } |
OLD | NEW |