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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_unittest.cc

Issue 483773002: PlzNavigate: implement CommitNavigation on the browser side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using non-inherited structs Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "content/browser/frame_host/cross_site_transferring_request.h" 9 #include "content/browser/frame_host/cross_site_transferring_request.h"
10 #include "content/browser/frame_host/navigation_before_commit_info.h" 10 #include "content/browser/frame_host/navigation_before_commit_info.h"
11 #include "content/browser/frame_host/navigation_controller_impl.h" 11 #include "content/browser/frame_host/navigation_controller_impl.h"
12 #include "content/browser/frame_host/navigation_entry_impl.h" 12 #include "content/browser/frame_host/navigation_entry_impl.h"
13 #include "content/browser/frame_host/navigation_request.h" 13 #include "content/browser/frame_host/navigation_request.h"
14 #include "content/browser/frame_host/navigator.h" 14 #include "content/browser/frame_host/navigator.h"
15 #include "content/browser/frame_host/navigator_impl.h" 15 #include "content/browser/frame_host/navigator_impl.h"
16 #include "content/browser/frame_host/render_frame_host_manager.h" 16 #include "content/browser/frame_host/render_frame_host_manager.h"
17 #include "content/browser/site_instance_impl.h" 17 #include "content/browser/site_instance_impl.h"
18 #include "content/browser/webui/web_ui_controller_factory_registry.h" 18 #include "content/browser/webui/web_ui_controller_factory_registry.h"
19 #include "content/common/navigation_params.h"
19 #include "content/common/view_messages.h" 20 #include "content/common/view_messages.h"
20 #include "content/public/browser/notification_details.h" 21 #include "content/public/browser/notification_details.h"
21 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/notification_source.h" 23 #include "content/public/browser/notification_source.h"
23 #include "content/public/browser/notification_types.h" 24 #include "content/public/browser/notification_types.h"
24 #include "content/public/browser/render_process_host.h" 25 #include "content/public/browser/render_process_host.h"
25 #include "content/public/browser/render_widget_host_iterator.h" 26 #include "content/public/browser/render_widget_host_iterator.h"
26 #include "content/public/browser/web_contents_delegate.h" 27 #include "content/public/browser/web_contents_delegate.h"
27 #include "content/public/browser/web_contents_observer.h" 28 #include "content/public/browser/web_contents_observer.h"
28 #include "content/public/browser/web_ui_controller.h" 29 #include "content/public/browser/web_ui_controller.h"
29 #include "content/public/common/bindings_policy.h" 30 #include "content/public/common/bindings_policy.h"
30 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
31 #include "content/public/common/javascript_message_type.h" 32 #include "content/public/common/javascript_message_type.h"
32 #include "content/public/common/page_transition_types.h" 33 #include "content/public/common/page_transition_types.h"
33 #include "content/public/common/url_constants.h" 34 #include "content/public/common/url_constants.h"
34 #include "content/public/common/url_utils.h" 35 #include "content/public/common/url_utils.h"
35 #include "content/public/test/mock_render_process_host.h" 36 #include "content/public/test/mock_render_process_host.h"
36 #include "content/public/test/test_notification_tracker.h" 37 #include "content/public/test/test_notification_tracker.h"
37 #include "content/test/test_content_browser_client.h" 38 #include "content/test/test_content_browser_client.h"
38 #include "content/test/test_content_client.h" 39 #include "content/test/test_content_client.h"
39 #include "content/test/test_render_frame_host.h" 40 #include "content/test/test_render_frame_host.h"
40 #include "content/test/test_render_view_host.h" 41 #include "content/test/test_render_view_host.h"
41 #include "content/test/test_web_contents.h" 42 #include "content/test/test_web_contents.h"
43 #include "net/base/load_flags.h"
42 #include "testing/gtest/include/gtest/gtest.h" 44 #include "testing/gtest/include/gtest/gtest.h"
43 45
44 namespace content { 46 namespace content {
45 namespace { 47 namespace {
46 48
47 class RenderFrameHostManagerTestWebUIControllerFactory 49 class RenderFrameHostManagerTestWebUIControllerFactory
48 : public WebUIControllerFactory { 50 : public WebUIControllerFactory {
49 public: 51 public:
50 RenderFrameHostManagerTestWebUIControllerFactory() 52 RenderFrameHostManagerTestWebUIControllerFactory()
51 : should_create_webui_(false) { 53 : should_create_webui_(false) {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 382
381 NavigationRequest* GetNavigationRequestForRenderFrameManager( 383 NavigationRequest* GetNavigationRequestForRenderFrameManager(
382 RenderFrameHostManager* manager) const { 384 RenderFrameHostManager* manager) const {
383 return manager->navigation_request_for_testing(); 385 return manager->navigation_request_for_testing();
384 } 386 }
385 387
386 void EnableBrowserSideNavigation() { 388 void EnableBrowserSideNavigation() {
387 CommandLine::ForCurrentProcess()->AppendSwitch( 389 CommandLine::ForCurrentProcess()->AppendSwitch(
388 switches::kEnableBrowserSideNavigation); 390 switches::kEnableBrowserSideNavigation);
389 } 391 }
392
393 void SendRequestNavigation(const GURL& url,
394 FrameTreeNode* node) {
Charlie Reis 2014/09/19 23:12:32 nit: Wrong indent.
clamy 2014/09/23 21:13:26 Done.
395 SendRequestNavigationWithParameters(
396 url, node, Referrer(), PAGE_TRANSITION_LINK,
397 NavigationController::NO_RELOAD);
398 }
399
400 void SendRequestNavigationWithParameters(
401 const GURL& url,
402 FrameTreeNode* node,
403 const Referrer& referrer,
404 PageTransition transition_type,
405 NavigationController::ReloadType reload_type) {
406 scoped_ptr<NavigationEntryImpl> entry(
407 NavigationEntryImpl::FromNavigationEntry(
408 NavigationController::CreateNavigationEntry(
409 url,
410 referrer,
411 transition_type,
412 false,
413 std::string(),
414 controller().GetBrowserContext())));
415 NavigatorImpl* navigator = static_cast<NavigatorImpl*>(node->navigator());
416 scoped_ptr<CoreNavigationParams> core_params(new CoreNavigationParams);
417 scoped_ptr<CommitNavigationParams> commit_params(
418 new CommitNavigationParams);
419 RequestNavigationParams request_params;
420 navigator->MakeNavigationParamsForTest(*entry,
421 reload_type,
422 core_params.get(),
423 &request_params,
424 commit_params.get());
425 node->render_manager()->RequestNavigation(
426 core_params.Pass(), request_params, commit_params.Pass());
427 }
428
429 CoreNavigationParams* GetCoreNavigationParams(
430 RenderFrameHostManager* manager) {
431 return manager->core_navigation_params_.get();
432 }
433
390 private: 434 private:
391 RenderFrameHostManagerTestWebUIControllerFactory factory_; 435 RenderFrameHostManagerTestWebUIControllerFactory factory_;
392 scoped_ptr<FrameLifetimeConsistencyChecker> lifetime_checker_; 436 scoped_ptr<FrameLifetimeConsistencyChecker> lifetime_checker_;
393 }; 437 };
394 438
395 // Tests that when you navigate from a chrome:// url to another page, and 439 // Tests that when you navigate from a chrome:// url to another page, and
396 // then do that same thing in another tab, that the two resulting pages have 440 // then do that same thing in another tab, that the two resulting pages have
397 // different SiteInstances, BrowsingInstances, and RenderProcessHosts. This is 441 // different SiteInstances, BrowsingInstances, and RenderProcessHosts. This is
398 // a regression test for bug 9364. 442 // a regression test for bug 9364.
399 TEST_F(RenderFrameHostManagerTest, NewTabPageProcesses) { 443 TEST_F(RenderFrameHostManagerTest, NewTabPageProcesses) {
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 1735
1692 contents()->GetMainFrame()->OnMessageReceived( 1736 contents()->GetMainFrame()->OnMessageReceived(
1693 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); 1737 FrameHostMsg_BeforeUnload_ACK(0, false, now, now));
1694 EXPECT_FALSE(contents()->cross_navigation_pending()); 1738 EXPECT_FALSE(contents()->cross_navigation_pending());
1695 EXPECT_FALSE(rvh_deleted_observer.deleted()); 1739 EXPECT_FALSE(rvh_deleted_observer.deleted());
1696 } 1740 }
1697 } 1741 }
1698 1742
1699 // PlzNavigate: Test that a proper NavigationRequest is created by 1743 // PlzNavigate: Test that a proper NavigationRequest is created by
1700 // BeginNavigation. 1744 // BeginNavigation.
1745 // Note that all PlzNavigate methods on the browser side require the use of the
1746 // flag kEnableBrowserSideNavigation.
1701 TEST_F(RenderFrameHostManagerTest, BrowserSideNavigationBeginNavigation) { 1747 TEST_F(RenderFrameHostManagerTest, BrowserSideNavigationBeginNavigation) {
1702 const GURL kUrl1("http://www.google.com/"); 1748 const GURL kUrl1("http://www.google.com/");
1703 const GURL kUrl2("http://www.chromium.org/"); 1749 const GURL kUrl2("http://www.chromium.org/");
1704 const GURL kUrl3("http://www.gmail.com/"); 1750 const GURL kUrl3("http://www.gmail.com/");
1705 const int64 kFirstNavRequestID = 1; 1751 const int64 kFirstNavRequestID = 1;
1706 1752
1707 // TODO(clamy): we should be enabling browser side navigations here 1753 // TODO(clamy): we should be enabling browser side navigations here
1708 // when CommitNavigation is properly implemented. 1754 // when CommitNavigation is properly implemented.
1709 // Navigate to the first page. 1755 // Navigate to the first page.
1710 contents()->NavigateAndCommit(kUrl1); 1756 contents()->NavigateAndCommit(kUrl1);
1711 1757
1712 EnableBrowserSideNavigation(); 1758 EnableBrowserSideNavigation();
1713 // Add a subframe. 1759 // Add a subframe.
1714 TestRenderFrameHost* subframe_rfh = static_cast<TestRenderFrameHost*>( 1760 TestRenderFrameHost* subframe_rfh = static_cast<TestRenderFrameHost*>(
1715 contents()->GetFrameTree()->AddFrame( 1761 contents()->GetFrameTree()->AddFrame(
1716 contents()->GetFrameTree()->root(), 14, "Child")); 1762 contents()->GetFrameTree()->root(), 14, "Child"));
1717 1763
1764 RenderFrameHostManager* subframe_manager =
1765 subframe_rfh->frame_tree_node()->render_manager();
1766 SendRequestNavigation(kUrl2, subframe_rfh->frame_tree_node());
1718 // Simulate a BeginNavigation IPC on the subframe. 1767 // Simulate a BeginNavigation IPC on the subframe.
1719 subframe_rfh->SendBeginNavigationWithURL(kUrl2); 1768 subframe_rfh->SendBeginNavigationWithURL(kUrl2);
1720 NavigationRequest* subframe_request = 1769 NavigationRequest* subframe_request =
1721 GetNavigationRequestForRenderFrameManager( 1770 GetNavigationRequestForRenderFrameManager(subframe_manager);
1722 subframe_rfh->frame_tree_node()->render_manager());
1723 ASSERT_TRUE(subframe_request); 1771 ASSERT_TRUE(subframe_request);
1724 EXPECT_EQ(kUrl2, subframe_request->info().navigation_params.url); 1772 EXPECT_EQ(kUrl2, subframe_request->info().core_params.url);
1725 // First party for cookies url should be that of the main frame. 1773 // First party for cookies url should be that of the main frame.
1726 EXPECT_EQ( 1774 EXPECT_EQ(
1727 kUrl1, subframe_request->info().first_party_for_cookies); 1775 kUrl1, subframe_request->info().first_party_for_cookies);
1728 EXPECT_FALSE(subframe_request->info().is_main_frame); 1776 EXPECT_FALSE(subframe_request->info().is_main_frame);
1729 EXPECT_TRUE(subframe_request->info().parent_is_main_frame); 1777 EXPECT_TRUE(subframe_request->info().parent_is_main_frame);
1730 EXPECT_EQ(kFirstNavRequestID, subframe_request->navigation_request_id()); 1778 EXPECT_EQ(kFirstNavRequestID, subframe_request->navigation_request_id());
1731 1779
1780 RenderFrameHostManager* main_frame_manager =
1781 contents()->GetMainFrame()->frame_tree_node()->render_manager();
1782 SendRequestNavigation(kUrl3, contents()->GetMainFrame()->frame_tree_node());
1732 // Simulate a BeginNavigation IPC on the main frame. 1783 // Simulate a BeginNavigation IPC on the main frame.
1733 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl3); 1784 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl3);
1734 NavigationRequest* main_request = GetNavigationRequestForRenderFrameManager( 1785 NavigationRequest* main_request =
1735 contents()->GetMainFrame()->frame_tree_node()->render_manager()); 1786 GetNavigationRequestForRenderFrameManager(main_frame_manager);
1736 ASSERT_TRUE(main_request); 1787 ASSERT_TRUE(main_request);
1737 EXPECT_EQ(kUrl3, main_request->info().navigation_params.url); 1788 EXPECT_EQ(kUrl3, main_request->info().core_params.url);
1738 EXPECT_EQ(kUrl3, main_request->info().first_party_for_cookies); 1789 EXPECT_EQ(kUrl3, main_request->info().first_party_for_cookies);
1739 EXPECT_TRUE(main_request->info().is_main_frame); 1790 EXPECT_TRUE(main_request->info().is_main_frame);
1740 EXPECT_FALSE(main_request->info().parent_is_main_frame); 1791 EXPECT_FALSE(main_request->info().parent_is_main_frame);
1741 EXPECT_EQ(kFirstNavRequestID + 1, main_request->navigation_request_id()); 1792 EXPECT_EQ(kFirstNavRequestID + 1, main_request->navigation_request_id());
1742 } 1793 }
1743 1794
1744 // PlzNavigate: Test that RequestNavigation creates a NavigationRequest and that 1795 // PlzNavigate: Test that RequestNavigation creates a NavigationRequest and that
1745 // RenderFrameHost is not modified when the navigation commits. 1796 // RenderFrameHost is not modified when the navigation commits.
1746 TEST_F(RenderFrameHostManagerTest, 1797 TEST_F(RenderFrameHostManagerTest,
1747 BrowserSideNavigationRequestNavigationNoLiveRenderer) { 1798 BrowserSideNavigationRequestNavigationNoLiveRenderer) {
1748 const GURL kUrl("http://www.google.com/"); 1799 const GURL kUrl("http://www.google.com/");
1749 1800
1750 EnableBrowserSideNavigation(); 1801 EnableBrowserSideNavigation();
1751 EXPECT_FALSE(main_test_rfh()->render_view_host()->IsRenderViewLive()); 1802 EXPECT_FALSE(main_test_rfh()->render_view_host()->IsRenderViewLive());
1752 contents()->GetController().LoadURL(
1753 kUrl, Referrer(), PAGE_TRANSITION_LINK, std::string());
1754 RenderFrameHostManager* render_manager = 1803 RenderFrameHostManager* render_manager =
1755 main_test_rfh()->frame_tree_node()->render_manager(); 1804 main_test_rfh()->frame_tree_node()->render_manager();
1805 SendRequestNavigation(kUrl, main_test_rfh()->frame_tree_node());
1756 NavigationRequest* main_request = 1806 NavigationRequest* main_request =
1757 GetNavigationRequestForRenderFrameManager(render_manager); 1807 GetNavigationRequestForRenderFrameManager(render_manager);
1758 // A NavigationRequest should have been generated. 1808 // A NavigationRequest should have been generated.
1759 EXPECT_TRUE(main_request != NULL); 1809 EXPECT_TRUE(main_request != NULL);
1760 RenderFrameHostImpl* rfh = main_test_rfh(); 1810 RenderFrameHostImpl* rfh = main_test_rfh();
1761 1811
1762 // Now commit the same url. 1812 // Now commit the same url.
1763 NavigationBeforeCommitInfo commit_info; 1813 NavigationBeforeCommitInfo commit_info;
1764 commit_info.navigation_url = kUrl; 1814 commit_info.navigation_url = kUrl;
1765 commit_info.navigation_request_id = main_request->navigation_request_id(); 1815 commit_info.navigation_request_id = main_request->navigation_request_id();
(...skipping 18 matching lines...) Expand all
1784 // Navigate to the first page. 1834 // Navigate to the first page.
1785 contents()->NavigateAndCommit(kUrl1); 1835 contents()->NavigateAndCommit(kUrl1);
1786 TestRenderViewHost* rvh1 = test_rvh(); 1836 TestRenderViewHost* rvh1 = test_rvh();
1787 EXPECT_EQ(RenderViewHostImpl::STATE_DEFAULT, rvh1->rvh_state()); 1837 EXPECT_EQ(RenderViewHostImpl::STATE_DEFAULT, rvh1->rvh_state());
1788 RenderFrameHostImpl* rfh = main_test_rfh(); 1838 RenderFrameHostImpl* rfh = main_test_rfh();
1789 RenderFrameHostManager* render_manager = 1839 RenderFrameHostManager* render_manager =
1790 main_test_rfh()->frame_tree_node()->render_manager(); 1840 main_test_rfh()->frame_tree_node()->render_manager();
1791 1841
1792 EnableBrowserSideNavigation(); 1842 EnableBrowserSideNavigation();
1793 // Navigate to a different site. 1843 // Navigate to a different site.
1844 SendRequestNavigation(kUrl2, main_test_rfh()->frame_tree_node());
1794 main_test_rfh()->SendBeginNavigationWithURL(kUrl2); 1845 main_test_rfh()->SendBeginNavigationWithURL(kUrl2);
1795 NavigationRequest* main_request = 1846 NavigationRequest* main_request =
1796 GetNavigationRequestForRenderFrameManager(render_manager); 1847 GetNavigationRequestForRenderFrameManager(render_manager);
1797 ASSERT_TRUE(main_request); 1848 ASSERT_TRUE(main_request);
1798 1849
1799 NavigationBeforeCommitInfo commit_info; 1850 NavigationBeforeCommitInfo commit_info;
1800 commit_info.navigation_url = kUrl2; 1851 commit_info.navigation_url = kUrl2;
1801 commit_info.navigation_request_id = main_request->navigation_request_id(); 1852 commit_info.navigation_request_id = main_request->navigation_request_id();
1802 render_manager->CommitNavigation(commit_info); 1853 render_manager->CommitNavigation(commit_info);
1803 EXPECT_NE(main_test_rfh(), rfh); 1854 EXPECT_NE(main_test_rfh(), rfh);
(...skipping 15 matching lines...) Expand all
1819 const GURL kUrl2_site = SiteInstance::GetSiteForURL(browser_context(), kUrl2); 1870 const GURL kUrl2_site = SiteInstance::GetSiteForURL(browser_context(), kUrl2);
1820 1871
1821 // Initialization. 1872 // Initialization.
1822 contents()->NavigateAndCommit(kUrl0); 1873 contents()->NavigateAndCommit(kUrl0);
1823 RenderFrameHostManager* render_manager = 1874 RenderFrameHostManager* render_manager =
1824 main_test_rfh()->frame_tree_node()->render_manager(); 1875 main_test_rfh()->frame_tree_node()->render_manager();
1825 EnableBrowserSideNavigation(); 1876 EnableBrowserSideNavigation();
1826 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); 1877 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL());
1827 1878
1828 // Request navigation to the 1st URL and gather data. 1879 // Request navigation to the 1st URL and gather data.
1880 SendRequestNavigation(kUrl1, main_test_rfh()->frame_tree_node());
1829 main_test_rfh()->SendBeginNavigationWithURL(kUrl1); 1881 main_test_rfh()->SendBeginNavigationWithURL(kUrl1);
1830 NavigationRequest* request1 = 1882 NavigationRequest* request1 =
1831 GetNavigationRequestForRenderFrameManager(render_manager); 1883 GetNavigationRequestForRenderFrameManager(render_manager);
1832 ASSERT_TRUE(request1); 1884 ASSERT_TRUE(request1);
1833 int64 request_id1 = request1->navigation_request_id(); 1885 int64 request_id1 = request1->navigation_request_id();
1834 1886
1835 // Request navigation to the 2nd URL and gather more data. 1887 // Request navigation to the 2nd URL and gather more data.
1888 SendRequestNavigation(kUrl2, main_test_rfh()->frame_tree_node());
1836 main_test_rfh()->SendBeginNavigationWithURL(kUrl2); 1889 main_test_rfh()->SendBeginNavigationWithURL(kUrl2);
1837 NavigationRequest* request2 = 1890 NavigationRequest* request2 =
1838 GetNavigationRequestForRenderFrameManager(render_manager); 1891 GetNavigationRequestForRenderFrameManager(render_manager);
1839 ASSERT_TRUE(request2); 1892 ASSERT_TRUE(request2);
1840 int64 request_id2 = request2->navigation_request_id(); 1893 int64 request_id2 = request2->navigation_request_id();
1841 EXPECT_NE(request_id1, request_id2); 1894 EXPECT_NE(request_id1, request_id2);
1842 1895
1843 // Confirms that a stale commit is ignored by the RHFM. 1896 // Confirms that a stale commit is ignored by the RHFM.
1844 NavigationBeforeCommitInfo nbc_info; 1897 NavigationBeforeCommitInfo nbc_info;
1845 nbc_info.navigation_url = kUrl1; 1898 nbc_info.navigation_url = kUrl1;
1846 nbc_info.navigation_request_id = request_id1; 1899 nbc_info.navigation_request_id = request_id1;
1847 render_manager->CommitNavigation(nbc_info); 1900 render_manager->CommitNavigation(nbc_info);
1848 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); 1901 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL());
1849 1902
1850 // Confirms that a valid, request-matching commit is correctly processed. 1903 // Confirms that a valid, request-matching commit is correctly processed.
1851 nbc_info.navigation_url = kUrl2; 1904 nbc_info.navigation_url = kUrl2;
1852 nbc_info.navigation_request_id = request_id2; 1905 nbc_info.navigation_request_id = request_id2;
1853 render_manager->CommitNavigation(nbc_info); 1906 render_manager->CommitNavigation(nbc_info);
1854 EXPECT_EQ(kUrl2_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); 1907 EXPECT_EQ(kUrl2_site, main_test_rfh()->GetSiteInstance()->GetSiteURL());
1855 } 1908 }
1856 1909
1910 // PlzNavigate: Test that a reload navigation is properly signaled to the
1911 // renderer when the navigation can commit.
1912 TEST_F(RenderFrameHostManagerTest,
1913 BrowserSideNavigationReload) {
Charlie Reis 2014/09/19 23:12:32 Fits on one line?
clamy 2014/09/23 21:13:26 Done.
1914 const GURL kUrl("http://www.google.com/");
1915 contents()->NavigateAndCommit(kUrl);
1916
1917 EnableBrowserSideNavigation();
1918 RenderFrameHostManager* render_manager =
1919 main_test_rfh()->frame_tree_node()->render_manager();
1920 SendRequestNavigationWithParameters(
1921 kUrl, main_test_rfh()->frame_tree_node(), Referrer(),
1922 PAGE_TRANSITION_LINK, NavigationController::RELOAD);
1923 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl);
1924 // A NavigationRequest should have been generated.
1925 NavigationRequest* main_request =
1926 GetNavigationRequestForRenderFrameManager(render_manager);
1927 ASSERT_TRUE(main_request != NULL);
1928 // Navigation parameters should have been generated.
1929 CoreNavigationParams* navigation_params =
1930 GetCoreNavigationParams(render_manager);
1931 ASSERT_TRUE(navigation_params != NULL);
1932 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD, navigation_params->navigation_type);
1933 int page_id = contents()->GetMaxPageIDForSiteInstance(
1934 main_test_rfh()->GetSiteInstance()) +
1935 1;
Charlie Reis 2014/09/19 23:12:32 Move 1 to previous line? (Same below)
clamy 2014/09/23 21:13:26 Done (git cl format is weird sometimes).
1936 main_test_rfh()->SendNavigate(page_id, kUrl);
1937
1938 // Now do a shift+reload.
1939 SendRequestNavigationWithParameters(
1940 kUrl,
1941 main_test_rfh()->frame_tree_node(),
1942 Referrer(),
1943 PAGE_TRANSITION_LINK,
1944 NavigationController::RELOAD_IGNORING_CACHE);
1945 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl);
1946 // A NavigationRequest should have been generated.
1947 main_request = GetNavigationRequestForRenderFrameManager(render_manager);
1948 ASSERT_TRUE(main_request != NULL);
1949 // Navigation parameters should have been generated.
1950 navigation_params = GetCoreNavigationParams(render_manager);
1951 ASSERT_TRUE(navigation_params != NULL);
1952 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE,
1953 navigation_params->navigation_type);
1954 page_id = contents()->GetMaxPageIDForSiteInstance(
1955 main_test_rfh()->GetSiteInstance()) +
1956 1;
1957 main_test_rfh()->SendNavigate(page_id, kUrl);
1958 }
1959
1857 } // namespace content 1960 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698