/* @SmallTest @Feature({"AndroidWebView", "Navigation"}) */ @DisabledTest public void testResend() throws Throwable { mContentsClient.setResubmit(true); doReload(); assertEquals(1, mContentsClient.getResubmissions()); assertEquals("Reload", getTitleOnUiThread(mAwContents)); }
protected void doReload() throws Throwable { String url = mServer.setResponse("/form", LOAD_RESPONSE, null); String postData = "content=blabla"; byte[] data = EncodingUtils.getBytes(postData, "BASE64"); postUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), url, data); assertEquals(0, mContentsClient.getResubmissions()); assertEquals("Load", getTitleOnUiThread(mAwContents)); // Verify reload works as expected. mServer.setResponse("/form", RELOAD_RESPONSE, null); TestCallbackHelperContainer.OnPageFinishedHelper onPageFinishedHelper = mContentsClient.getOnPageFinishedHelper(); int callCount = onPageFinishedHelper.getCallCount(); // Run reload on UI thread. getInstrumentation() .runOnMainSync( new Runnable() { @Override public void run() { mAwContents.getContentViewCore().reload(true); } }); try { // Wait for page finished callback, or a timeout. A timeout is necessary // to detect a dontResend response. onPageFinishedHelper.waitForCallback(callCount, 1, TIMEOUT, TimeUnit.SECONDS); } catch (TimeoutException e) { } }
@SmallTest @Feature({"AndroidWebView", "Navigation"}) public void testDontResend() throws Throwable { mContentsClient.setResubmit(false); doReload(); assertEquals(1, mContentsClient.getResubmissions()); assertEquals("Load", getTitleOnUiThread(mAwContents)); }