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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 mListener.blockForDone(); | 58 mListener.blockForDone(); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 /** | 62 /** |
63 * Listener that shutdowns the request context when request has succeeded | 63 * Listener that shutdowns the request context when request has succeeded |
64 * or failed. | 64 * or failed. |
65 */ | 65 */ |
66 class ShutdownTestUrlRequestListener extends TestUrlRequestListener { | 66 class ShutdownTestUrlRequestListener extends TestUrlRequestListener { |
67 @Override | 67 @Override |
68 public void onSucceeded(UrlRequest request, ExtendedResponseInfo info) { | 68 public void onSucceeded(UrlRequest request, UrlResponseInfo info) { |
69 super.onSucceeded(request, info); | 69 super.onSucceeded(request, info); |
70 mActivity.mCronetEngine.shutdown(); | 70 mActivity.mCronetEngine.shutdown(); |
71 } | 71 } |
72 | 72 |
73 @Override | 73 @Override |
74 public void onFailed(UrlRequest request, | 74 public void onFailed(UrlRequest request, UrlResponseInfo info, UrlReques
tException error) { |
75 ResponseInfo info, | |
76 UrlRequestException error) { | |
77 super.onFailed(request, info, error); | 75 super.onFailed(request, info, error); |
78 mActivity.mCronetEngine.shutdown(); | 76 mActivity.mCronetEngine.shutdown(); |
79 } | 77 } |
80 } | 78 } |
81 | 79 |
82 @SmallTest | 80 @SmallTest |
83 @Feature({"Cronet"}) | 81 @Feature({"Cronet"}) |
84 public void testConfigUserAgent() throws Exception { | 82 public void testConfigUserAgent() throws Exception { |
85 String userAgentName = "User-Agent"; | 83 String userAgentName = "User-Agent"; |
86 String userAgentValue = "User-Agent-Value"; | 84 String userAgentValue = "User-Agent-Value"; |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 new CronetUrlRequestContext(mActivity.createCronetEngineBuilder(
mActivity)); | 660 new CronetUrlRequestContext(mActivity.createCronetEngineBuilder(
mActivity)); |
663 CronetEngine secondEngine = new CronetUrlRequestContext( | 661 CronetEngine secondEngine = new CronetUrlRequestContext( |
664 mActivity.createCronetEngineBuilder(mActivity.getApplicationCont
ext())); | 662 mActivity.createCronetEngineBuilder(mActivity.getApplicationCont
ext())); |
665 CronetEngine thirdEngine = new CronetUrlRequestContext( | 663 CronetEngine thirdEngine = new CronetUrlRequestContext( |
666 mActivity.createCronetEngineBuilder(new ContextWrapper(mActivity
))); | 664 mActivity.createCronetEngineBuilder(new ContextWrapper(mActivity
))); |
667 firstEngine.shutdown(); | 665 firstEngine.shutdown(); |
668 secondEngine.shutdown(); | 666 secondEngine.shutdown(); |
669 thirdEngine.shutdown(); | 667 thirdEngine.shutdown(); |
670 } | 668 } |
671 } | 669 } |
OLD | NEW |