@SmallTest @Feature({"AndroidWebView"}) public void testDoesNotChangeReportedUrl() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); final TestAwContentsClient.ShouldInterceptRequestHelper shouldInterceptRequestHelper = contentsClient.getShouldInterceptRequestHelper(); shouldInterceptRequestHelper.setReturnValue( stringToInterceptedRequestData(makePageWithTitle("some title"))); final String aboutPageUrl = addAboutPageToTestServer(mWebServer); loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(), aboutPageUrl); assertEquals(aboutPageUrl, contentsClient.getOnPageFinishedHelper().getUrl()); assertEquals(aboutPageUrl, contentsClient.getOnPageStartedHelper().getUrl()); }
@SmallTest @Feature({"AndroidWebView", "Navigation"}) public void testCalledBeforeOnPageStarted() throws Throwable { standardSetup(); OnPageStartedHelper onPageStartedHelper = mContentsClient.getOnPageStartedHelper(); loadDataSync( mAwContents, mContentsClient.getOnPageFinishedHelper(), CommonResources.makeHtmlPageWithSimpleLinkTo(DATA_URL), "text/html", false); final int shouldOverrideUrlLoadingCallCount = mShouldOverrideUrlLoadingHelper.getCallCount(); final int onPageStartedCallCount = onPageStartedHelper.getCallCount(); setShouldOverrideUrlLoadingReturnValueOnUiThread(true); clickOnLinkUsingJs(); mShouldOverrideUrlLoadingHelper.waitForCallback(shouldOverrideUrlLoadingCallCount); assertEquals(onPageStartedCallCount, onPageStartedHelper.getCallCount()); }