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.os.ConditionVariable; | 7 import android.os.ConditionVariable; |
8 import android.support.test.filters.LargeTest; | 8 import android.support.test.filters.LargeTest; |
9 import android.support.test.filters.SmallTest; | 9 import android.support.test.filters.SmallTest; |
10 | 10 |
11 import org.json.JSONObject; | 11 import org.json.JSONObject; |
12 | 12 |
13 import org.chromium.base.Log; | 13 import org.chromium.base.Log; |
14 import org.chromium.base.annotations.SuppressFBWarnings; | 14 import org.chromium.base.annotations.SuppressFBWarnings; |
15 import org.chromium.base.test.util.Feature; | 15 import org.chromium.base.test.util.Feature; |
16 import org.chromium.net.CronetTestBase.OnlyRunNativeCronet; | 16 import org.chromium.net.CronetTestBase.OnlyRunNativeCronet; |
17 import org.chromium.net.MetricsTestUtil.TestRequestFinishedListener; | 17 import org.chromium.net.MetricsTestUtil.TestRequestFinishedListener; |
18 | 18 |
19 import java.io.File; | 19 import java.io.File; |
20 import java.io.FileInputStream; | 20 import java.io.FileInputStream; |
21 import java.io.FileNotFoundException; | 21 import java.io.FileNotFoundException; |
22 import java.io.IOException; | 22 import java.io.IOException; |
23 import java.util.Date; | 23 import java.util.Date; |
24 import java.util.concurrent.Executors; | 24 import java.util.concurrent.Executors; |
25 | 25 |
26 /** | 26 /** |
27 * Tests making requests using QUIC. | 27 * Tests making requests using QUIC. |
28 */ | 28 */ |
29 public class QuicTest extends CronetTestBase { | 29 public class QuicTest extends CronetTestBase { |
30 private static final String TAG = "cr.QuicTest"; | 30 private static final String TAG = QuicTest.class.getSimpleName(); |
31 private static final String QUIC_PROTOCOL_STRING_PREFIX = "http/2+quic/"; | 31 private static final String QUIC_PROTOCOL_STRING_PREFIX = "http/2+quic/"; |
32 private CronetTestFramework mTestFramework; | 32 private CronetTestFramework mTestFramework; |
33 private ExperimentalCronetEngine.Builder mBuilder; | 33 private ExperimentalCronetEngine.Builder mBuilder; |
34 | 34 |
35 @Override | 35 @Override |
36 protected void setUp() throws Exception { | 36 protected void setUp() throws Exception { |
37 super.setUp(); | 37 super.setUp(); |
38 // Load library first, since we need the Quic test server's URL. | 38 // Load library first, since we need the Quic test server's URL. |
39 System.loadLibrary("cronet_tests"); | 39 System.loadLibrary("cronet_tests"); |
40 QuicTestServer.startQuicTestServer(getContext()); | 40 QuicTestServer.startQuicTestServer(getContext()); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 MetricsTestUtil.checkNoConnectTiming(requestInfo.getMetrics()); | 257 MetricsTestUtil.checkNoConnectTiming(requestInfo.getMetrics()); |
258 | 258 |
259 mTestFramework.mCronetEngine.shutdown(); | 259 mTestFramework.mCronetEngine.shutdown(); |
260 } | 260 } |
261 | 261 |
262 // Helper method to assert that the request is negotiated over QUIC. | 262 // Helper method to assert that the request is negotiated over QUIC. |
263 private void assertIsQuic(UrlResponseInfo responseInfo) { | 263 private void assertIsQuic(UrlResponseInfo responseInfo) { |
264 assertTrue(responseInfo.getNegotiatedProtocol().startsWith(QUIC_PROTOCOL
_STRING_PREFIX)); | 264 assertTrue(responseInfo.getNegotiatedProtocol().startsWith(QUIC_PROTOCOL
_STRING_PREFIX)); |
265 } | 265 } |
266 } | 266 } |
OLD | NEW |