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

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

Issue 1389213003: [Cronet] Use Https for Quic Test Server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ryancl
Patch Set: Address Misha's comments 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/test/src/org/chromium/net/MockCertVerifier.java
diff --git a/components/cronet/android/test/src/org/chromium/net/MockCertVerifier.java b/components/cronet/android/test/src/org/chromium/net/MockCertVerifier.java
new file mode 100644
index 0000000000000000000000000000000000000000..a9c75ba005154e2c4344e74d9c64f22605761ecb
--- /dev/null
+++ b/components/cronet/android/test/src/org/chromium/net/MockCertVerifier.java
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.net;
+
+import org.chromium.base.annotations.JNINamespace;
+
+/**
+ * A Java wrapper to supply a net::MockCertVerifier for testing.
+ * The native net::MockCertVerifier should be created, owned, and destroyed
+ * on the same Java thread.
+ */
+@JNINamespace("cronet")
+public class MockCertVerifier {
+ private long mMockCertVerifier = 0;
+
+ /**
+ * Creates a native net::MockCertVerifier.
+ * @param certs a String array of certs to accept in testing.
+ */
+ public MockCertVerifier(String[] certs) {
+ mMockCertVerifier = nativeCreateMockCertVerifier(certs);
+ }
+
+ /**
+ * Returns the pointer to the native net::MockCertVerifier.
+ */
+ public long getNativePointer() {
+ return mMockCertVerifier;
+ }
+
+ /**
+ * Destroys the native net::MockCertVerifier.
+ */
+ public void destroyNativePointer() {
+ mMockCertVerifier = 0;
+ nativeDestroyMockCertVerifier(mMockCertVerifier);
+ }
+
+ private static native long nativeCreateMockCertVerifier(String[] certs);
+ private static native void nativeDestroyMockCertVerifier(long mockCertVerifier);
+}

Powered by Google App Engine
This is Rietveld 408576698