Chromium Code Reviews| 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 | 8 |
| 9 import org.chromium.base.annotations.JNINamespace; | 9 import org.chromium.base.annotations.JNINamespace; |
| 10 import org.chromium.net.impl.CronetEngineBuilderImpl; | |
| 10 import org.chromium.net.impl.CronetUrlRequest; | 11 import org.chromium.net.impl.CronetUrlRequest; |
| 11 import org.json.JSONException; | 12 import org.json.JSONException; |
| 12 import org.json.JSONObject; | 13 import org.json.JSONObject; |
| 13 | 14 |
| 14 /** | 15 /** |
| 15 * Utilities for Cronet testing | 16 * Utilities for Cronet testing |
| 16 */ | 17 */ |
| 17 @JNINamespace("cronet") | 18 @JNINamespace("cronet") |
| 18 public class CronetTestUtil { | 19 public class CronetTestUtil { |
| 19 private static final ConditionVariable sHostResolverBlock = new ConditionVar iable(); | 20 private static final ConditionVariable sHostResolverBlock = new ConditionVar iable(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 } | 59 } |
| 59 | 60 |
| 60 /** | 61 /** |
| 61 * Returns the value of load flags in |urlRequest|. | 62 * Returns the value of load flags in |urlRequest|. |
| 62 * @param urlRequest is the UrlRequest object of interest. | 63 * @param urlRequest is the UrlRequest object of interest. |
| 63 */ | 64 */ |
| 64 public static int getLoadFlags(UrlRequest urlRequest) { | 65 public static int getLoadFlags(UrlRequest urlRequest) { |
| 65 return nativeGetLoadFlags(((CronetUrlRequest) urlRequest).getUrlRequestA dapterForTesting()); | 66 return nativeGetLoadFlags(((CronetUrlRequest) urlRequest).getUrlRequestA dapterForTesting()); |
| 66 } | 67 } |
| 67 | 68 |
| 69 public static void setMockCertVerifierForTesting( | |
| 70 CronetEngine.Builder builder, long mockCertVerifier) { | |
| 71 getCronetEngineBuilderImpl(builder).setMockCertVerifierForTesting(mockCe rtVerifier); | |
| 72 } | |
| 73 | |
| 74 public static void setLibraryName(CronetEngine.Builder builder, String libNa me) { | |
| 75 getCronetEngineBuilderImpl(builder).setLibraryName(libName); | |
| 76 } | |
| 77 | |
| 78 public static CronetEngineBuilderImpl getCronetEngineBuilderImpl(CronetEngin e.Builder builder) { | |
|
pauljensen
2016/09/26 14:51:22
is this used outside this class? if not, can we m
kapishnikov
2016/09/27 18:38:26
Yes, it is used in CronetUrlRequestContextTest.
| |
| 79 return (CronetEngineBuilderImpl) builder.getBuilderDelegate(); | |
| 80 } | |
| 81 | |
| 68 private static native int nativeGetLoadFlags(long urlRequest); | 82 private static native int nativeGetLoadFlags(long urlRequest); |
| 69 } | 83 } |
| OLD | NEW |