| 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 static org.chromium.base.CollectionUtil.newHashSet; | 7 import static org.chromium.base.CollectionUtil.newHashSet; |
| 8 | 8 |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.ContextWrapper; | 10 import android.content.ContextWrapper; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // NETWORK_QUALITY_OBSERVATION_SOURCE_TCP | 363 // NETWORK_QUALITY_OBSERVATION_SOURCE_TCP |
| 364 assertTrue(rttListener.rttObservationCount(1) > 0); | 364 assertTrue(rttListener.rttObservationCount(1) > 0); |
| 365 | 365 |
| 366 // NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC | 366 // NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC |
| 367 assertEquals(0, rttListener.rttObservationCount(2)); | 367 assertEquals(0, rttListener.rttObservationCount(2)); |
| 368 | 368 |
| 369 // Verify that the listeners were notified on the expected thread. | 369 // Verify that the listeners were notified on the expected thread. |
| 370 assertEquals(mNetworkQualityThread, rttListener.getThread()); | 370 assertEquals(mNetworkQualityThread, rttListener.getThread()); |
| 371 assertEquals(mNetworkQualityThread, throughputListener.getThread()); | 371 assertEquals(mNetworkQualityThread, throughputListener.getThread()); |
| 372 | 372 |
| 373 // Verify that effective connection type callback is received and |
| 374 // effective connection type is correctly set. |
| 375 assertTrue(mTestFramework.mCronetEngine.getEffectiveConnectionType() |
| 376 != EffectiveConnectionType.EFFECTIVE_CONNECTION_TYPE_UNKNOWN); |
| 377 |
| 373 mTestFramework.mCronetEngine.shutdown(); | 378 mTestFramework.mCronetEngine.shutdown(); |
| 374 } | 379 } |
| 375 | 380 |
| 376 @SmallTest | 381 @SmallTest |
| 377 @Feature({"Cronet"}) | 382 @Feature({"Cronet"}) |
| 378 public void testRealTimeNetworkQualityObservations_LegacyAPI() throws Except
ion { | 383 public void testRealTimeNetworkQualityObservations_LegacyAPI() throws Except
ion { |
| 379 mTestFramework = startCronetTestFramework(); | 384 mTestFramework = startCronetTestFramework(); |
| 380 Executor executor = Executors.newSingleThreadExecutor(); | 385 Executor executor = Executors.newSingleThreadExecutor(); |
| 381 ConditionVariable waitForThroughput = new ConditionVariable(); | 386 ConditionVariable waitForThroughput = new ConditionVariable(); |
| 382 TestNetworkQualityRttListener rttListener = new TestNetworkQualityRttLis
tener(); | 387 TestNetworkQualityRttListener rttListener = new TestNetworkQualityRttLis
tener(); |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 } | 1356 } |
| 1352 }.start(); | 1357 }.start(); |
| 1353 otherThreadDone.block(); | 1358 otherThreadDone.block(); |
| 1354 builder.build().shutdown(); | 1359 builder.build().shutdown(); |
| 1355 uiThreadDone.open(); | 1360 uiThreadDone.open(); |
| 1356 } | 1361 } |
| 1357 }); | 1362 }); |
| 1358 assertTrue(uiThreadDone.block(1000)); | 1363 assertTrue(uiThreadDone.block(1000)); |
| 1359 } | 1364 } |
| 1360 } | 1365 } |
| OLD | NEW |