| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.net; |
| 6 |
| 7 import org.chromium.base.annotations.JNINamespace; |
| 8 |
| 9 /** |
| 10 * A Java wrapper to supply a net::MockCertVerifier for testing. |
| 11 * The native net::MockCertVerifier should be created, owned, and destroyed |
| 12 * on the same Java thread. |
| 13 */ |
| 14 @JNINamespace("cronet") |
| 15 public class MockCertVerifier { |
| 16 private long mMockCertVerifier = 0; |
| 17 |
| 18 /** |
| 19 * Creates a native net::MockCertVerifier. |
| 20 * @param certs a String array of certs to accept in testing. |
| 21 */ |
| 22 public MockCertVerifier(String[] certs) { |
| 23 mMockCertVerifier = nativeCreateMockCertVerifier(certs); |
| 24 } |
| 25 |
| 26 /** |
| 27 * Returns the pointer to the native net::MockCertVerifier. |
| 28 */ |
| 29 public long getNativePointer() { |
| 30 return mMockCertVerifier; |
| 31 } |
| 32 |
| 33 /** |
| 34 * Destroys the native net::MockCertVerifier. |
| 35 */ |
| 36 public void destroyNativePointer() { |
| 37 mMockCertVerifier = 0; |
| 38 nativeDestroyMockCertVerifier(mMockCertVerifier); |
| 39 } |
| 40 |
| 41 private static native long nativeCreateMockCertVerifier(String[] certs); |
| 42 private static native void nativeDestroyMockCertVerifier(long mockCertVerifi
er); |
| 43 } |
| OLD | NEW |