コード例 #1
0
 /*
 @SmallTest
 @Feature({"AndroidWebView", "Navigation"})
 */
 @DisabledTest
 public void testResend() throws Throwable {
   mContentsClient.setResubmit(true);
   doReload();
   assertEquals(1, mContentsClient.getResubmissions());
   assertEquals("Reload", getTitleOnUiThread(mAwContents));
 }
コード例 #2
0
 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) {
   }
 }
コード例 #3
0
 @SmallTest
 @Feature({"AndroidWebView", "Navigation"})
 public void testDontResend() throws Throwable {
   mContentsClient.setResubmit(false);
   doReload();
   assertEquals(1, mContentsClient.getResubmissions());
   assertEquals("Load", getTitleOnUiThread(mAwContents));
 }