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 android.os.ConditionVariable; | 7 import android.os.ConditionVariable; |
8 | 8 |
9 import static junit.framework.Assert.assertEquals; | 9 import static junit.framework.Assert.assertEquals; |
10 import static junit.framework.Assert.assertFalse; | 10 import static junit.framework.Assert.assertFalse; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 | 212 |
213 @Override | 213 @Override |
214 public void onResponseTrailersReceived(BidirectionalStream stream, UrlRespon
seInfo info, | 214 public void onResponseTrailersReceived(BidirectionalStream stream, UrlRespon
seInfo info, |
215 UrlResponseInfo.HeaderBlock trailers) { | 215 UrlResponseInfo.HeaderBlock trailers) { |
216 assertEquals(mExecutorThread, Thread.currentThread()); | 216 assertEquals(mExecutorThread, Thread.currentThread()); |
217 assertFalse(stream.isDone()); | 217 assertFalse(stream.isDone()); |
218 assertNull(mError); | 218 assertNull(mError); |
219 mResponseStep = ResponseStep.ON_TRAILERS; | 219 mResponseStep = ResponseStep.ON_TRAILERS; |
220 mTrailers = trailers; | 220 mTrailers = trailers; |
| 221 assertTrue(mTrailers != null); |
221 if (maybeThrowCancelOrPause(stream, mReadStepBlock)) { | 222 if (maybeThrowCancelOrPause(stream, mReadStepBlock)) { |
222 return; | 223 return; |
223 } | 224 } |
224 } | 225 } |
225 | 226 |
226 @Override | 227 @Override |
227 public void onSucceeded(BidirectionalStream stream, UrlResponseInfo info) { | 228 public void onSucceeded(BidirectionalStream stream, UrlResponseInfo info) { |
228 assertEquals(mExecutorThread, Thread.currentThread()); | 229 assertEquals(mExecutorThread, Thread.currentThread()); |
229 assertTrue(stream.isDone()); | 230 assertTrue(stream.isDone()); |
230 assertTrue(mResponseStep == ResponseStep.ON_RESPONSE_STARTED | 231 assertTrue(mResponseStep == ResponseStep.ON_RESPONSE_STARTED |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 }; | 326 }; |
326 if (mFailureType == FailureType.CANCEL_ASYNC | 327 if (mFailureType == FailureType.CANCEL_ASYNC |
327 || mFailureType == FailureType.CANCEL_ASYNC_WITHOUT_PAUSE) { | 328 || mFailureType == FailureType.CANCEL_ASYNC_WITHOUT_PAUSE) { |
328 getExecutor().execute(task); | 329 getExecutor().execute(task); |
329 } else { | 330 } else { |
330 task.run(); | 331 task.run(); |
331 } | 332 } |
332 return mFailureType != FailureType.CANCEL_ASYNC_WITHOUT_PAUSE; | 333 return mFailureType != FailureType.CANCEL_ASYNC_WITHOUT_PAUSE; |
333 } | 334 } |
334 } | 335 } |
OLD | NEW |