Chromium Code Reviews| Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc |
| diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
| index 27e9a466f6723d4f74c90004e9fe4eda36c6c96f..e02638429f5729ece0c1099bc228ee19e61e33fb 100644 |
| --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
| +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc |
| @@ -6815,4 +6815,29 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, StopDuringLoad) { |
| ASSERT_EQ(controller.GetPendingEntry(), nullptr); |
| } |
| +// Verify that session history navigations (back/forward) correctly hit the |
| +// cache instead of going to the server. The test loads a page with no-cache |
| +// header, stops the server, and goes back expecting succesfull navigation. |
|
Charlie Harrison
2017/03/31 19:59:28
s/succesfull/successful/
nasko
2017/03/31 20:08:46
Done.
|
| +IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
| + HistoryNavigationUsesCache) { |
| + GURL no_cache_url(embedded_test_server()->GetURL( |
| + "/navigation_controller/page_with_no_cache_header.html")); |
| + GURL regular_url(embedded_test_server()->GetURL("/title2.html")); |
| + |
| + NavigationControllerImpl& controller = static_cast<NavigationControllerImpl&>( |
|
Charlie Harrison
2017/03/31 19:59:28
Why do you need static cast to the impl? GetEntryC
nasko
2017/03/31 20:08:46
Copy/pasta : ). Fixed.
|
| + shell()->web_contents()->GetController()); |
| + |
| + EXPECT_TRUE(NavigateToURL(shell(), no_cache_url)); |
| + EXPECT_TRUE(NavigateToURL(shell(), regular_url)); |
| + EXPECT_EQ(2, controller.GetEntryCount()); |
| + |
| + EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); |
| + |
| + TestNavigationObserver back_observer(shell()->web_contents()); |
| + controller.GoBack(); |
| + back_observer.Wait(); |
| + |
| + EXPECT_TRUE(back_observer.last_navigation_succeeded()); |
| +} |
| + |
| } // namespace content |