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 | 36 |
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("host_whitelist", "test.example.com
") | 44 .put("host_whitelist", "test.example.com
") |
45 .put("max_server_configs_stored_in_prope
rties", 2) | 45 .put("max_server_configs_stored_in_prope
rties", 2) |
46 .put("delay_tcp_race", true) | |
47 .put("max_number_of_lossy_connections",
10) | 46 .put("max_number_of_lossy_connections",
10) |
48 .put("packet_loss_threshold", 0.5) | 47 .put("packet_loss_threshold", 0.5) |
49 .put("idle_connection_timeout_seconds",
300) | 48 .put("idle_connection_timeout_seconds",
300) |
50 .put("close_sessions_on_ip_change", fals
e) | 49 .put("close_sessions_on_ip_change", fals
e) |
51 .put("migrate_sessions_on_network_change
", true) | 50 .put("migrate_sessions_on_network_change
", true) |
52 .put("migrate_sessions_early", true); | 51 .put("migrate_sessions_early", true); |
53 JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams
); | 52 JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams
); |
54 mBuilder.setExperimentalOptions(experimentalOptions.toString()); | 53 mBuilder.setExperimentalOptions(experimentalOptions.toString()); |
55 | 54 |
56 mBuilder.setMockCertVerifierForTesting(QuicTestServer.createMockCertVeri
fier()); | 55 mBuilder.setMockCertVerifierForTesting(QuicTestServer.createMockCertVeri
fier()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 private boolean fileContainsString(String filename, String content) throws I
OException { | 163 private boolean fileContainsString(String filename, String content) throws I
OException { |
165 File file = | 164 File file = |
166 new File(CronetTestFramework.getTestStorage(getContext()) + "/pr
efs/" + filename); | 165 new File(CronetTestFramework.getTestStorage(getContext()) + "/pr
efs/" + filename); |
167 FileInputStream fileInputStream = new FileInputStream(file); | 166 FileInputStream fileInputStream = new FileInputStream(file); |
168 byte[] data = new byte[(int) file.length()]; | 167 byte[] data = new byte[(int) file.length()]; |
169 fileInputStream.read(data); | 168 fileInputStream.read(data); |
170 fileInputStream.close(); | 169 fileInputStream.close(); |
171 return new String(data, "UTF-8").contains(content); | 170 return new String(data, "UTF-8").contains(content); |
172 } | 171 } |
173 } | 172 } |
OLD | NEW |