Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: components/cronet/android/test/javatests/src/org/chromium/net/QuicTest.java

Issue 2487333002: Reenable Cronet tests. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.test.suitebuilder.annotation.LargeTest; 8 import android.test.suitebuilder.annotation.LargeTest;
9 import android.test.suitebuilder.annotation.SmallTest; 9 import android.test.suitebuilder.annotation.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.DisabledTest;
16 import org.chromium.base.test.util.Feature; 15 import org.chromium.base.test.util.Feature;
17 import org.chromium.net.CronetTestBase.OnlyRunNativeCronet; 16 import org.chromium.net.CronetTestBase.OnlyRunNativeCronet;
18 import org.chromium.net.MetricsTestUtil.TestRequestFinishedListener; 17 import org.chromium.net.MetricsTestUtil.TestRequestFinishedListener;
19 18
20 import java.io.File; 19 import java.io.File;
21 import java.io.FileInputStream; 20 import java.io.FileInputStream;
22 import java.io.FileNotFoundException; 21 import java.io.FileNotFoundException;
23 import java.io.IOException; 22 import java.io.IOException;
24 import java.util.Date; 23 import java.util.Date;
25 import java.util.concurrent.Executors; 24 import java.util.concurrent.Executors;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 68
70 @Override 69 @Override
71 protected void tearDown() throws Exception { 70 protected void tearDown() throws Exception {
72 QuicTestServer.shutdownQuicTestServer(); 71 QuicTestServer.shutdownQuicTestServer();
73 super.tearDown(); 72 super.tearDown();
74 } 73 }
75 74
76 @LargeTest 75 @LargeTest
77 @Feature({"Cronet"}) 76 @Feature({"Cronet"})
78 @OnlyRunNativeCronet 77 @OnlyRunNativeCronet
79 @DisabledTest(message = "crbug.com/663789")
80 public void testQuicLoadUrl() throws Exception { 78 public void testQuicLoadUrl() throws Exception {
81 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n ull, mBuilder); 79 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n ull, mBuilder);
82 String quicURL = QuicTestServer.getServerURL() + "/simple.txt"; 80 String quicURL = QuicTestServer.getServerURL() + "/simple.txt";
83 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 81 TestUrlRequestCallback callback = new TestUrlRequestCallback();
84 82
85 // Although the native stack races QUIC and SPDY for the first request, 83 // Although the native stack races QUIC and SPDY for the first request,
86 // since there is no http server running on the corresponding TCP port, 84 // since there is no http server running on the corresponding TCP port,
87 // QUIC will always succeed with a 200 (see 85 // QUIC will always succeed with a 200 (see
88 // net::HttpStreamFactoryImpl::Request::OnStreamFailed). 86 // net::HttpStreamFactoryImpl::Request::OnStreamFailed).
89 UrlRequest.Builder requestBuilder = mTestFramework.mCronetEngine.newUrlR equestBuilder( 87 UrlRequest.Builder requestBuilder = mTestFramework.mCronetEngine.newUrlR equestBuilder(
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 byte[] data = new byte[(int) file.length()]; 150 byte[] data = new byte[(int) file.length()];
153 fileInputStream.read(data); 151 fileInputStream.read(data);
154 fileInputStream.close(); 152 fileInputStream.close();
155 return new String(data, "UTF-8").contains(content); 153 return new String(data, "UTF-8").contains(content);
156 } 154 }
157 155
158 @LargeTest 156 @LargeTest
159 @Feature({"Cronet"}) 157 @Feature({"Cronet"})
160 @OnlyRunNativeCronet 158 @OnlyRunNativeCronet
161 @SuppressWarnings("deprecation") 159 @SuppressWarnings("deprecation")
162 @DisabledTest(message = "crbug.com/663789")
163 public void testRealTimeNetworkQualityObservationsWithQuic() throws Exceptio n { 160 public void testRealTimeNetworkQualityObservationsWithQuic() throws Exceptio n {
164 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n ull, mBuilder); 161 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n ull, mBuilder);
165 String quicURL = QuicTestServer.getServerURL() + "/simple.txt"; 162 String quicURL = QuicTestServer.getServerURL() + "/simple.txt";
166 ConditionVariable waitForThroughput = new ConditionVariable(); 163 ConditionVariable waitForThroughput = new ConditionVariable();
167 164
168 TestNetworkQualityRttListener rttListener = 165 TestNetworkQualityRttListener rttListener =
169 new TestNetworkQualityRttListener(Executors.newSingleThreadExecu tor()); 166 new TestNetworkQualityRttListener(Executors.newSingleThreadExecu tor());
170 TestNetworkQualityThroughputListener throughputListener = 167 TestNetworkQualityThroughputListener throughputListener =
171 new TestNetworkQualityThroughputListener( 168 new TestNetworkQualityThroughputListener(
172 Executors.newSingleThreadExecutor(), waitForThroughput); 169 Executors.newSingleThreadExecutor(), waitForThroughput);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // effective connection type is correctly set. 206 // effective connection type is correctly set.
210 assertTrue(mTestFramework.mCronetEngine.getEffectiveConnectionType() 207 assertTrue(mTestFramework.mCronetEngine.getEffectiveConnectionType()
211 != EffectiveConnectionType.TYPE_UNKNOWN); 208 != EffectiveConnectionType.TYPE_UNKNOWN);
212 209
213 mTestFramework.mCronetEngine.shutdown(); 210 mTestFramework.mCronetEngine.shutdown();
214 } 211 }
215 212
216 @SmallTest 213 @SmallTest
217 @OnlyRunNativeCronet 214 @OnlyRunNativeCronet
218 @Feature({"Cronet"}) 215 @Feature({"Cronet"})
219 @DisabledTest(message = "crbug.com/663789")
220 public void testMetricsWithQuic() throws Exception { 216 public void testMetricsWithQuic() throws Exception {
221 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n ull, mBuilder); 217 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n ull, mBuilder);
222 TestRequestFinishedListener requestFinishedListener = new TestRequestFin ishedListener(); 218 TestRequestFinishedListener requestFinishedListener = new TestRequestFin ishedListener();
223 mTestFramework.mCronetEngine.addRequestFinishedListener(requestFinishedL istener); 219 mTestFramework.mCronetEngine.addRequestFinishedListener(requestFinishedL istener);
224 220
225 String quicURL = QuicTestServer.getServerURL() + "/simple.txt"; 221 String quicURL = QuicTestServer.getServerURL() + "/simple.txt";
226 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 222 TestUrlRequestCallback callback = new TestUrlRequestCallback();
227 223
228 UrlRequest.Builder requestBuilder = mTestFramework.mCronetEngine.newUrlR equestBuilder( 224 UrlRequest.Builder requestBuilder = mTestFramework.mCronetEngine.newUrlR equestBuilder(
229 quicURL, callback, callback.getExecutor()); 225 quicURL, callback, callback.getExecutor());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 MetricsTestUtil.checkNoConnectTiming(requestInfo.getMetrics()); 257 MetricsTestUtil.checkNoConnectTiming(requestInfo.getMetrics());
262 258
263 mTestFramework.mCronetEngine.shutdown(); 259 mTestFramework.mCronetEngine.shutdown();
264 } 260 }
265 261
266 // Helper method to assert that the request is negotiated over QUIC. 262 // Helper method to assert that the request is negotiated over QUIC.
267 private void assertIsQuic(UrlResponseInfo responseInfo) { 263 private void assertIsQuic(UrlResponseInfo responseInfo) {
268 assertTrue(responseInfo.getNegotiatedProtocol().startsWith(QUIC_PROTOCOL _STRING_PREFIX)); 264 assertTrue(responseInfo.getNegotiatedProtocol().startsWith(QUIC_PROTOCOL _STRING_PREFIX));
269 } 265 }
270 } 266 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698