| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.android_webview.unittest; | 5 package org.chromium.android_webview.unittest; |
| 6 | 6 |
| 7 import org.chromium.android_webview.AwContentsClientBridge; | 7 import org.chromium.android_webview.AwContentsClientBridge; |
| 8 import org.chromium.android_webview.ClientCertLookupTable; | 8 import org.chromium.android_webview.ClientCertLookupTable; |
| 9 import org.chromium.base.annotations.CalledByNative; | 9 import org.chromium.base.annotations.CalledByNative; |
| 10 import org.chromium.net.AndroidKeyStore; | |
| 11 import org.chromium.net.AndroidPrivateKey; | |
| 12 import org.chromium.net.DefaultAndroidKeyStore; | |
| 13 | 10 |
| 14 class MockAwContentsClientBridge extends AwContentsClientBridge { | 11 class MockAwContentsClientBridge extends AwContentsClientBridge { |
| 15 | 12 |
| 16 private int mId; | 13 private int mId; |
| 17 private String[] mKeyTypes; | 14 private String[] mKeyTypes; |
| 18 | 15 |
| 19 public MockAwContentsClientBridge() { | 16 public MockAwContentsClientBridge() { |
| 20 super(new DefaultAndroidKeyStore(), new ClientCertLookupTable()); | 17 super(new ClientCertLookupTable()); |
| 21 } | 18 } |
| 22 | 19 |
| 23 @Override | 20 @Override |
| 24 protected void selectClientCertificate(final int id, final String[] keyTypes
, | 21 protected void selectClientCertificate(final int id, final String[] keyTypes
, |
| 25 byte[][] encodedPrincipals, final String host, final int port) { | 22 byte[][] encodedPrincipals, final String host, final int port) { |
| 26 mId = id; | 23 mId = id; |
| 27 mKeyTypes = keyTypes; | 24 mKeyTypes = keyTypes; |
| 28 } | 25 } |
| 29 | 26 |
| 30 @CalledByNative | 27 @CalledByNative |
| 31 private static MockAwContentsClientBridge getAwContentsClientBridge() { | 28 private static MockAwContentsClientBridge getAwContentsClientBridge() { |
| 32 return new MockAwContentsClientBridge(); | 29 return new MockAwContentsClientBridge(); |
| 33 } | 30 } |
| 34 | 31 |
| 35 @CalledByNative | 32 @CalledByNative |
| 36 private String[] getKeyTypes() { | 33 private String[] getKeyTypes() { |
| 37 return mKeyTypes; | 34 return mKeyTypes; |
| 38 } | 35 } |
| 39 | 36 |
| 40 @CalledByNative | 37 @CalledByNative |
| 41 private int getRequestId() { | 38 private int getRequestId() { |
| 42 return mId; | 39 return mId; |
| 43 } | 40 } |
| 44 | 41 |
| 45 @CalledByNative | 42 @CalledByNative |
| 46 private AndroidPrivateKey createTestPrivateKey() { | |
| 47 return new AndroidPrivateKey() { | |
| 48 @Override | |
| 49 public AndroidKeyStore getKeyStore() { | |
| 50 return null; | |
| 51 } | |
| 52 }; | |
| 53 } | |
| 54 | |
| 55 @CalledByNative | |
| 56 private byte[][] createTestCertChain() { | 43 private byte[][] createTestCertChain() { |
| 57 return new byte[][]{{1}}; | 44 return new byte[][]{{1}}; |
| 58 } | 45 } |
| 59 } | 46 } |
| OLD | NEW |