| Index: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
|
| diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
|
| index ac9a1df2040d3aca3684f89b441c19418f852822..404ee973e67015cc9c3f953a643d28bdd183a8f9 100644
|
| --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
|
| +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java
|
| @@ -500,7 +500,7 @@ public class AwContentsTest extends AwTestBase {
|
| }
|
| }
|
|
|
| - // This is a meta test that we don't accidentally turn of hardware
|
| + // This is a meta test that we don't accidentally turn off hardware
|
| // acceleration in instrumentation tests without notice. Do not add the
|
| // @DisableHardwareAccelerationForTest annotation for this test.
|
| @Feature({"AndroidWebView"})
|
| @@ -511,4 +511,39 @@ public class AwContentsTest extends AwTestBase {
|
| assertTrue(testContainer.isHardwareAccelerated());
|
| assertTrue(testContainer.isBackedByHardwareView());
|
| }
|
| +
|
| + @Feature({"AndroidWebView"})
|
| + @SmallTest
|
| + // TODO(hush): more ssl tests. And put the ssl tests into a separate test
|
| + // class.
|
| + public void testClearSslPreferences() throws Throwable {
|
| + final AwTestContainerView testContainer =
|
| + createAwTestContainerViewOnMainSync(mContentsClient);
|
| + final AwContents awContents = testContainer.getAwContents();
|
| + TestWebServer webServer = TestWebServer.startSsl();
|
| + final String pagePath = "/hello.html";
|
| + final String pageUrl =
|
| + webServer.setResponse(pagePath, "<html><body>hello world</body></html>", null);
|
| + final CallbackHelper onReceivedSslErrorHelper =
|
| + mContentsClient.getOnReceivedSslErrorHelper();
|
| + int onSslErrorCallCount = onReceivedSslErrorHelper.getCallCount();
|
| +
|
| + loadUrlSync(awContents, mContentsClient.getOnPageFinishedHelper(), pageUrl);
|
| +
|
| + assertEquals(onSslErrorCallCount + 1, onReceivedSslErrorHelper.getCallCount());
|
| + assertEquals(1, webServer.getRequestCount(pagePath));
|
| +
|
| + // Now load the page again. This time, we expect no ssl error, because
|
| + // user's decision should be remembered.
|
| + onSslErrorCallCount = onReceivedSslErrorHelper.getCallCount();
|
| + loadUrlSync(awContents, mContentsClient.getOnPageFinishedHelper(), pageUrl);
|
| + assertEquals(onSslErrorCallCount, onReceivedSslErrorHelper.getCallCount());
|
| +
|
| + // Now clear the ssl preferences then load the same url again. Expect to see
|
| + // onReceivedSslError getting called again.
|
| + awContents.clearSslPreferences();
|
| + onSslErrorCallCount = onReceivedSslErrorHelper.getCallCount();
|
| + loadUrlSync(awContents, mContentsClient.getOnPageFinishedHelper(), pageUrl);
|
| + assertEquals(onSslErrorCallCount + 1, onReceivedSslErrorHelper.getCallCount());
|
| + }
|
| }
|
|
|