| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // NETWORK_QUALITY_OBSERVATION_SOURCE_TCP | 318 // NETWORK_QUALITY_OBSERVATION_SOURCE_TCP |
| 319 assertTrue(rttListener.rttObservationCount(1) > 0); | 319 assertTrue(rttListener.rttObservationCount(1) > 0); |
| 320 | 320 |
| 321 // NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC | 321 // NETWORK_QUALITY_OBSERVATION_SOURCE_QUIC |
| 322 assertEquals(0, rttListener.rttObservationCount(2)); | 322 assertEquals(0, rttListener.rttObservationCount(2)); |
| 323 | 323 |
| 324 // Verify that the listeners were notified on the expected thread. | 324 // Verify that the listeners were notified on the expected thread. |
| 325 assertEquals(mNetworkQualityThread, rttListener.getThread()); | 325 assertEquals(mNetworkQualityThread, rttListener.getThread()); |
| 326 assertEquals(mNetworkQualityThread, throughputListener.getThread()); | 326 assertEquals(mNetworkQualityThread, throughputListener.getThread()); |
| 327 | 327 |
| 328 // Verify that effective connection type callback is received and |
| 329 // effective connection type is correctly set. |
| 330 assertTrue(mTestFramework.mCronetEngine.getEffectiveConnectionType() |
| 331 != EffectiveConnectionType.EFFECTIVE_CONNECTION_TYPE_UNKNOWN); |
| 332 |
| 328 mTestFramework.mCronetEngine.shutdown(); | 333 mTestFramework.mCronetEngine.shutdown(); |
| 329 } | 334 } |
| 330 | 335 |
| 331 @SmallTest | 336 @SmallTest |
| 332 @Feature({"Cronet"}) | 337 @Feature({"Cronet"}) |
| 333 public void testShutdown() throws Exception { | 338 public void testShutdown() throws Exception { |
| 334 mTestFramework = startCronetTestFramework(); | 339 mTestFramework = startCronetTestFramework(); |
| 335 TestUrlRequestCallback callback = new ShutdownTestUrlRequestCallback(); | 340 TestUrlRequestCallback callback = new ShutdownTestUrlRequestCallback(); |
| 336 // Block callback when response starts to verify that shutdown fails | 341 // Block callback when response starts to verify that shutdown fails |
| 337 // if there are active requests. | 342 // if there are active requests. |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 } | 1108 } |
| 1104 }.start(); | 1109 }.start(); |
| 1105 otherThreadDone.block(); | 1110 otherThreadDone.block(); |
| 1106 builder.build().shutdown(); | 1111 builder.build().shutdown(); |
| 1107 uiThreadDone.open(); | 1112 uiThreadDone.open(); |
| 1108 } | 1113 } |
| 1109 }); | 1114 }); |
| 1110 assertTrue(uiThreadDone.block(1000)); | 1115 assertTrue(uiThreadDone.block(1000)); |
| 1111 } | 1116 } |
| 1112 } | 1117 } |
| OLD | NEW |