| 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.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; |
| 15 import org.chromium.base.test.util.Feature; | 16 import org.chromium.base.test.util.Feature; |
| 16 import org.chromium.net.CronetTestBase.OnlyRunNativeCronet; | 17 import org.chromium.net.CronetTestBase.OnlyRunNativeCronet; |
| 17 import org.chromium.net.MetricsTestUtil.TestRequestFinishedListener; | 18 import org.chromium.net.MetricsTestUtil.TestRequestFinishedListener; |
| 18 | 19 |
| 19 import java.io.File; | 20 import java.io.File; |
| 20 import java.io.FileInputStream; | 21 import java.io.FileInputStream; |
| 21 import java.io.FileNotFoundException; | 22 import java.io.FileNotFoundException; |
| 22 import java.io.IOException; | 23 import java.io.IOException; |
| 23 import java.util.Date; | 24 import java.util.Date; |
| 24 import java.util.concurrent.Executors; | 25 import java.util.concurrent.Executors; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 68 |
| 68 @Override | 69 @Override |
| 69 protected void tearDown() throws Exception { | 70 protected void tearDown() throws Exception { |
| 70 QuicTestServer.shutdownQuicTestServer(); | 71 QuicTestServer.shutdownQuicTestServer(); |
| 71 super.tearDown(); | 72 super.tearDown(); |
| 72 } | 73 } |
| 73 | 74 |
| 74 @LargeTest | 75 @LargeTest |
| 75 @Feature({"Cronet"}) | 76 @Feature({"Cronet"}) |
| 76 @OnlyRunNativeCronet | 77 @OnlyRunNativeCronet |
| 78 @DisabledTest(message = "crbug.com/663789") |
| 77 public void testQuicLoadUrl() throws Exception { | 79 public void testQuicLoadUrl() throws Exception { |
| 78 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n
ull, mBuilder); | 80 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n
ull, mBuilder); |
| 79 String quicURL = QuicTestServer.getServerURL() + "/simple.txt"; | 81 String quicURL = QuicTestServer.getServerURL() + "/simple.txt"; |
| 80 TestUrlRequestCallback callback = new TestUrlRequestCallback(); | 82 TestUrlRequestCallback callback = new TestUrlRequestCallback(); |
| 81 | 83 |
| 82 // Although the native stack races QUIC and SPDY for the first request, | 84 // Although the native stack races QUIC and SPDY for the first request, |
| 83 // since there is no http server running on the corresponding TCP port, | 85 // since there is no http server running on the corresponding TCP port, |
| 84 // QUIC will always succeed with a 200 (see | 86 // QUIC will always succeed with a 200 (see |
| 85 // net::HttpStreamFactoryImpl::Request::OnStreamFailed). | 87 // net::HttpStreamFactoryImpl::Request::OnStreamFailed). |
| 86 UrlRequest.Builder requestBuilder = mTestFramework.mCronetEngine.newUrlR
equestBuilder( | 88 UrlRequest.Builder requestBuilder = mTestFramework.mCronetEngine.newUrlR
equestBuilder( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 byte[] data = new byte[(int) file.length()]; | 151 byte[] data = new byte[(int) file.length()]; |
| 150 fileInputStream.read(data); | 152 fileInputStream.read(data); |
| 151 fileInputStream.close(); | 153 fileInputStream.close(); |
| 152 return new String(data, "UTF-8").contains(content); | 154 return new String(data, "UTF-8").contains(content); |
| 153 } | 155 } |
| 154 | 156 |
| 155 @LargeTest | 157 @LargeTest |
| 156 @Feature({"Cronet"}) | 158 @Feature({"Cronet"}) |
| 157 @OnlyRunNativeCronet | 159 @OnlyRunNativeCronet |
| 158 @SuppressWarnings("deprecation") | 160 @SuppressWarnings("deprecation") |
| 161 @DisabledTest(message = "crbug.com/663789") |
| 159 public void testRealTimeNetworkQualityObservationsWithQuic() throws Exceptio
n { | 162 public void testRealTimeNetworkQualityObservationsWithQuic() throws Exceptio
n { |
| 160 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n
ull, mBuilder); | 163 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n
ull, mBuilder); |
| 161 String quicURL = QuicTestServer.getServerURL() + "/simple.txt"; | 164 String quicURL = QuicTestServer.getServerURL() + "/simple.txt"; |
| 162 ConditionVariable waitForThroughput = new ConditionVariable(); | 165 ConditionVariable waitForThroughput = new ConditionVariable(); |
| 163 | 166 |
| 164 TestNetworkQualityRttListener rttListener = | 167 TestNetworkQualityRttListener rttListener = |
| 165 new TestNetworkQualityRttListener(Executors.newSingleThreadExecu
tor()); | 168 new TestNetworkQualityRttListener(Executors.newSingleThreadExecu
tor()); |
| 166 TestNetworkQualityThroughputListener throughputListener = | 169 TestNetworkQualityThroughputListener throughputListener = |
| 167 new TestNetworkQualityThroughputListener( | 170 new TestNetworkQualityThroughputListener( |
| 168 Executors.newSingleThreadExecutor(), waitForThroughput); | 171 Executors.newSingleThreadExecutor(), waitForThroughput); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // effective connection type is correctly set. | 208 // effective connection type is correctly set. |
| 206 assertTrue(mTestFramework.mCronetEngine.getEffectiveConnectionType() | 209 assertTrue(mTestFramework.mCronetEngine.getEffectiveConnectionType() |
| 207 != EffectiveConnectionType.TYPE_UNKNOWN); | 210 != EffectiveConnectionType.TYPE_UNKNOWN); |
| 208 | 211 |
| 209 mTestFramework.mCronetEngine.shutdown(); | 212 mTestFramework.mCronetEngine.shutdown(); |
| 210 } | 213 } |
| 211 | 214 |
| 212 @SmallTest | 215 @SmallTest |
| 213 @OnlyRunNativeCronet | 216 @OnlyRunNativeCronet |
| 214 @Feature({"Cronet"}) | 217 @Feature({"Cronet"}) |
| 218 @DisabledTest(message = "crbug.com/663789") |
| 215 public void testMetricsWithQuic() throws Exception { | 219 public void testMetricsWithQuic() throws Exception { |
| 216 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n
ull, mBuilder); | 220 mTestFramework = startCronetTestFrameworkWithUrlAndCronetEngineBuilder(n
ull, mBuilder); |
| 217 TestRequestFinishedListener requestFinishedListener = new TestRequestFin
ishedListener(); | 221 TestRequestFinishedListener requestFinishedListener = new TestRequestFin
ishedListener(); |
| 218 mTestFramework.mCronetEngine.addRequestFinishedListener(requestFinishedL
istener); | 222 mTestFramework.mCronetEngine.addRequestFinishedListener(requestFinishedL
istener); |
| 219 | 223 |
| 220 String quicURL = QuicTestServer.getServerURL() + "/simple.txt"; | 224 String quicURL = QuicTestServer.getServerURL() + "/simple.txt"; |
| 221 TestUrlRequestCallback callback = new TestUrlRequestCallback(); | 225 TestUrlRequestCallback callback = new TestUrlRequestCallback(); |
| 222 | 226 |
| 223 UrlRequest.Builder requestBuilder = mTestFramework.mCronetEngine.newUrlR
equestBuilder( | 227 UrlRequest.Builder requestBuilder = mTestFramework.mCronetEngine.newUrlR
equestBuilder( |
| 224 quicURL, callback, callback.getExecutor()); | 228 quicURL, callback, callback.getExecutor()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 251 assertEquals("quic/1+spdy/3", callback.mResponseInfo.getNegotiatedProtoc
ol()); | 255 assertEquals("quic/1+spdy/3", callback.mResponseInfo.getNegotiatedProtoc
ol()); |
| 252 | 256 |
| 253 requestInfo = requestFinishedListener.getRequestInfo(); | 257 requestInfo = requestFinishedListener.getRequestInfo(); |
| 254 MetricsTestUtil.checkRequestFinishedInfo(requestInfo, quicURL, startTime
, endTime); | 258 MetricsTestUtil.checkRequestFinishedInfo(requestInfo, quicURL, startTime
, endTime); |
| 255 assertEquals(RequestFinishedInfo.SUCCEEDED, requestInfo.getFinishedReaso
n()); | 259 assertEquals(RequestFinishedInfo.SUCCEEDED, requestInfo.getFinishedReaso
n()); |
| 256 MetricsTestUtil.checkNoConnectTiming(requestInfo.getMetrics()); | 260 MetricsTestUtil.checkNoConnectTiming(requestInfo.getMetrics()); |
| 257 | 261 |
| 258 mTestFramework.mCronetEngine.shutdown(); | 262 mTestFramework.mCronetEngine.shutdown(); |
| 259 } | 263 } |
| 260 } | 264 } |
| OLD | NEW |