| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 mUrl, callback, callback.getExecutor(), mTestFramework.mCronetEn
gine); | 413 mUrl, callback, callback.getExecutor(), mTestFramework.mCronetEn
gine); |
| 414 urlRequestBuilder.build().start(); | 414 urlRequestBuilder.build().start(); |
| 415 callback.blockForDone(); | 415 callback.blockForDone(); |
| 416 testExecutor.runAllTasks(); | 416 testExecutor.runAllTasks(); |
| 417 | 417 |
| 418 assertNull( | 418 assertNull( |
| 419 "RequestFinishedListener must not be called", requestFinishedLis
tener.mRequestInfo); | 419 "RequestFinishedListener must not be called", requestFinishedLis
tener.mRequestInfo); |
| 420 mTestFramework.mCronetEngine.shutdown(); | 420 mTestFramework.mCronetEngine.shutdown(); |
| 421 } | 421 } |
| 422 | 422 |
| 423 /** |
| 423 @SmallTest | 424 @SmallTest |
| 424 @Feature({"Cronet"}) | 425 @Feature({"Cronet"}) |
| 426 https://crbug.com/596929 |
| 427 */ |
| 428 @FlakyTest |
| 425 public void testShutdown() throws Exception { | 429 public void testShutdown() throws Exception { |
| 426 mTestFramework = startCronetTestFramework(); | 430 mTestFramework = startCronetTestFramework(); |
| 427 TestUrlRequestCallback callback = new ShutdownTestUrlRequestCallback(); | 431 TestUrlRequestCallback callback = new ShutdownTestUrlRequestCallback(); |
| 428 // Block callback when response starts to verify that shutdown fails | 432 // Block callback when response starts to verify that shutdown fails |
| 429 // if there are active requests. | 433 // if there are active requests. |
| 430 callback.setAutoAdvance(false); | 434 callback.setAutoAdvance(false); |
| 431 UrlRequest.Builder urlRequestBuilder = new UrlRequest.Builder( | 435 UrlRequest.Builder urlRequestBuilder = new UrlRequest.Builder( |
| 432 mUrl, callback, callback.getExecutor(), mTestFramework.mCronetEn
gine); | 436 mUrl, callback, callback.getExecutor(), mTestFramework.mCronetEn
gine); |
| 433 UrlRequest urlRequest = urlRequestBuilder.build(); | 437 UrlRequest urlRequest = urlRequestBuilder.build(); |
| 434 urlRequest.start(); | 438 urlRequest.start(); |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 try { | 1121 try { |
| 1118 // ensureInitialized() calls native code to check the version right
after library load | 1122 // ensureInitialized() calls native code to check the version right
after library load |
| 1119 // and will error with the message below if library loading was skip
ped | 1123 // and will error with the message below if library loading was skip
ped |
| 1120 CronetLibraryLoader.ensureInitialized(getContext(), builder); | 1124 CronetLibraryLoader.ensureInitialized(getContext(), builder); |
| 1121 fail("Native library should not be loaded"); | 1125 fail("Native library should not be loaded"); |
| 1122 } catch (UnsatisfiedLinkError e) { | 1126 } catch (UnsatisfiedLinkError e) { |
| 1123 assertTrue(loader.wasCalled()); | 1127 assertTrue(loader.wasCalled()); |
| 1124 } | 1128 } |
| 1125 } | 1129 } |
| 1126 } | 1130 } |
| OLD | NEW |