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

Side by Side 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 1 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.android_webview.unittest;
6
7 import org.chromium.android_webview.AwContentsClientBridge;
8 import org.chromium.android_webview.ClientCertLookupTable;
9 import org.chromium.base.CalledByNative;
10 import org.chromium.net.AndroidKeyStore;
11 import org.chromium.net.AndroidPrivateKey;
12 import org.chromium.net.DefaultAndroidKeyStore;
13
14 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
15
16 private String[] mKeyTypes;
17 private boolean mEarlyOutSelectClientCertificate = false;
18
19 public MockAwContentsClientBridge() {
20 super(new DefaultAndroidKeyStore(), new ClientCertLookupTable());
21 }
22
23 @Override
24 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
25 byte[][] encodedPrincipals, final String host, final int port) {
26 if (mEarlyOutSelectClientCertificate) return false;
27 mKeyTypes = keyTypes;
28 return true;
29 }
30
31 @CalledByNative
32 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
33 return new MockAwContentsClientBridge();
34 }
35
36 @CalledByNative
37 private AndroidPrivateKey getTestPrivateKey() {
38 return new AndroidPrivateKey() {
39 @Override
40 public AndroidKeyStore getKeyStore() {
41 return null;
42 }
43 };
44 }
45
46 @CalledByNative
47 private void setEarlyOutSelectClientCertificate(boolean earlyOut) {
48 mEarlyOutSelectClientCertificate = earlyOut;
49 }
50
51 @CalledByNative
52 private String[] getKeyTypes() {
53 return mKeyTypes;
54 }
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698