| 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 30 matching lines...) Expand all Loading... |
| 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) | 46 .put("delay_tcp_race", true) |
| 47 .put("max_number_of_lossy_connections",
10) | 47 .put("max_number_of_lossy_connections",
10) |
| 48 .put("packet_loss_threshold", 0.5) | 48 .put("packet_loss_threshold", 0.5) |
| 49 .put("idle_connection_timeout_seconds",
300) | 49 .put("idle_connection_timeout_seconds",
300) |
| 50 .put("close_sessions_on_ip_change", true
) | 50 .put("close_sessions_on_ip_change", true
) |
| 51 .put("migrate_sessions_on_network_change
", true); | 51 .put("migrate_sessions_on_network_change
", false); |
| 52 JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams
); | 52 JSONObject experimentalOptions = new JSONObject().put("QUIC", quicParams
); |
| 53 mBuilder.setExperimentalOptions(experimentalOptions.toString()); | 53 mBuilder.setExperimentalOptions(experimentalOptions.toString()); |
| 54 | 54 |
| 55 mBuilder.setMockCertVerifierForTesting(QuicTestServer.createMockCertVeri
fier()); | 55 mBuilder.setMockCertVerifierForTesting(QuicTestServer.createMockCertVeri
fier()); |
| 56 mBuilder.setStoragePath(CronetTestFramework.getTestStorage(getContext())
); | 56 mBuilder.setStoragePath(CronetTestFramework.getTestStorage(getContext())
); |
| 57 mBuilder.enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK_NO_HTTP, 1
000 * 1024); | 57 mBuilder.enableHttpCache(CronetEngine.Builder.HTTP_CACHE_DISK_NO_HTTP, 1
000 * 1024); |
| 58 } | 58 } |
| 59 | 59 |
| 60 @Override | 60 @Override |
| 61 protected void tearDown() throws Exception { | 61 protected void tearDown() throws Exception { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") | 162 @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE") |
| 163 private boolean fileContainsString(String filename, String content) throws I
OException { | 163 private boolean fileContainsString(String filename, String content) throws I
OException { |
| 164 File file = new File(CronetTestFramework.getTestStorage(getContext()) +
"/" + filename); | 164 File file = new File(CronetTestFramework.getTestStorage(getContext()) +
"/" + filename); |
| 165 FileInputStream fileInputStream = new FileInputStream(file); | 165 FileInputStream fileInputStream = new FileInputStream(file); |
| 166 byte[] data = new byte[(int) file.length()]; | 166 byte[] data = new byte[(int) file.length()]; |
| 167 fileInputStream.read(data); | 167 fileInputStream.read(data); |
| 168 fileInputStream.close(); | 168 fileInputStream.close(); |
| 169 return new String(data, "UTF-8").contains(content); | 169 return new String(data, "UTF-8").contains(content); |
| 170 } | 170 } |
| 171 } | 171 } |
| OLD | NEW |