summaryrefslogtreecommitdiffstats
path: root/android_webview/unittestjava
diff options
context:
space:
mode:
authorsgurun@chromium.org <sgurun@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-22 22:22:44 +0000
committersgurun@chromium.org <sgurun@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-22 22:22:44 +0000
commit353539b10270cbd21ef9510d383f80a05e5e66dc (patch)
tree98c042942b5745f73a5fc8ea26a4c77815121079 /android_webview/unittestjava
parent756cbc945a29f68e9a42c2630c5829ec9b82e68e (diff)
downloadchromium_src-353539b10270cbd21ef9510d383f80a05e5e66dc.zip
chromium_src-353539b10270cbd21ef9510d383f80a05e5e66dc.tar.gz
chromium_src-353539b10270cbd21ef9510d383f80a05e5e66dc.tar.bz2
Add client cert support to android_webview
This CL implements client certs backend for android_webview. Most of the code path is similar to how chrome handles client certs. the callbacks are eventually plumbed to webview as APIs. We still need to answer the question that if ClientCert cache is needed at the android_webview layer. BUG=b/12983007 TBR=jcivelli@chromium.org Review URL: https://codereview.chromium.org/235563005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265380 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/unittestjava')
-rw-r--r--android_webview/unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java59
1 files changed, 59 insertions, 0 deletions
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 0000000..5c4238d
--- /dev/null
+++ b/android_webview/unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java
@@ -0,0 +1,59 @@
+// 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.android_webview.ClientCertLookupTable;
+import org.chromium.base.CalledByNative;
+import org.chromium.net.AndroidKeyStore;
+import org.chromium.net.AndroidPrivateKey;
+import org.chromium.net.DefaultAndroidKeyStore;
+
+class MockAwContentsClientBridge extends AwContentsClientBridge {
+
+ private int mId;
+ private String[] mKeyTypes;
+
+ public MockAwContentsClientBridge() {
+ super(new DefaultAndroidKeyStore(), new ClientCertLookupTable());
+ }
+
+ @Override
+ protected void selectClientCertificate(final int id, final String[] keyTypes,
+ byte[][] encodedPrincipals, final String host, final int port) {
+ mId = id;
+ mKeyTypes = keyTypes;
+ }
+
+ @CalledByNative
+ private static MockAwContentsClientBridge getAwContentsClientBridge() {
+ return new MockAwContentsClientBridge();
+ }
+
+ @CalledByNative
+ private String[] getKeyTypes() {
+ return mKeyTypes;
+ }
+
+ @CalledByNative
+ private int getRequestId() {
+ return mId;
+ }
+
+ @CalledByNative
+ private AndroidPrivateKey createTestPrivateKey() {
+ return new AndroidPrivateKey() {
+ @Override
+ public AndroidKeyStore getKeyStore() {
+ return null;
+ }
+ };
+ }
+
+ @CalledByNative
+ private byte[][] createTestCertChain() {
+ return new byte[][]{{1}};
+ }
+}