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

Unified Diff: components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequestContext.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/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);

Powered by Google App Engine
This is Rietveld 408576698