| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.content.Context; | 7 import android.content.Context; |
| 8 import android.content.ContextWrapper; | 8 import android.content.ContextWrapper; |
| 9 import android.os.ConditionVariable; | 9 import android.os.ConditionVariable; |
| 10 import android.os.Handler; | 10 import android.os.Handler; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 assertEquals(mNetworkQualityThread, throughputListener.getThread()); | 339 assertEquals(mNetworkQualityThread, throughputListener.getThread()); |
| 340 | 340 |
| 341 // Verify that effective connection type callback is received and | 341 // Verify that effective connection type callback is received and |
| 342 // effective connection type is correctly set. | 342 // effective connection type is correctly set. |
| 343 assertTrue(testFramework.mCronetEngine.getEffectiveConnectionType() | 343 assertTrue(testFramework.mCronetEngine.getEffectiveConnectionType() |
| 344 != EffectiveConnectionType.TYPE_UNKNOWN); | 344 != EffectiveConnectionType.TYPE_UNKNOWN); |
| 345 | 345 |
| 346 // Verify that the HTTP RTT, transport RTT and downstream throughput | 346 // Verify that the HTTP RTT, transport RTT and downstream throughput |
| 347 // estimates are available. | 347 // estimates are available. |
| 348 if (testFramework.mCronetEngine.getEffectiveConnectionType() | 348 if (testFramework.mCronetEngine.getEffectiveConnectionType() |
| 349 != EffectiveConnectionType.TYPE_OFFLINE) { | 349 != ExperimentalCronetEngine.EFFECTIVE_CONNECTION_TYPE_OFFLINE) { |
| 350 assertTrue(testFramework.mCronetEngine.getHttpRttMs() > 0); | 350 assertTrue(testFramework.mCronetEngine.getHttpRttMs() > 0); |
| 351 assertTrue(testFramework.mCronetEngine.getTransportRttMs() > 0); | 351 assertTrue(testFramework.mCronetEngine.getTransportRttMs() > 0); |
| 352 assertTrue(testFramework.mCronetEngine.getDownstreamThroughputKbps()
> 0); | 352 assertTrue(testFramework.mCronetEngine.getDownstreamThroughputKbps()
> 0); |
| 353 } else { | 353 } else { |
| 354 assertEquals(RttThroughputValues.INVALID_RTT_THROUGHPUT, | 354 assertEquals(RttThroughputValues.INVALID_RTT_THROUGHPUT, |
| 355 testFramework.mCronetEngine.getHttpRttMs()); | 355 testFramework.mCronetEngine.getHttpRttMs()); |
| 356 assertEquals(RttThroughputValues.INVALID_RTT_THROUGHPUT, | 356 assertEquals(RttThroughputValues.INVALID_RTT_THROUGHPUT, |
| 357 testFramework.mCronetEngine.getTransportRttMs()); | 357 testFramework.mCronetEngine.getTransportRttMs()); |
| 358 assertEquals(RttThroughputValues.INVALID_RTT_THROUGHPUT, | 358 assertEquals(RttThroughputValues.INVALID_RTT_THROUGHPUT, |
| 359 testFramework.mCronetEngine.getDownstreamThroughputKbps()); | 359 testFramework.mCronetEngine.getDownstreamThroughputKbps()); |
| (...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 TestUrlRequestCallback callback = new TestUrlRequestCallback(); | 1482 TestUrlRequestCallback callback = new TestUrlRequestCallback(); |
| 1483 URL requestUrl = | 1483 URL requestUrl = |
| 1484 new URL("http", resolverTestHostname, testUrl.getPort(), testUrl
.getFile()); | 1484 new URL("http", resolverTestHostname, testUrl.getPort(), testUrl
.getFile()); |
| 1485 UrlRequest.Builder urlRequestBuilder = testFramework.mCronetEngine.newUr
lRequestBuilder( | 1485 UrlRequest.Builder urlRequestBuilder = testFramework.mCronetEngine.newUr
lRequestBuilder( |
| 1486 requestUrl.toString(), callback, callback.getExecutor()); | 1486 requestUrl.toString(), callback, callback.getExecutor()); |
| 1487 urlRequestBuilder.build().start(); | 1487 urlRequestBuilder.build().start(); |
| 1488 callback.blockForDone(); | 1488 callback.blockForDone(); |
| 1489 assertEquals(200, callback.mResponseInfo.getHttpStatusCode()); | 1489 assertEquals(200, callback.mResponseInfo.getHttpStatusCode()); |
| 1490 } | 1490 } |
| 1491 } | 1491 } |
| OLD | NEW |