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 25 matching lines...) Expand all Loading... |
36 QuicTestServer.startQuicTestServer(getContext()); | 36 QuicTestServer.startQuicTestServer(getContext()); |
37 | 37 |
38 mBuilder = new CronetEngine.Builder(getContext()); | 38 mBuilder = new CronetEngine.Builder(getContext()); |
39 mBuilder.enableQUIC(true); | 39 mBuilder.enableQUIC(true); |
40 mBuilder.addQuicHint(QuicTestServer.getServerHost(), QuicTestServer.getS
erverPort(), | 40 mBuilder.addQuicHint(QuicTestServer.getServerHost(), QuicTestServer.getS
erverPort(), |
41 QuicTestServer.getServerPort()); | 41 QuicTestServer.getServerPort()); |
42 | 42 |
43 JSONObject quicParams = new JSONObject() | 43 JSONObject quicParams = new JSONObject() |
44 .put("connection_options", "PACE,IW10,FO
O,DEADBEEF") | 44 .put("connection_options", "PACE,IW10,FO
O,DEADBEEF") |
45 .put("host_whitelist", "test.example.com
") | 45 .put("host_whitelist", "test.example.com
") |
46 .put("store_server_configs_in_properties
", true) | 46 .put("max_server_configs_stored_in_prope
rties", 2) |
47 .put("delay_tcp_race", true) | 47 .put("delay_tcp_race", true) |
48 .put("max_number_of_lossy_connections",
10) | 48 .put("max_number_of_lossy_connections",
10) |
49 .put("packet_loss_threshold", 0.5) | 49 .put("packet_loss_threshold", 0.5) |
50 .put("idle_connection_timeout_seconds",
300); | 50 .put("idle_connection_timeout_seconds",
300); |
51 JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams
); | 51 JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams
); |
52 mBuilder.setExperimentalOptions(experimentalOptions.toString()); | 52 mBuilder.setExperimentalOptions(experimentalOptions.toString()); |
53 | 53 |
54 mBuilder.setMockCertVerifierForTesting(MockCertVerifier.createMockCertVe
rifier(CERTS_USED)); | 54 mBuilder.setMockCertVerifierForTesting(MockCertVerifier.createMockCertVe
rifier(CERTS_USED)); |
55 mBuilder.setStoragePath(CronetTestFramework.getTestStorage(getContext())
); | 55 mBuilder.setStoragePath(CronetTestFramework.getTestStorage(getContext())
); |
56 mBuilder.enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK_NO_HTTP, 1
000 * 1024); | 56 mBuilder.enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK_NO_HTTP, 1
000 * 1024); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") | 161 @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") |
162 private boolean fileContainsString(String filename, String content) throws I
OException { | 162 private boolean fileContainsString(String filename, String content) throws I
OException { |
163 File file = new File(CronetTestFramework.getTestStorage(getContext()) +
"/" + filename); | 163 File file = new File(CronetTestFramework.getTestStorage(getContext()) +
"/" + filename); |
164 FileInputStream fileInputStream = new FileInputStream(file); | 164 FileInputStream fileInputStream = new FileInputStream(file); |
165 byte[] data = new byte[(int) file.length()]; | 165 byte[] data = new byte[(int) file.length()]; |
166 fileInputStream.read(data); | 166 fileInputStream.read(data); |
167 fileInputStream.close(); | 167 fileInputStream.close(); |
168 return new String(data, "UTF-8").contains(content); | 168 return new String(data, "UTF-8").contains(content); |
169 } | 169 } |
170 } | 170 } |
OLD | NEW |