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

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: revert unintended file addition 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..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;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698