Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2850)

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java

Issue 1161783005: [Android WebView] Send WebChromeClient.onReceivedTitle when navigating back (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed typo Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java
index 5a8c75d0d588578f8a34dac518b8dd668931dac2..f8a97e64543c69043d7873adcad0743c27d82fdc 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java
@@ -320,4 +320,34 @@ public class NavigationHistoryTest extends AwTestBase {
}
});
}
+
+ // See http://crbug.com/481570
+ @SmallTest
+ public void testTitleUpdatedWhenGoingBack() throws Throwable {
+ final TestCallbackHelperContainer.OnPageFinishedHelper onPageFinishedHelper =
+ mContentsClient.getOnPageFinishedHelper();
+ NavigationHistory list = getNavigationHistory(mAwContents);
+ assertEquals(0, list.getEntryCount());
+
+ final String page1Url = addPage1ToServer(mWebServer);
+ final String page2Url = addPage2ToServer(mWebServer);
+
+ TestAwContentsClient.OnReceivedTitleHelper onReceivedTitleHelper =
+ mContentsClient.getOnReceivedTitleHelper();
+ // It would be unreliable to retrieve the call count after the first loadUrlSync,
+ // as it is not synchronous with respect to updating the title. Instead, we capture
+ // the initial call count (zero?) here, and keep waiting until we receive the update
+ // from the second page load.
+ int onReceivedTitleCallCount = onReceivedTitleHelper.getCallCount();
+ loadUrlSync(mAwContents, onPageFinishedHelper, page1Url);
+ loadUrlSync(mAwContents, onPageFinishedHelper, page2Url);
+ do {
+ onReceivedTitleHelper.waitForCallback(onReceivedTitleCallCount);
+ onReceivedTitleCallCount = onReceivedTitleHelper.getCallCount();
+ } while(!PAGE_2_TITLE.equals(onReceivedTitleHelper.getTitle()));
+ HistoryUtils.goBackSync(getInstrumentation(), mAwContents.getWebContents(),
+ onPageFinishedHelper);
+ onReceivedTitleHelper.waitForCallback(onReceivedTitleCallCount);
+ assertEquals(PAGE_1_TITLE, onReceivedTitleHelper.getTitle());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698