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; | |
10 import org.chromium.net.impl.CronetUrlRequest; | |
11 import org.json.JSONException; | 9 import org.json.JSONException; |
12 import org.json.JSONObject; | 10 import org.json.JSONObject; |
13 | 11 |
| 12 import org.chromium.base.annotations.JNINamespace; |
| 13 import org.chromium.net.impl.CronetEngineBuilderImpl; |
| 14 import org.chromium.net.impl.CronetUrlRequest; |
| 15 |
14 /** | 16 /** |
15 * Utilities for Cronet testing | 17 * Utilities for Cronet testing |
16 */ | 18 */ |
17 @JNINamespace("cronet") | 19 @JNINamespace("cronet") |
18 public class CronetTestUtil { | 20 public class CronetTestUtil { |
19 private static final ConditionVariable sHostResolverBlock = new ConditionVar
iable(); | 21 private static final ConditionVariable sHostResolverBlock = new ConditionVar
iable(); |
20 | 22 |
21 static final String SDCH_FAKE_HOST = "fake.sdch.domain"; | 23 static final String SDCH_FAKE_HOST = "fake.sdch.domain"; |
22 // QUIC test domain must match the certificate used | 24 // QUIC test domain must match the certificate used |
23 // (quic_test.example.com.crt and quic_test.example.com.key.pkcs8), and | 25 // (quic_test.example.com.crt and quic_test.example.com.key.pkcs8), and |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 60 } |
59 | 61 |
60 /** | 62 /** |
61 * Returns the value of load flags in |urlRequest|. | 63 * Returns the value of load flags in |urlRequest|. |
62 * @param urlRequest is the UrlRequest object of interest. | 64 * @param urlRequest is the UrlRequest object of interest. |
63 */ | 65 */ |
64 public static int getLoadFlags(UrlRequest urlRequest) { | 66 public static int getLoadFlags(UrlRequest urlRequest) { |
65 return nativeGetLoadFlags(((CronetUrlRequest) urlRequest).getUrlRequestA
dapterForTesting()); | 67 return nativeGetLoadFlags(((CronetUrlRequest) urlRequest).getUrlRequestA
dapterForTesting()); |
66 } | 68 } |
67 | 69 |
| 70 public static void setMockCertVerifierForTesting( |
| 71 ExperimentalCronetEngine.Builder builder, long mockCertVerifier) { |
| 72 getCronetEngineBuilderImpl(builder).setMockCertVerifierForTesting(mockCe
rtVerifier); |
| 73 } |
| 74 |
| 75 public static void setLibraryName(ExperimentalCronetEngine.Builder builder,
String libName) { |
| 76 getCronetEngineBuilderImpl(builder).setLibraryName(libName); |
| 77 } |
| 78 |
| 79 public static CronetEngineBuilderImpl getCronetEngineBuilderImpl( |
| 80 ExperimentalCronetEngine.Builder builder) { |
| 81 return (CronetEngineBuilderImpl) builder.getBuilderDelegate(); |
| 82 } |
| 83 |
68 private static native int nativeGetLoadFlags(long urlRequest); | 84 private static native int nativeGetLoadFlags(long urlRequest); |
69 } | 85 } |
OLD | NEW |