Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Unified Diff: components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java

Issue 1389213003: [Cronet] Use Https for Quic Test Server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ryancl
Patch Set: Adopt suggestion Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java
diff --git a/components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java b/components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java
index 7cdabde2cbeedb1146889c530901f0ca1fa571b8..ee63223cad66d172a03f14b356e50edb8f77757c 100644
--- a/components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java
+++ b/components/cronet/android/java/src/org/chromium/net/CronetUrlRequestContext.java
@@ -35,6 +35,9 @@ class CronetUrlRequestContext extends CronetEngine {
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;
+
/**
* Synchronize access to mUrlRequestContextAdapter and shutdown routine.
*/
@@ -70,6 +73,10 @@ class CronetUrlRequestContext extends CronetEngine {
throw new NullPointerException("Context Adapter creation failed.");
}
+ if (sNativeMockCertVerifier != 0) {
+ nativeSetMockCertVerifierForTesting(mUrlRequestContextAdapter, sNativeMockCertVerifier);
mef 2015/10/12 18:27:13 Would it make sense to have a 'SetMockCertVerifier
xunjieli 2015/10/13 01:58:02 Great idea! Didn't realize we can serialize a nati
+ }
+
// Init native Chromium URLRequestContext on main UI thread.
Runnable task = new Runnable() {
@Override
@@ -357,12 +364,24 @@ class CronetUrlRequestContext extends CronetEngine {
}
}
+ /**
+ * Sets a mock cert verifier for testing.
+ * @param nativeMockCertVerifier a pointer to the native net::MockCertVerifier.
+ */
+ static void setMockCertVerifierForTesting(long nativeMockCertVerifier) {
+ sNativeMockCertVerifier = nativeMockCertVerifier;
+ }
+
// Native methods are implemented in cronet_url_request_context.cc.
private static native long nativeCreateRequestContextAdapter(String config);
private static native int nativeSetMinLogLevel(int loggingLevel);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")
+ private static native void nativeSetMockCertVerifierForTesting(
+ long nativePtr, long mockCertVerifier);
+
+ @NativeClassQualifiedName("CronetURLRequestContextAdapter")
private native void nativeDestroy(long nativePtr);
@NativeClassQualifiedName("CronetURLRequestContextAdapter")

Powered by Google App Engine
This is Rietveld 408576698