| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.test; | 5 package org.chromium.android_webview.test; |
| 6 | 6 |
| 7 import android.test.suitebuilder.annotation.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; |
| 8 import android.util.Pair; | 8 import android.util.Pair; |
| 9 | 9 |
| 10 import org.chromium.android_webview.AwContents; | 10 import org.chromium.android_webview.AwContents; |
| 11 import org.chromium.android_webview.AwWebResourceResponse; | 11 import org.chromium.android_webview.AwWebResourceResponse; |
| 12 import org.chromium.android_webview.test.util.AwTestTouchUtils; | 12 import org.chromium.android_webview.test.util.AwTestTouchUtils; |
| 13 import org.chromium.android_webview.test.util.CommonResources; | 13 import org.chromium.android_webview.test.util.CommonResources; |
| 14 import org.chromium.android_webview.test.util.JSUtils; | 14 import org.chromium.android_webview.test.util.JSUtils; |
| 15 import org.chromium.base.test.util.Feature; | 15 import org.chromium.base.test.util.Feature; |
| 16 import org.chromium.base.test.util.TestFileUtil; | 16 import org.chromium.base.test.util.TestFileUtil; |
| 17 import org.chromium.base.test.util.parameter.ParameterizedTest; |
| 17 import org.chromium.content.browser.test.util.CallbackHelper; | 18 import org.chromium.content.browser.test.util.CallbackHelper; |
| 18 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnRece
ivedErrorHelper; | 19 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnRece
ivedErrorHelper; |
| 19 import org.chromium.net.test.util.TestWebServer; | 20 import org.chromium.net.test.util.TestWebServer; |
| 20 | 21 |
| 21 import java.io.ByteArrayInputStream; | 22 import java.io.ByteArrayInputStream; |
| 22 import java.io.IOException; | 23 import java.io.IOException; |
| 23 import java.io.InputStream; | 24 import java.io.InputStream; |
| 24 import java.util.ArrayList; | 25 import java.util.ArrayList; |
| 25 import java.util.HashMap; | 26 import java.util.HashMap; |
| 26 import java.util.List; | 27 import java.util.List; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 callCount = mShouldInterceptRequestHelper.getCallCount(); | 217 callCount = mShouldInterceptRequestHelper.getCallCount(); |
| 217 JSUtils.clickOnLinkUsingJs(this, mAwContents, | 218 JSUtils.clickOnLinkUsingJs(this, mAwContents, |
| 218 mContentsClient.getOnEvaluateJavaScriptResultHelper(), "link"); | 219 mContentsClient.getOnEvaluateJavaScriptResultHelper(), "link"); |
| 219 mShouldInterceptRequestHelper.waitForCallback(callCount); | 220 mShouldInterceptRequestHelper.waitForCallback(callCount); |
| 220 assertEquals("POST", | 221 assertEquals("POST", |
| 221 mShouldInterceptRequestHelper.getRequestsForUrl(pageToPostToUrl)
.method); | 222 mShouldInterceptRequestHelper.getRequestsForUrl(pageToPostToUrl)
.method); |
| 222 } | 223 } |
| 223 | 224 |
| 224 @SmallTest | 225 @SmallTest |
| 225 @Feature({"AndroidWebView"}) | 226 @Feature({"AndroidWebView"}) |
| 227 // Run in single-process mode only. Blocked by software draws support crbug.
com/545611. |
| 228 @ParameterizedTest.Set |
| 226 public void testCalledWithCorrectHasUserGestureParam() throws Throwable { | 229 public void testCalledWithCorrectHasUserGestureParam() throws Throwable { |
| 227 final String aboutPageUrl = addAboutPageToTestServer(mWebServer); | 230 final String aboutPageUrl = addAboutPageToTestServer(mWebServer); |
| 228 final String pageWithLinkUrl = addPageToTestServer(mWebServer, "/page_wi
th_link.html", | 231 final String pageWithLinkUrl = addPageToTestServer(mWebServer, "/page_wi
th_link.html", |
| 229 CommonResources.makeHtmlPageWithSimpleLinkTo(aboutPageUrl)); | 232 CommonResources.makeHtmlPageWithSimpleLinkTo(aboutPageUrl)); |
| 230 enableJavaScriptOnUiThread(mAwContents); | 233 enableJavaScriptOnUiThread(mAwContents); |
| 231 | 234 |
| 232 int callCount = mShouldInterceptRequestHelper.getCallCount(); | 235 int callCount = mShouldInterceptRequestHelper.getCallCount(); |
| 233 loadUrlAsync(mAwContents, pageWithLinkUrl); | 236 loadUrlAsync(mAwContents, pageWithLinkUrl); |
| 234 mShouldInterceptRequestHelper.waitForCallback(callCount); | 237 mShouldInterceptRequestHelper.waitForCallback(callCount); |
| 235 assertEquals(false, | 238 assertEquals(false, |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 mAwContents = mTestContainerView.getAwContents(); | 872 mAwContents = mTestContainerView.getAwContents(); |
| 870 loadUrlAsync(mAwContents, "http://www.example.com"); | 873 loadUrlAsync(mAwContents, "http://www.example.com"); |
| 871 waitForShouldInterceptRequest.await(); | 874 waitForShouldInterceptRequest.await(); |
| 872 // The following call will try to send an IPC and wait for a reply from
renderer. | 875 // The following call will try to send an IPC and wait for a reply from
renderer. |
| 873 // We do not check the actual result, because it can be bogus. The impor
tant | 876 // We do not check the actual result, because it can be bogus. The impor
tant |
| 874 // thing is that the call does not cause a deadlock. | 877 // thing is that the call does not cause a deadlock. |
| 875 executeJavaScriptAndWaitForResult(mAwContents, client, "1+1"); | 878 executeJavaScriptAndWaitForResult(mAwContents, client, "1+1"); |
| 876 signalAfterSendingIpc.countDown(); | 879 signalAfterSendingIpc.countDown(); |
| 877 } | 880 } |
| 878 } | 881 } |
| OLD | NEW |