| 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 static org.chromium.base.CollectionUtil.newHashSet; | 7 import static org.chromium.base.CollectionUtil.newHashSet; |
| 8 | 8 |
| 9 import android.os.ConditionVariable; | 9 import android.os.ConditionVariable; |
| 10 import android.test.suitebuilder.annotation.SmallTest; | 10 import android.test.suitebuilder.annotation.SmallTest; |
| (...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 } | 1213 } |
| 1214 assertEquals(expectError, callback.mError != null); | 1214 assertEquals(expectError, callback.mError != null); |
| 1215 assertEquals(expectError, callback.mOnErrorCalled); | 1215 assertEquals(expectError, callback.mOnErrorCalled); |
| 1216 assertEquals(failureType == FailureType.CANCEL_SYNC | 1216 assertEquals(failureType == FailureType.CANCEL_SYNC |
| 1217 || failureType == FailureType.CANCEL_ASYNC | 1217 || failureType == FailureType.CANCEL_ASYNC |
| 1218 || failureType == FailureType.CANCEL_ASYNC_WITHOUT_PAUSE
, | 1218 || failureType == FailureType.CANCEL_ASYNC_WITHOUT_PAUSE
, |
| 1219 callback.mOnCanceledCalled); | 1219 callback.mOnCanceledCalled); |
| 1220 mTestFramework.mCronetEngine.removeRequestFinishedListener(requestFinish
edListener); | 1220 mTestFramework.mCronetEngine.removeRequestFinishedListener(requestFinish
edListener); |
| 1221 } | 1221 } |
| 1222 | 1222 |
| 1223 /* |
| 1224 Disabled temporarily due to http://crbug.com/653654 |
| 1225 |
| 1223 @SmallTest | 1226 @SmallTest |
| 1224 @Feature({"Cronet"}) | 1227 @Feature({"Cronet"}) |
| 1225 @OnlyRunNativeCronet | 1228 @OnlyRunNativeCronet |
| 1229 */ |
| 1230 @DisabledTest |
| 1226 public void testFailures() throws Exception { | 1231 public void testFailures() throws Exception { |
| 1227 throwOrCancel(FailureType.CANCEL_SYNC, ResponseStep.ON_STREAM_READY, fal
se); | 1232 throwOrCancel(FailureType.CANCEL_SYNC, ResponseStep.ON_STREAM_READY, fal
se); |
| 1228 throwOrCancel(FailureType.CANCEL_ASYNC, ResponseStep.ON_STREAM_READY, fa
lse); | 1233 throwOrCancel(FailureType.CANCEL_ASYNC, ResponseStep.ON_STREAM_READY, fa
lse); |
| 1229 throwOrCancel(FailureType.CANCEL_ASYNC_WITHOUT_PAUSE, ResponseStep.ON_ST
REAM_READY, false); | 1234 throwOrCancel(FailureType.CANCEL_ASYNC_WITHOUT_PAUSE, ResponseStep.ON_ST
REAM_READY, false); |
| 1230 throwOrCancel(FailureType.THROW_SYNC, ResponseStep.ON_STREAM_READY, true
); | 1235 throwOrCancel(FailureType.THROW_SYNC, ResponseStep.ON_STREAM_READY, true
); |
| 1231 | 1236 |
| 1232 throwOrCancel(FailureType.CANCEL_SYNC, ResponseStep.ON_RESPONSE_STARTED,
false); | 1237 throwOrCancel(FailureType.CANCEL_SYNC, ResponseStep.ON_RESPONSE_STARTED,
false); |
| 1233 throwOrCancel(FailureType.CANCEL_ASYNC, ResponseStep.ON_RESPONSE_STARTED
, false); | 1238 throwOrCancel(FailureType.CANCEL_ASYNC, ResponseStep.ON_RESPONSE_STARTED
, false); |
| 1234 throwOrCancel( | 1239 throwOrCancel( |
| 1235 FailureType.CANCEL_ASYNC_WITHOUT_PAUSE, ResponseStep.ON_RESPONSE
_STARTED, false); | 1240 FailureType.CANCEL_ASYNC_WITHOUT_PAUSE, ResponseStep.ON_RESPONSE
_STARTED, false); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 private static String bufferContentsToString(ByteBuffer byteBuffer, int star
t, int end) { | 1436 private static String bufferContentsToString(ByteBuffer byteBuffer, int star
t, int end) { |
| 1432 // Use a duplicate to avoid modifying byteBuffer. | 1437 // Use a duplicate to avoid modifying byteBuffer. |
| 1433 ByteBuffer duplicate = byteBuffer.duplicate(); | 1438 ByteBuffer duplicate = byteBuffer.duplicate(); |
| 1434 duplicate.position(start); | 1439 duplicate.position(start); |
| 1435 duplicate.limit(end); | 1440 duplicate.limit(end); |
| 1436 byte[] contents = new byte[duplicate.remaining()]; | 1441 byte[] contents = new byte[duplicate.remaining()]; |
| 1437 duplicate.get(contents); | 1442 duplicate.get(contents); |
| 1438 return new String(contents); | 1443 return new String(contents); |
| 1439 } | 1444 } |
| 1440 } | 1445 } |
| OLD | NEW |