diff options
author | Brian Carlstrom <bdc@google.com> | 2011-06-02 01:05:55 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2011-06-09 05:02:00 -0700 |
commit | 8862c1dd48ac83011411c469afb5065b6d0c32f9 (patch) | |
tree | 776f54047e3eac79f85e63a6ac8c7a2aefb47de4 /tests | |
parent | 1abceb53fe52ba26ea2daffbd58934570738563c (diff) | |
download | packages_apps_Browser-8862c1dd48ac83011411c469afb5065b6d0c32f9.zip packages_apps_Browser-8862c1dd48ac83011411c469afb5065b6d0c32f9.tar.gz packages_apps_Browser-8862c1dd48ac83011411c469afb5065b6d0c32f9.tar.bz2 |
Provide Browser implementation of WebViewClient.onReceivedClientCertRequest
Following the example of onReceivedSslError, implement onReceivedClientCertRequest
ERROR CASE CLIENT CERT CASE
<... From frameworks/base ...> <... From frameworks/base ...>
Tab.SubWindowClient.onReceivedSslError Tab.SubWindowClient.onReceivedClientCertRequest
Tab.mWebViewClient.onReceivedSslError Tab.mWebViewClient.onReceivedClientCertRequest
<... ssl_warnings dialog ...> <... KeyChain.choosePrivateKeyAlias/KeyChainLookup ...>
SslErrorHandler.proceed (with SslCertLookupTable) ClientCertRequestHandler.proceed (with SslClientCertLookupTable)
<... To frameworks/base ...> <... To frameworks/base ...>
Change-Id: I3ed3789c4efc97c87ab4773cdaed3e654a1fd1e3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/browser/JNIBindingsTestApp.java | 11 | ||||
-rw-r--r-- | tests/src/com/android/browser/PopularUrlsTest.java | 11 | ||||
-rw-r--r-- | tests/src/com/android/browser/TestWebViewClient.java | 8 |
3 files changed, 30 insertions, 0 deletions
diff --git a/tests/src/com/android/browser/JNIBindingsTestApp.java b/tests/src/com/android/browser/JNIBindingsTestApp.java index f4efa2c..5d1fd0d 100644 --- a/tests/src/com/android/browser/JNIBindingsTestApp.java +++ b/tests/src/com/android/browser/JNIBindingsTestApp.java @@ -23,6 +23,7 @@ import android.os.Looper; import android.os.Message; import android.test.ActivityInstrumentationTestCase2; import android.util.Log; +import android.webkit.ClientCertRequestHandler; import android.webkit.JsPromptResult; import android.webkit.JsResult; import android.webkit.SslErrorHandler; @@ -220,6 +221,16 @@ public class JNIBindingsTestApp extends ActivityInstrumentationTestCase2<Browser handler.proceed(); } + /** + * Ignores and logs SSL client certificate requests. + */ + @Override + public void onReceivedClientCertRequest(WebView view, ClientCertRequestHandler handler, + String host_and_port) { + Log.w(TAG, "SSL client certificate request: " + host_and_port); + handler.cancel(); + } + }); } diff --git a/tests/src/com/android/browser/PopularUrlsTest.java b/tests/src/com/android/browser/PopularUrlsTest.java index a635f0b..f1ab71b 100644 --- a/tests/src/com/android/browser/PopularUrlsTest.java +++ b/tests/src/com/android/browser/PopularUrlsTest.java @@ -24,6 +24,7 @@ import android.os.Environment; import android.test.ActivityInstrumentationTestCase2; import android.text.TextUtils; import android.util.Log; +import android.webkit.ClientCertRequestHandler; import android.webkit.DownloadListener; import android.webkit.HttpAuthHandler; import android.webkit.JsPromptResult; @@ -225,6 +226,16 @@ public class PopularUrlsTest extends ActivityInstrumentationTestCase2<BrowserAct } /** + * Ignores and logs SSL client certificate requests. + */ + @Override + public void onReceivedClientCertRequest(WebView view, ClientCertRequestHandler handler, + String host_and_port) { + Log.w(TAG, "SSL client certificate request: " + host_and_port); + handler.cancel(); + } + + /** * Ignores http auth with dummy username and password */ @Override diff --git a/tests/src/com/android/browser/TestWebViewClient.java b/tests/src/com/android/browser/TestWebViewClient.java index 7159a7e..208a822 100644 --- a/tests/src/com/android/browser/TestWebViewClient.java +++ b/tests/src/com/android/browser/TestWebViewClient.java @@ -20,6 +20,7 @@ import android.graphics.Bitmap; import android.net.http.SslError; import android.os.Message; import android.view.KeyEvent; +import android.webkit.ClientCertRequestHandler; import android.webkit.HttpAuthHandler; import android.webkit.SslErrorHandler; import android.webkit.WebView; @@ -102,6 +103,13 @@ abstract class TestWebViewClient extends WebViewClient { /** {@inheritDoc} */ @Override + public void onReceivedClientCertRequest(WebView view, ClientCertRequestHandler handler, + String host_and_port) { + mWrappedClient.onReceivedClientCertRequest(view, handler, host_and_port); + } + + /** {@inheritDoc} */ + @Override public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { mWrappedClient.onReceivedHttpAuthRequest(view, handler, host, realm); |