| 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.content.Context; | 7 import android.content.Context; |
| 8 import android.content.ContextWrapper; | 8 import android.content.ContextWrapper; |
| 9 import android.os.ConditionVariable; | 9 import android.os.ConditionVariable; |
| 10 import android.os.Handler; | 10 import android.os.Handler; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 mListener.blockForDone(); | 61 mListener.blockForDone(); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 /** | 65 /** |
| 66 * Listener that shutdowns the request context when request has succeeded | 66 * Listener that shutdowns the request context when request has succeeded |
| 67 * or failed. | 67 * or failed. |
| 68 */ | 68 */ |
| 69 class ShutdownTestUrlRequestListener extends TestUrlRequestListener { | 69 class ShutdownTestUrlRequestListener extends TestUrlRequestListener { |
| 70 @Override | 70 @Override |
| 71 public void onSucceeded(UrlRequest request, ExtendedResponseInfo info) { | 71 public void onSucceeded(UrlRequest request, UrlResponseInfo info) { |
| 72 super.onSucceeded(request, info); | 72 super.onSucceeded(request, info); |
| 73 mActivity.mCronetEngine.shutdown(); | 73 mActivity.mCronetEngine.shutdown(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 @Override | 76 @Override |
| 77 public void onFailed(UrlRequest request, | 77 public void onFailed(UrlRequest request, UrlResponseInfo info, UrlReques
tException error) { |
| 78 ResponseInfo info, | |
| 79 UrlRequestException error) { | |
| 80 super.onFailed(request, info, error); | 78 super.onFailed(request, info, error); |
| 81 mActivity.mCronetEngine.shutdown(); | 79 mActivity.mCronetEngine.shutdown(); |
| 82 } | 80 } |
| 83 } | 81 } |
| 84 | 82 |
| 85 static class TestExecutor implements Executor { | 83 static class TestExecutor implements Executor { |
| 86 private final LinkedList<Runnable> mTaskQueue = new LinkedList<Runnable>
(); | 84 private final LinkedList<Runnable> mTaskQueue = new LinkedList<Runnable>
(); |
| 87 | 85 |
| 88 @Override | 86 @Override |
| 89 public void execute(Runnable task) { | 87 public void execute(Runnable task) { |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 new CronetUrlRequestContext(mActivity.createCronetEngineBuilder(
mActivity)); | 770 new CronetUrlRequestContext(mActivity.createCronetEngineBuilder(
mActivity)); |
| 773 CronetEngine secondEngine = new CronetUrlRequestContext( | 771 CronetEngine secondEngine = new CronetUrlRequestContext( |
| 774 mActivity.createCronetEngineBuilder(mActivity.getApplicationCont
ext())); | 772 mActivity.createCronetEngineBuilder(mActivity.getApplicationCont
ext())); |
| 775 CronetEngine thirdEngine = new CronetUrlRequestContext( | 773 CronetEngine thirdEngine = new CronetUrlRequestContext( |
| 776 mActivity.createCronetEngineBuilder(new ContextWrapper(mActivity
))); | 774 mActivity.createCronetEngineBuilder(new ContextWrapper(mActivity
))); |
| 777 firstEngine.shutdown(); | 775 firstEngine.shutdown(); |
| 778 secondEngine.shutdown(); | 776 secondEngine.shutdown(); |
| 779 thirdEngine.shutdown(); | 777 thirdEngine.shutdown(); |
| 780 } | 778 } |
| 781 } | 779 } |
| OLD | NEW |