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

Unified Diff: android_webview/unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java

Issue 235563005: Add client cert support to android_webview (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: code review phase 3 Created 6 years, 8 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: 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..5c4238d624ec2eef6bc09d77aefc7a6f88bd7184
--- /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}};
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698