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 26 matching lines...) Expand all Loading... |
37 mBuilder = new CronetEngine.Builder(getContext()); | 37 mBuilder = new CronetEngine.Builder(getContext()); |
38 mBuilder.enableQUIC(true); | 38 mBuilder.enableQUIC(true); |
39 mBuilder.addQuicHint(QuicTestServer.getServerHost(), QuicTestServer.getS
erverPort(), | 39 mBuilder.addQuicHint(QuicTestServer.getServerHost(), QuicTestServer.getS
erverPort(), |
40 QuicTestServer.getServerPort()); | 40 QuicTestServer.getServerPort()); |
41 | 41 |
42 JSONObject quicParams = new JSONObject() | 42 JSONObject quicParams = new JSONObject() |
43 .put("connection_options", "PACE,IW10,FO
O,DEADBEEF") | 43 .put("connection_options", "PACE,IW10,FO
O,DEADBEEF") |
44 .put("store_server_configs_in_properties
", true) | 44 .put("store_server_configs_in_properties
", true) |
45 .put("delay_tcp_race", true) | 45 .put("delay_tcp_race", true) |
46 .put("max_number_of_lossy_connections",
10) | 46 .put("max_number_of_lossy_connections",
10) |
47 .put("packet_loss_threshold", 0.5); | 47 .put("packet_loss_threshold", 0.5) |
| 48 .put("idle_connection_timeout_seconds",
300); |
48 JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams
); | 49 JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams
); |
49 mBuilder.setExperimentalOptions(experimentalOptions.toString()); | 50 mBuilder.setExperimentalOptions(experimentalOptions.toString()); |
50 | 51 |
51 mBuilder.setMockCertVerifierForTesting(MockCertVerifier.createMockCertVe
rifier(CERTS_USED)); | 52 mBuilder.setMockCertVerifierForTesting(MockCertVerifier.createMockCertVe
rifier(CERTS_USED)); |
52 mBuilder.setStoragePath(CronetTestFramework.getTestStorage(getContext())
); | 53 mBuilder.setStoragePath(CronetTestFramework.getTestStorage(getContext())
); |
53 mBuilder.enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK_NO_HTTP, 1
000 * 1024); | 54 mBuilder.enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK_NO_HTTP, 1
000 * 1024); |
54 } | 55 } |
55 | 56 |
56 @Override | 57 @Override |
57 protected void tearDown() throws Exception { | 58 protected void tearDown() throws Exception { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") | 155 @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") |
155 private boolean fileContainsString(String filename, String content) throws I
OException { | 156 private boolean fileContainsString(String filename, String content) throws I
OException { |
156 File file = new File(CronetTestFramework.getTestStorage(getContext()) +
"/" + filename); | 157 File file = new File(CronetTestFramework.getTestStorage(getContext()) +
"/" + filename); |
157 FileInputStream fileInputStream = new FileInputStream(file); | 158 FileInputStream fileInputStream = new FileInputStream(file); |
158 byte[] data = new byte[(int) file.length()]; | 159 byte[] data = new byte[(int) file.length()]; |
159 fileInputStream.read(data); | 160 fileInputStream.read(data); |
160 fileInputStream.close(); | 161 fileInputStream.close(); |
161 return new String(data, "UTF-8").contains(content); | 162 return new String(data, "UTF-8").contains(content); |
162 } | 163 } |
163 } | 164 } |
OLD | NEW |