| Index: components/cronet/android/test/javatests/src/org/chromium/net/BidirectionalStreamTest.java
|
| diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/BidirectionalStreamTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/BidirectionalStreamTest.java
|
| index fb3b66451fabe69f7173d522e79610ae6c5bfd8a..74c88ad6e0e026a097139394112a9b434597c8af 100644
|
| --- a/components/cronet/android/test/javatests/src/org/chromium/net/BidirectionalStreamTest.java
|
| +++ b/components/cronet/android/test/javatests/src/org/chromium/net/BidirectionalStreamTest.java
|
| @@ -811,8 +811,8 @@ public class BidirectionalStreamTest extends CronetTestBase {
|
| assertEquals("GET", callback.mResponseAsString);
|
| }
|
|
|
| - private void throwOrCancel(FailureType failureType, ResponseStep failureStep,
|
| - boolean expectResponseInfo, boolean expectError) {
|
| + private void throwOrCancel(
|
| + FailureType failureType, ResponseStep failureStep, boolean expectError) {
|
| TestBidirectionalStreamCallback callback = new TestBidirectionalStreamCallback();
|
| callback.setFailure(failureType, failureStep);
|
| BidirectionalStream.Builder builder =
|
| @@ -823,7 +823,13 @@ public class BidirectionalStreamTest extends CronetTestBase {
|
| callback.blockForDone();
|
| // assertEquals(callback.mResponseStep, failureStep);
|
| assertTrue(stream.isDone());
|
| - assertEquals(expectResponseInfo, callback.mResponseInfo != null);
|
| + // Cancellation when request headers are sent does not guarantee that
|
| + // mResponseInfo is null because there might be a
|
| + // onResponseHeadersReceived already queued in the executor.
|
| + // See crbug.com/594432.
|
| + if (failureStep != ResponseStep.ON_REQUEST_HEADERS_SENT) {
|
| + assertNotNull(callback.mResponseInfo);
|
| + }
|
| assertEquals(expectError, callback.mError != null);
|
| assertEquals(expectError, callback.mOnErrorCalled);
|
| assertEquals(failureType == FailureType.CANCEL_SYNC
|
| @@ -836,23 +842,23 @@ public class BidirectionalStreamTest extends CronetTestBase {
|
| @Feature({"Cronet"})
|
| @OnlyRunNativeCronet
|
| public void testFailures() throws Exception {
|
| - throwOrCancel(FailureType.CANCEL_SYNC, ResponseStep.ON_REQUEST_HEADERS_SENT, false, false);
|
| - throwOrCancel(FailureType.CANCEL_ASYNC, ResponseStep.ON_REQUEST_HEADERS_SENT, false, false);
|
| + throwOrCancel(FailureType.CANCEL_SYNC, ResponseStep.ON_REQUEST_HEADERS_SENT, false);
|
| + throwOrCancel(FailureType.CANCEL_ASYNC, ResponseStep.ON_REQUEST_HEADERS_SENT, false);
|
| throwOrCancel(FailureType.CANCEL_ASYNC_WITHOUT_PAUSE, ResponseStep.ON_REQUEST_HEADERS_SENT,
|
| - false, false);
|
| - throwOrCancel(FailureType.THROW_SYNC, ResponseStep.ON_REQUEST_HEADERS_SENT, false, true);
|
| -
|
| - throwOrCancel(FailureType.CANCEL_SYNC, ResponseStep.ON_RESPONSE_STARTED, true, false);
|
| - throwOrCancel(FailureType.CANCEL_ASYNC, ResponseStep.ON_RESPONSE_STARTED, true, false);
|
| - throwOrCancel(FailureType.CANCEL_ASYNC_WITHOUT_PAUSE, ResponseStep.ON_RESPONSE_STARTED,
|
| - true, false);
|
| - throwOrCancel(FailureType.THROW_SYNC, ResponseStep.ON_RESPONSE_STARTED, true, true);
|
| -
|
| - throwOrCancel(FailureType.CANCEL_SYNC, ResponseStep.ON_READ_COMPLETED, true, false);
|
| - throwOrCancel(FailureType.CANCEL_ASYNC, ResponseStep.ON_READ_COMPLETED, true, false);
|
| - throwOrCancel(FailureType.CANCEL_ASYNC_WITHOUT_PAUSE, ResponseStep.ON_READ_COMPLETED, true,
|
| false);
|
| - throwOrCancel(FailureType.THROW_SYNC, ResponseStep.ON_READ_COMPLETED, true, true);
|
| + throwOrCancel(FailureType.THROW_SYNC, ResponseStep.ON_REQUEST_HEADERS_SENT, true);
|
| +
|
| + throwOrCancel(FailureType.CANCEL_SYNC, ResponseStep.ON_RESPONSE_STARTED, false);
|
| + throwOrCancel(FailureType.CANCEL_ASYNC, ResponseStep.ON_RESPONSE_STARTED, false);
|
| + throwOrCancel(
|
| + FailureType.CANCEL_ASYNC_WITHOUT_PAUSE, ResponseStep.ON_RESPONSE_STARTED, false);
|
| + throwOrCancel(FailureType.THROW_SYNC, ResponseStep.ON_RESPONSE_STARTED, true);
|
| +
|
| + throwOrCancel(FailureType.CANCEL_SYNC, ResponseStep.ON_READ_COMPLETED, false);
|
| + throwOrCancel(FailureType.CANCEL_ASYNC, ResponseStep.ON_READ_COMPLETED, false);
|
| + throwOrCancel(
|
| + FailureType.CANCEL_ASYNC_WITHOUT_PAUSE, ResponseStep.ON_READ_COMPLETED, false);
|
| + throwOrCancel(FailureType.THROW_SYNC, ResponseStep.ON_READ_COMPLETED, true);
|
| }
|
|
|
| @SmallTest
|
|
|