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..4b27a07a6bbaa7170ce93b7dd639c34b2b26e5ca |
--- /dev/null |
+++ b/android_webview/unittestjava/src/org/chromium/android_webview/unittest/MockAwContentsClientBridge.java |
@@ -0,0 +1,55 @@ |
+// 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 { |
boliu
2014/04/16 02:57:46
Does this compile? Doesn't the class need to be pu
sgurun-gerrit only
2014/04/17 15:10:51
Of course it does. A class not declared public can
|
+ |
+ private String[] mKeyTypes; |
+ private boolean mEarlyOutSelectClientCertificate = false; |
+ |
+ public MockAwContentsClientBridge() { |
+ super(new DefaultAndroidKeyStore(), new ClientCertLookupTable()); |
+ } |
+ |
+ @Override |
+ protected boolean selectClientCertificate(final long nativePtr, final String[] keyTypes, |
boliu
2014/04/16 02:57:46
Hmm, interesting question, can you override a priv
sgurun-gerrit only
2014/04/17 15:10:51
1. you cannot override a private method since its
|
+ byte[][] encodedPrincipals, final String host, final int port) { |
+ if (mEarlyOutSelectClientCertificate) return false; |
+ mKeyTypes = keyTypes; |
+ return true; |
+ } |
+ |
+ @CalledByNative |
+ private static MockAwContentsClientBridge getAwContentsClientBridge() { |
boliu
2014/04/16 02:57:46
s/get/create/
sgurun-gerrit only
2014/04/18 01:44:55
Done.
boliu
2014/04/18 17:10:12
Not done?
sgurun-gerrit only
2014/04/19 01:28:49
forgot uploading the patch that has it.
On 2014/04
|
+ 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; |
+ } |
+} |