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.os.ConditionVariable; | 7 import android.os.ConditionVariable; |
8 import android.os.StrictMode; | 8 import android.os.StrictMode; |
9 | 9 |
10 import static junit.framework.Assert.assertEquals; | 10 import static junit.framework.Assert.assertEquals; |
11 import static junit.framework.Assert.assertFalse; | 11 import static junit.framework.Assert.assertFalse; |
12 import static junit.framework.Assert.assertNotNull; | 12 import static junit.framework.Assert.assertNotNull; |
13 import static junit.framework.Assert.assertNull; | 13 import static junit.framework.Assert.assertNull; |
14 import static junit.framework.Assert.assertTrue; | 14 import static junit.framework.Assert.assertTrue; |
15 | 15 |
| 16 import org.chromium.net.impl.UrlRequestError; |
| 17 |
16 import java.nio.ByteBuffer; | 18 import java.nio.ByteBuffer; |
17 import java.util.ArrayList; | 19 import java.util.ArrayList; |
18 import java.util.concurrent.ExecutorService; | 20 import java.util.concurrent.ExecutorService; |
19 import java.util.concurrent.Executors; | 21 import java.util.concurrent.Executors; |
20 import java.util.concurrent.ThreadFactory; | 22 import java.util.concurrent.ThreadFactory; |
21 import java.util.concurrent.TimeUnit; | 23 import java.util.concurrent.TimeUnit; |
22 | 24 |
23 /** | 25 /** |
24 * Callback that tracks information from different callbacks and and has a | 26 * Callback that tracks information from different callbacks and and has a |
25 * method to block thread until the request completes on another thread. | 27 * method to block thread until the request completes on another thread. |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 }; | 335 }; |
334 if (mFailureType == FailureType.CANCEL_ASYNC | 336 if (mFailureType == FailureType.CANCEL_ASYNC |
335 || mFailureType == FailureType.CANCEL_ASYNC_WITHOUT_PAUSE) { | 337 || mFailureType == FailureType.CANCEL_ASYNC_WITHOUT_PAUSE) { |
336 getExecutor().execute(task); | 338 getExecutor().execute(task); |
337 } else { | 339 } else { |
338 task.run(); | 340 task.run(); |
339 } | 341 } |
340 return mFailureType != FailureType.CANCEL_ASYNC_WITHOUT_PAUSE; | 342 return mFailureType != FailureType.CANCEL_ASYNC_WITHOUT_PAUSE; |
341 } | 343 } |
342 } | 344 } |
OLD | NEW |