Chromium Code Reviews| 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..44e82865f9b21fcdf1435192b979410ada457738 |
| --- /dev/null |
| +++ b/components/cronet/android/test/src/org/chromium/net/MockCertVerifier.java |
| @@ -0,0 +1,28 @@ |
| +// 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 which can be then passed |
| + * into {@link CronetEngine.Builder#setMockCertVerifierForTesting}. |
| + * The native pointer will be freed when the CronetEngine is torn down. |
| + */ |
| +@JNINamespace("cronet") |
| +public class MockCertVerifier { |
| + private MockCertVerifier() {} |
|
mef
2015/10/20 20:43:34
Maybe constructor should call nativeCreateMockCert
xunjieli
2015/10/20 20:57:26
I had that initially, but Paul suggested using a s
|
| + |
| + /** |
| + * Creates a new net::MockCertVerifier, and returns a pointer to it. |
| + * @param certs a String array of certificate filenames in |
| + * net::GetTestCertsDirectory() to accept in testing. |
| + */ |
| + public static long getNativePointer(String[] certs) { |
|
mef
2015/10/20 20:43:34
Given that native cert verifier is not a singleton
xunjieli
2015/10/20 20:57:26
Done. createMockCertVerifier sgtm. Agreed, the get
|
| + return nativeCreateMockCertVerifier(certs); |
| + } |
| + |
| + private static native long nativeCreateMockCertVerifier(String[] certs); |
| +} |