| Index: components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java
|
| diff --git a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java
|
| index 6c875e1e8722eb5e64c900a22dbf2488700d8af3..d2ed2bf3de7818b48301e4a1ca9396fbe1a98ea2 100644
|
| --- a/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java
|
| +++ b/components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.java
|
| @@ -25,6 +25,9 @@ public class ChromiumUrlRequestContext {
|
| private static final int LOG_VERBOSE = -2; // LOG(FATAL...INFO), VLOG(2)
|
| static final String LOG_TAG = "ChromiumNetwork";
|
|
|
| + // For Testing.
|
| + private static long sNativeMockCertVerifier = 0;
|
| +
|
| /**
|
| * Native adapter object, owned by ChromiumUrlRequestContext.
|
| */
|
| @@ -41,6 +44,12 @@ public class ChromiumUrlRequestContext {
|
| if (mChromiumUrlRequestContextAdapter == 0) {
|
| throw new NullPointerException("Context Adapter creation failed");
|
| }
|
| +
|
| + if (sNativeMockCertVerifier != 0) {
|
| + nativeSetMockCertVerifierForTesting(
|
| + mChromiumUrlRequestContextAdapter, sNativeMockCertVerifier);
|
| + }
|
| +
|
| // Post a task to UI thread to init native Chromium URLRequestContext.
|
| // TODO(xunjieli): This constructor is not supposed to be invoked on
|
| // the main thread. Consider making the following code into a blocking
|
| @@ -137,11 +146,22 @@ public class ChromiumUrlRequestContext {
|
| return loggingLevel;
|
| }
|
|
|
| + /**
|
| + * Sets a mock cert verifier for testing.
|
| + * @param nativeMockCertVerifier a pointer to the native net::MockCertVerifier.
|
| + */
|
| + static void setMockCertVerifierForTesting(long nativeMockCertVerifier) {
|
| + sNativeMockCertVerifier = nativeMockCertVerifier;
|
| + }
|
| +
|
| // Returns an instance ChromiumUrlRequestContextAdapter to be stored in
|
| // mChromiumUrlRequestContextAdapter.
|
| private native long nativeCreateRequestContextAdapter(
|
| String userAgent, int loggingLevel, String config);
|
|
|
| + private native void nativeSetMockCertVerifierForTesting(
|
| + long chromiumUrlRequestContextAdapter, long mockCertVerifier);
|
| +
|
| private native void nativeReleaseRequestContextAdapter(
|
| long chromiumUrlRequestContextAdapter);
|
|
|
|
|