| Index: android_webview/unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java
|
| diff --git a/android_webview/unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java b/android_webview/unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8b161cabcb544cd9da6ebdea0212fd56258a584d
|
| --- /dev/null
|
| +++ b/android_webview/unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java
|
| @@ -0,0 +1,51 @@
|
| +// Copyright 2014 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.android_webview.unittest;
|
| +
|
| +import org.chromium.android_webview.AwContentsClientBridge;
|
| +import org.chromium.base.CalledByNative;
|
| +import org.chromium.net.AndroidKeyStore;
|
| +import org.chromium.net.AndroidPrivateKey;
|
| +
|
| +class MockAwContentsClientBridge extends AwContentsClientBridge {
|
| +
|
| + private String[] mKeyTypes;
|
| + private boolean mEarlyOutSelectClientCertificate = false;
|
| +
|
| + public MockAwContentsClientBridge() { }
|
| +
|
| + @Override
|
| + protected boolean selectClientCertificate(final long nativePtr, final String[] keyTypes,
|
| + byte[][] encodedPrincipals, final String host, final int port) {
|
| + if (mEarlyOutSelectClientCertificate) return false;
|
| + mKeyTypes = keyTypes;
|
| + return true;
|
| + }
|
| +
|
| + @CalledByNative
|
| + private static MockAwContentsClientBridge getAwContentsClientBridge() {
|
| + return new MockAwContentsClientBridge();
|
| + }
|
| +
|
| + @CalledByNative
|
| + private AndroidPrivateKey getTestPrivateKey() {
|
| + return new AndroidPrivateKey() {
|
| + @Override
|
| + public AndroidKeyStore getKeyStore() {
|
| + return null;
|
| + }
|
| + };
|
| + }
|
| +
|
| + @CalledByNative
|
| + private void setEarlyOutSelectClientCertificate(boolean earlyOut) {
|
| + mEarlyOutSelectClientCertificate = earlyOut;
|
| + }
|
| +
|
| + @CalledByNative
|
| + private String[] getKeyTypes() {
|
| + return mKeyTypes;
|
| + }
|
| +}
|
|
|