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.support.test.filters.SmallTest; | 7 import android.support.test.filters.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; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 CommonResources.makeHtmlPageWithSimplePostFormTo(pageToPostToUrl
)); | 207 CommonResources.makeHtmlPageWithSimplePostFormTo(pageToPostToUrl
)); |
208 enableJavaScriptOnUiThread(mAwContents); | 208 enableJavaScriptOnUiThread(mAwContents); |
209 | 209 |
210 int callCount = mShouldInterceptRequestHelper.getCallCount(); | 210 int callCount = mShouldInterceptRequestHelper.getCallCount(); |
211 loadUrlAsync(mAwContents, pageWithFormUrl); | 211 loadUrlAsync(mAwContents, pageWithFormUrl); |
212 mShouldInterceptRequestHelper.waitForCallback(callCount); | 212 mShouldInterceptRequestHelper.waitForCallback(callCount); |
213 assertEquals("GET", | 213 assertEquals("GET", |
214 mShouldInterceptRequestHelper.getRequestsForUrl(pageWithFormUrl)
.method); | 214 mShouldInterceptRequestHelper.getRequestsForUrl(pageWithFormUrl)
.method); |
215 | 215 |
216 callCount = mShouldInterceptRequestHelper.getCallCount(); | 216 callCount = mShouldInterceptRequestHelper.getCallCount(); |
217 JSUtils.clickOnLinkUsingJs(this, mAwContents, | 217 JSUtils.clickOnLinkUsingJs(getInstrumentation(), mAwContents, |
218 mContentsClient.getOnEvaluateJavaScriptResultHelper(), "link"); | 218 mContentsClient.getOnEvaluateJavaScriptResultHelper(), "link"); |
219 mShouldInterceptRequestHelper.waitForCallback(callCount); | 219 mShouldInterceptRequestHelper.waitForCallback(callCount); |
220 assertEquals("POST", | 220 assertEquals("POST", |
221 mShouldInterceptRequestHelper.getRequestsForUrl(pageToPostToUrl)
.method); | 221 mShouldInterceptRequestHelper.getRequestsForUrl(pageToPostToUrl)
.method); |
222 } | 222 } |
223 | 223 |
224 @SmallTest | 224 @SmallTest |
225 @Feature({"AndroidWebView"}) | 225 @Feature({"AndroidWebView"}) |
226 public void testCalledWithCorrectHasUserGestureParam() throws Throwable { | 226 public void testCalledWithCorrectHasUserGestureParam() throws Throwable { |
227 final String aboutPageUrl = addAboutPageToTestServer(mWebServer); | 227 final String aboutPageUrl = addAboutPageToTestServer(mWebServer); |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 mAwContents = mTestContainerView.getAwContents(); | 877 mAwContents = mTestContainerView.getAwContents(); |
878 loadUrlAsync(mAwContents, "http://www.example.com"); | 878 loadUrlAsync(mAwContents, "http://www.example.com"); |
879 waitForShouldInterceptRequest.await(); | 879 waitForShouldInterceptRequest.await(); |
880 // The following call will try to send an IPC and wait for a reply from
renderer. | 880 // The following call will try to send an IPC and wait for a reply from
renderer. |
881 // We do not check the actual result, because it can be bogus. The impor
tant | 881 // We do not check the actual result, because it can be bogus. The impor
tant |
882 // thing is that the call does not cause a deadlock. | 882 // thing is that the call does not cause a deadlock. |
883 executeJavaScriptAndWaitForResult(mAwContents, client, "1+1"); | 883 executeJavaScriptAndWaitForResult(mAwContents, client, "1+1"); |
884 signalAfterSendingIpc.countDown(); | 884 signalAfterSendingIpc.countDown(); |
885 } | 885 } |
886 } | 886 } |
OLD | NEW |