diff options
author | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 13:54:33 +0000 |
---|---|---|
committer | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 13:54:33 +0000 |
commit | 4d34d280098220c43f219315a6cd0995f227c5f0 (patch) | |
tree | af3defcde6d802862dc4aa376d59fba0eb812e83 /android_webview/javatests | |
parent | 14b7ca55d14ee037992cd285b516419593bc3fbc (diff) | |
download | chromium_src-4d34d280098220c43f219315a6cd0995f227c5f0.zip chromium_src-4d34d280098220c43f219315a6cd0995f227c5f0.tar.gz chromium_src-4d34d280098220c43f219315a6cd0995f227c5f0.tar.bz2 |
Expose the method used for the next URLRequest redirect.
This makes it possible for URLRequest client code to determine
the method that will be used to resolve the next step in the redirect
chain.
This is to fix android_webview not doing navigation intercepting
if the result of a POST resulted in a 302 redirect.
BUG=b/9773847
TEST=AndroidWebViewTest, net_unittests
Review URL: https://chromiumcodereview.appspot.com/18429010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212027 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/javatests')
-rw-r--r-- | android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java index 09d9cbe..9f3b475 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java @@ -619,6 +619,43 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { @SmallTest @Feature({"AndroidWebView", "Navigation"}) + public void testCalledFor302AfterPostNavigations() throws Throwable { + // The reason POST requests are excluded is BUG 155250. + final TestAwContentsClient contentsClient = new TestAwContentsClient(); + final AwTestContainerView testContainerView = + createAwTestContainerViewOnMainSync(contentsClient); + final AwContents awContents = testContainerView.getAwContents(); + final TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = + contentsClient.getShouldOverrideUrlLoadingHelper(); + + final String redirectTargetUrl = createRedirectTargetPage(mWebServer); + final String postToGetRedirectUrl = mWebServer.setRedirect("/302.html", redirectTargetUrl); + final String postLinkUrl = addPageToTestServer(mWebServer, "/page_with_post_link.html", + getHtmlForPageWithSimplePostFormTo(postToGetRedirectUrl)); + + loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(), postLinkUrl); + + final int shouldOverrideUrlLoadingCallCount = + shouldOverrideUrlLoadingHelper.getCallCount(); + + clickOnLinkUsingJs(awContents, contentsClient); + + shouldOverrideUrlLoadingHelper.waitForCallback(shouldOverrideUrlLoadingCallCount); + + // Wait for the target URL to be fetched from the server. + assertTrue(CriteriaHelper.pollForCriteria(new Criteria() { + @Override + public boolean isSatisfied() { + return mWebServer.getRequestCount(REDIRECT_TARGET_PATH) == 1; + } + }, WAIT_TIMEOUT_SECONDS * 1000L, CHECK_INTERVAL)); + + assertEquals(redirectTargetUrl, + shouldOverrideUrlLoadingHelper.getShouldOverrideUrlLoadingUrl()); + } + + @SmallTest + @Feature({"AndroidWebView", "Navigation"}) public void testNotCalledForIframeHttpNavigations() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = |