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

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: Rebase + fix compilation error Created 6 years, 2 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/test/histogram_tester.h" 8 #include "base/test/histogram_tester.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/cross_site_transferring_request.h" 10 #include "content/browser/frame_host/cross_site_transferring_request.h"
11 #include "content/browser/frame_host/navigation_before_commit_info.h" 11 #include "content/browser/frame_host/navigation_before_commit_info.h"
12 #include "content/browser/frame_host/navigation_controller_impl.h" 12 #include "content/browser/frame_host/navigation_controller_impl.h"
13 #include "content/browser/frame_host/navigation_entry_impl.h" 13 #include "content/browser/frame_host/navigation_entry_impl.h"
14 #include "content/browser/frame_host/navigation_request.h" 14 #include "content/browser/frame_host/navigation_request.h"
15 #include "content/browser/frame_host/navigation_request_info.h"
15 #include "content/browser/frame_host/navigator.h" 16 #include "content/browser/frame_host/navigator.h"
16 #include "content/browser/frame_host/navigator_impl.h" 17 #include "content/browser/frame_host/navigator_impl.h"
17 #include "content/browser/frame_host/render_frame_host_manager.h" 18 #include "content/browser/frame_host/render_frame_host_manager.h"
18 #include "content/browser/frame_host/render_frame_proxy_host.h" 19 #include "content/browser/frame_host/render_frame_proxy_host.h"
19 #include "content/browser/site_instance_impl.h" 20 #include "content/browser/site_instance_impl.h"
20 #include "content/browser/webui/web_ui_controller_factory_registry.h" 21 #include "content/browser/webui/web_ui_controller_factory_registry.h"
22 #include "content/common/navigation_params.h"
21 #include "content/common/view_messages.h" 23 #include "content/common/view_messages.h"
22 #include "content/public/browser/notification_details.h" 24 #include "content/public/browser/notification_details.h"
23 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
24 #include "content/public/browser/notification_source.h" 26 #include "content/public/browser/notification_source.h"
25 #include "content/public/browser/notification_types.h" 27 #include "content/public/browser/notification_types.h"
26 #include "content/public/browser/render_process_host.h" 28 #include "content/public/browser/render_process_host.h"
27 #include "content/public/browser/render_widget_host_iterator.h" 29 #include "content/public/browser/render_widget_host_iterator.h"
28 #include "content/public/browser/web_contents_delegate.h" 30 #include "content/public/browser/web_contents_delegate.h"
29 #include "content/public/browser/web_contents_observer.h" 31 #include "content/public/browser/web_contents_observer.h"
30 #include "content/public/browser/web_ui_controller.h" 32 #include "content/public/browser/web_ui_controller.h"
31 #include "content/public/common/bindings_policy.h" 33 #include "content/public/common/bindings_policy.h"
32 #include "content/public/common/content_switches.h" 34 #include "content/public/common/content_switches.h"
33 #include "content/public/common/javascript_message_type.h" 35 #include "content/public/common/javascript_message_type.h"
34 #include "content/public/common/url_constants.h" 36 #include "content/public/common/url_constants.h"
35 #include "content/public/common/url_utils.h" 37 #include "content/public/common/url_utils.h"
36 #include "content/public/test/mock_render_process_host.h" 38 #include "content/public/test/mock_render_process_host.h"
37 #include "content/public/test/test_notification_tracker.h" 39 #include "content/public/test/test_notification_tracker.h"
38 #include "content/test/test_content_browser_client.h" 40 #include "content/test/test_content_browser_client.h"
39 #include "content/test/test_content_client.h" 41 #include "content/test/test_content_client.h"
40 #include "content/test/test_render_frame_host.h" 42 #include "content/test/test_render_frame_host.h"
41 #include "content/test/test_render_view_host.h" 43 #include "content/test/test_render_view_host.h"
42 #include "content/test/test_web_contents.h" 44 #include "content/test/test_web_contents.h"
45 #include "net/base/load_flags.h"
43 #include "testing/gtest/include/gtest/gtest.h" 46 #include "testing/gtest/include/gtest/gtest.h"
44 #include "ui/base/page_transition_types.h" 47 #include "ui/base/page_transition_types.h"
45 48
46 namespace content { 49 namespace content {
47 namespace { 50 namespace {
48 51
49 class RenderFrameHostManagerTestWebUIControllerFactory 52 class RenderFrameHostManagerTestWebUIControllerFactory
50 : public WebUIControllerFactory { 53 : public WebUIControllerFactory {
51 public: 54 public:
52 RenderFrameHostManagerTestWebUIControllerFactory() 55 RenderFrameHostManagerTestWebUIControllerFactory()
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 390
388 NavigationRequest* GetNavigationRequestForRenderFrameManager( 391 NavigationRequest* GetNavigationRequestForRenderFrameManager(
389 RenderFrameHostManager* manager) const { 392 RenderFrameHostManager* manager) const {
390 return manager->navigation_request_for_testing(); 393 return manager->navigation_request_for_testing();
391 } 394 }
392 395
393 void EnableBrowserSideNavigation() { 396 void EnableBrowserSideNavigation() {
394 CommandLine::ForCurrentProcess()->AppendSwitch( 397 CommandLine::ForCurrentProcess()->AppendSwitch(
395 switches::kEnableBrowserSideNavigation); 398 switches::kEnableBrowserSideNavigation);
396 } 399 }
400
401 void SendRequestNavigation(FrameTreeNode* node,
402 const GURL& url) {
403 SendRequestNavigationWithParameters(
404 node, url, Referrer(), ui::PAGE_TRANSITION_LINK,
405 FrameMsg_Navigate_Type::NORMAL);
406 }
407
408 void SendRequestNavigationWithParameters(
409 FrameTreeNode* node,
410 const GURL& url,
411 const Referrer& referrer,
412 ui::PageTransition transition_type,
413 FrameMsg_Navigate_Type::Value navigation_type) {
414 scoped_ptr<NavigationEntryImpl> entry(
415 NavigationEntryImpl::FromNavigationEntry(
416 NavigationController::CreateNavigationEntry(
417 url,
418 referrer,
419 transition_type,
420 false,
421 std::string(),
422 controller().GetBrowserContext())));
423 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest(
424 node->frame_tree_node_id(),
425 CommonNavigationParams(entry->GetURL(),
426 entry->GetReferrer(),
427 entry->GetTransitionType(),
428 navigation_type,
429 !entry->IsViewSourceMode()),
430 CommitNavigationParams(entry->GetPageState(),
431 entry->GetIsOverridingUserAgent(),
432 base::TimeTicks::Now())));
433 RequestNavigationParams request_params(
434 entry->GetHasPostData(),
435 entry->extra_headers(),
436 entry->GetBrowserInitiatedPostData());
437 node->render_manager()->RequestNavigation(navigation_request.Pass(),
438 request_params);
439 }
440
397 private: 441 private:
398 RenderFrameHostManagerTestWebUIControllerFactory factory_; 442 RenderFrameHostManagerTestWebUIControllerFactory factory_;
399 scoped_ptr<FrameLifetimeConsistencyChecker> lifetime_checker_; 443 scoped_ptr<FrameLifetimeConsistencyChecker> lifetime_checker_;
400 }; 444 };
401 445
402 // Tests that when you navigate from a chrome:// url to another page, and 446 // Tests that when you navigate from a chrome:// url to another page, and
403 // then do that same thing in another tab, that the two resulting pages have 447 // then do that same thing in another tab, that the two resulting pages have
404 // different SiteInstances, BrowsingInstances, and RenderProcessHosts. This is 448 // different SiteInstances, BrowsingInstances, and RenderProcessHosts. This is
405 // a regression test for bug 9364. 449 // a regression test for bug 9364.
406 TEST_F(RenderFrameHostManagerTest, NewTabPageProcesses) { 450 TEST_F(RenderFrameHostManagerTest, NewTabPageProcesses) {
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 1745
1702 contents()->GetMainFrame()->OnMessageReceived( 1746 contents()->GetMainFrame()->OnMessageReceived(
1703 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); 1747 FrameHostMsg_BeforeUnload_ACK(0, false, now, now));
1704 EXPECT_FALSE(contents()->cross_navigation_pending()); 1748 EXPECT_FALSE(contents()->cross_navigation_pending());
1705 EXPECT_FALSE(rfh_deleted_observer.deleted()); 1749 EXPECT_FALSE(rfh_deleted_observer.deleted());
1706 } 1750 }
1707 } 1751 }
1708 1752
1709 // PlzNavigate: Test that a proper NavigationRequest is created by 1753 // PlzNavigate: Test that a proper NavigationRequest is created by
1710 // BeginNavigation. 1754 // BeginNavigation.
1755 // Note that all PlzNavigate methods on the browser side require the use of the
1756 // flag kEnableBrowserSideNavigation.
1711 TEST_F(RenderFrameHostManagerTest, BrowserSideNavigationBeginNavigation) { 1757 TEST_F(RenderFrameHostManagerTest, BrowserSideNavigationBeginNavigation) {
1712 const GURL kUrl1("http://www.google.com/"); 1758 const GURL kUrl1("http://www.google.com/");
1713 const GURL kUrl2("http://www.chromium.org/"); 1759 const GURL kUrl2("http://www.chromium.org/");
1714 const GURL kUrl3("http://www.gmail.com/"); 1760 const GURL kUrl3("http://www.gmail.com/");
1715 const int64 kFirstNavRequestID = 1; 1761 const int64 kFirstNavRequestID = 1;
1716 1762
1717 // TODO(clamy): we should be enabling browser side navigations here 1763 // TODO(clamy): we should be enabling browser side navigations here
1718 // when CommitNavigation is properly implemented. 1764 // when CommitNavigation is properly implemented.
1719 // Navigate to the first page. 1765 // Navigate to the first page.
1720 contents()->NavigateAndCommit(kUrl1); 1766 contents()->NavigateAndCommit(kUrl1);
1721 1767
1722 EnableBrowserSideNavigation(); 1768 EnableBrowserSideNavigation();
1723 // Add a subframe. 1769 // Add a subframe.
1724 TestRenderFrameHost* subframe_rfh = static_cast<TestRenderFrameHost*>( 1770 TestRenderFrameHost* subframe_rfh = static_cast<TestRenderFrameHost*>(
1725 contents()->GetFrameTree()->AddFrame( 1771 contents()->GetFrameTree()->AddFrame(
1726 contents()->GetFrameTree()->root(), 14, "Child")); 1772 contents()->GetFrameTree()->root(), 14, "Child"));
1727 1773
1774 RenderFrameHostManager* subframe_manager =
1775 subframe_rfh->frame_tree_node()->render_manager();
1776 SendRequestNavigation(subframe_rfh->frame_tree_node(), kUrl2);
1728 // Simulate a BeginNavigation IPC on the subframe. 1777 // Simulate a BeginNavigation IPC on the subframe.
1729 subframe_rfh->SendBeginNavigationWithURL(kUrl2); 1778 subframe_rfh->SendBeginNavigationWithURL(kUrl2);
1730 NavigationRequest* subframe_request = 1779 NavigationRequest* subframe_request =
1731 GetNavigationRequestForRenderFrameManager( 1780 GetNavigationRequestForRenderFrameManager(subframe_manager);
1732 subframe_rfh->frame_tree_node()->render_manager());
1733 ASSERT_TRUE(subframe_request); 1781 ASSERT_TRUE(subframe_request);
1734 EXPECT_EQ(kUrl2, subframe_request->info().navigation_params.url); 1782 EXPECT_EQ(kUrl2, subframe_request->common_params().url);
1735 // First party for cookies url should be that of the main frame. 1783 // First party for cookies url should be that of the main frame.
1736 EXPECT_EQ( 1784 EXPECT_EQ(kUrl1, subframe_request->info_for_test()->first_party_for_cookies);
1737 kUrl1, subframe_request->info().first_party_for_cookies); 1785 EXPECT_FALSE(subframe_request->info_for_test()->is_main_frame);
1738 EXPECT_FALSE(subframe_request->info().is_main_frame); 1786 EXPECT_TRUE(subframe_request->info_for_test()->parent_is_main_frame);
1739 EXPECT_TRUE(subframe_request->info().parent_is_main_frame);
1740 EXPECT_EQ(kFirstNavRequestID, subframe_request->navigation_request_id()); 1787 EXPECT_EQ(kFirstNavRequestID, subframe_request->navigation_request_id());
1741 1788
1789 RenderFrameHostManager* main_frame_manager =
1790 contents()->GetMainFrame()->frame_tree_node()->render_manager();
1791 SendRequestNavigation(contents()->GetMainFrame()->frame_tree_node(), kUrl3);
1742 // Simulate a BeginNavigation IPC on the main frame. 1792 // Simulate a BeginNavigation IPC on the main frame.
1743 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl3); 1793 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl3);
1744 NavigationRequest* main_request = GetNavigationRequestForRenderFrameManager( 1794 NavigationRequest* main_request =
1745 contents()->GetMainFrame()->frame_tree_node()->render_manager()); 1795 GetNavigationRequestForRenderFrameManager(main_frame_manager);
1746 ASSERT_TRUE(main_request); 1796 ASSERT_TRUE(main_request);
1747 EXPECT_EQ(kUrl3, main_request->info().navigation_params.url); 1797 EXPECT_EQ(kUrl3, main_request->common_params().url);
1748 EXPECT_EQ(kUrl3, main_request->info().first_party_for_cookies); 1798 EXPECT_EQ(kUrl3, main_request->info_for_test()->first_party_for_cookies);
1749 EXPECT_TRUE(main_request->info().is_main_frame); 1799 EXPECT_TRUE(main_request->info_for_test()->is_main_frame);
1750 EXPECT_FALSE(main_request->info().parent_is_main_frame); 1800 EXPECT_FALSE(main_request->info_for_test()->parent_is_main_frame);
1751 EXPECT_EQ(kFirstNavRequestID + 1, main_request->navigation_request_id()); 1801 EXPECT_EQ(kFirstNavRequestID + 1, main_request->navigation_request_id());
1752 } 1802 }
1753 1803
1754 // PlzNavigate: Test that RequestNavigation creates a NavigationRequest and that 1804 // PlzNavigate: Test that RequestNavigation creates a NavigationRequest and that
1755 // RenderFrameHost is not modified when the navigation commits. 1805 // RenderFrameHost is not modified when the navigation commits.
1756 TEST_F(RenderFrameHostManagerTest, 1806 TEST_F(RenderFrameHostManagerTest,
1757 BrowserSideNavigationRequestNavigationNoLiveRenderer) { 1807 BrowserSideNavigationRequestNavigationNoLiveRenderer) {
1758 const GURL kUrl("http://www.google.com/"); 1808 const GURL kUrl("http://www.google.com/");
1759 1809
1760 EnableBrowserSideNavigation(); 1810 EnableBrowserSideNavigation();
1761 EXPECT_FALSE(main_test_rfh()->render_view_host()->IsRenderViewLive()); 1811 EXPECT_FALSE(main_test_rfh()->render_view_host()->IsRenderViewLive());
1762 contents()->GetController().LoadURL(
1763 kUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
1764 RenderFrameHostManager* render_manager = 1812 RenderFrameHostManager* render_manager =
1765 main_test_rfh()->frame_tree_node()->render_manager(); 1813 main_test_rfh()->frame_tree_node()->render_manager();
1814 SendRequestNavigation(main_test_rfh()->frame_tree_node(), kUrl);
1766 NavigationRequest* main_request = 1815 NavigationRequest* main_request =
1767 GetNavigationRequestForRenderFrameManager(render_manager); 1816 GetNavigationRequestForRenderFrameManager(render_manager);
1768 // A NavigationRequest should have been generated. 1817 // A NavigationRequest should have been generated.
1769 EXPECT_TRUE(main_request != NULL); 1818 EXPECT_TRUE(main_request != NULL);
1770 RenderFrameHostImpl* rfh = main_test_rfh(); 1819 RenderFrameHostImpl* rfh = main_test_rfh();
1771 1820
1772 // Now commit the same url. 1821 // Now commit the same url.
1773 NavigationBeforeCommitInfo commit_info; 1822 NavigationBeforeCommitInfo commit_info;
1774 commit_info.navigation_url = kUrl; 1823 commit_info.navigation_url = kUrl;
1775 commit_info.navigation_request_id = main_request->navigation_request_id(); 1824 commit_info.navigation_request_id = main_request->navigation_request_id();
(...skipping 18 matching lines...) Expand all
1794 // when CommitNavigation is properly implemented. 1843 // when CommitNavigation is properly implemented.
1795 // Navigate to the first page. 1844 // Navigate to the first page.
1796 contents()->NavigateAndCommit(kUrl1); 1845 contents()->NavigateAndCommit(kUrl1);
1797 RenderFrameHostImpl* rfh = main_test_rfh(); 1846 RenderFrameHostImpl* rfh = main_test_rfh();
1798 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh->rfh_state()); 1847 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh->rfh_state());
1799 RenderFrameHostManager* render_manager = 1848 RenderFrameHostManager* render_manager =
1800 main_test_rfh()->frame_tree_node()->render_manager(); 1849 main_test_rfh()->frame_tree_node()->render_manager();
1801 1850
1802 EnableBrowserSideNavigation(); 1851 EnableBrowserSideNavigation();
1803 // Navigate to a different site. 1852 // Navigate to a different site.
1853 SendRequestNavigation(main_test_rfh()->frame_tree_node(), kUrl2);
1804 main_test_rfh()->SendBeginNavigationWithURL(kUrl2); 1854 main_test_rfh()->SendBeginNavigationWithURL(kUrl2);
1805 NavigationRequest* main_request = 1855 NavigationRequest* main_request =
1806 GetNavigationRequestForRenderFrameManager(render_manager); 1856 GetNavigationRequestForRenderFrameManager(render_manager);
1807 ASSERT_TRUE(main_request); 1857 ASSERT_TRUE(main_request);
1808 1858
1809 NavigationBeforeCommitInfo commit_info; 1859 NavigationBeforeCommitInfo commit_info;
1810 commit_info.navigation_url = kUrl2; 1860 commit_info.navigation_url = kUrl2;
1811 commit_info.navigation_request_id = main_request->navigation_request_id(); 1861 commit_info.navigation_request_id = main_request->navigation_request_id();
1812 render_manager->CommitNavigation(commit_info); 1862 render_manager->CommitNavigation(commit_info);
1813 EXPECT_NE(main_test_rfh(), rfh); 1863 EXPECT_NE(main_test_rfh(), rfh);
(...skipping 16 matching lines...) Expand all
1830 const GURL kUrl2_site = SiteInstance::GetSiteForURL(browser_context(), kUrl2); 1880 const GURL kUrl2_site = SiteInstance::GetSiteForURL(browser_context(), kUrl2);
1831 1881
1832 // Initialization. 1882 // Initialization.
1833 contents()->NavigateAndCommit(kUrl0); 1883 contents()->NavigateAndCommit(kUrl0);
1834 RenderFrameHostManager* render_manager = 1884 RenderFrameHostManager* render_manager =
1835 main_test_rfh()->frame_tree_node()->render_manager(); 1885 main_test_rfh()->frame_tree_node()->render_manager();
1836 EnableBrowserSideNavigation(); 1886 EnableBrowserSideNavigation();
1837 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); 1887 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL());
1838 1888
1839 // Request navigation to the 1st URL and gather data. 1889 // Request navigation to the 1st URL and gather data.
1890 SendRequestNavigation(main_test_rfh()->frame_tree_node(), kUrl1);
1840 main_test_rfh()->SendBeginNavigationWithURL(kUrl1); 1891 main_test_rfh()->SendBeginNavigationWithURL(kUrl1);
1841 NavigationRequest* request1 = 1892 NavigationRequest* request1 =
1842 GetNavigationRequestForRenderFrameManager(render_manager); 1893 GetNavigationRequestForRenderFrameManager(render_manager);
1843 ASSERT_TRUE(request1); 1894 ASSERT_TRUE(request1);
1844 int64 request_id1 = request1->navigation_request_id(); 1895 int64 request_id1 = request1->navigation_request_id();
1845 1896
1846 // Request navigation to the 2nd URL and gather more data. 1897 // Request navigation to the 2nd URL and gather more data.
1898 SendRequestNavigation(main_test_rfh()->frame_tree_node(), kUrl2);
1847 main_test_rfh()->SendBeginNavigationWithURL(kUrl2); 1899 main_test_rfh()->SendBeginNavigationWithURL(kUrl2);
1848 NavigationRequest* request2 = 1900 NavigationRequest* request2 =
1849 GetNavigationRequestForRenderFrameManager(render_manager); 1901 GetNavigationRequestForRenderFrameManager(render_manager);
1850 ASSERT_TRUE(request2); 1902 ASSERT_TRUE(request2);
1851 int64 request_id2 = request2->navigation_request_id(); 1903 int64 request_id2 = request2->navigation_request_id();
1852 EXPECT_NE(request_id1, request_id2); 1904 EXPECT_NE(request_id1, request_id2);
1853 1905
1854 // Confirms that a stale commit is ignored by the RHFM. 1906 // Confirms that a stale commit is ignored by the RHFM.
1855 NavigationBeforeCommitInfo nbc_info; 1907 NavigationBeforeCommitInfo nbc_info;
1856 nbc_info.navigation_url = kUrl1; 1908 nbc_info.navigation_url = kUrl1;
(...skipping 27 matching lines...) Expand all
1884 main_test_rfh()->GetSiteInstance()); 1936 main_test_rfh()->GetSiteInstance());
1885 main_test_rfh()->SendNavigate(new_page_id, kUrl0); 1937 main_test_rfh()->SendNavigate(new_page_id, kUrl0);
1886 histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 1); 1938 histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 1);
1887 1939
1888 // Performs a PlzNavigate navigation 1940 // Performs a PlzNavigate navigation
1889 EnableBrowserSideNavigation(); 1941 EnableBrowserSideNavigation();
1890 contents()->NavigateAndCommit(kUrl1); 1942 contents()->NavigateAndCommit(kUrl1);
1891 histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 2); 1943 histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 2);
1892 } 1944 }
1893 1945
1946 // PlzNavigate: Test that a reload navigation is properly signaled to the
1947 // renderer when the navigation can commit.
1948 TEST_F(RenderFrameHostManagerTest, BrowserSideNavigationReload) {
1949 const GURL kUrl("http://www.google.com/");
1950 contents()->NavigateAndCommit(kUrl);
1951
1952 EnableBrowserSideNavigation();
1953 RenderFrameHostManager* render_manager =
1954 main_test_rfh()->frame_tree_node()->render_manager();
1955 SendRequestNavigationWithParameters(
1956 main_test_rfh()->frame_tree_node(), kUrl, Referrer(),
1957 ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD);
1958 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl);
1959 // A NavigationRequest should have been generated.
1960 NavigationRequest* main_request =
1961 GetNavigationRequestForRenderFrameManager(render_manager);
1962 ASSERT_TRUE(main_request != NULL);
1963 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD,
1964 main_request->common_params().navigation_type);
1965 int page_id = contents()->GetMaxPageIDForSiteInstance(
1966 main_test_rfh()->GetSiteInstance()) + 1;
1967 main_test_rfh()->SendNavigate(page_id, kUrl);
1968
1969 // Now do a shift+reload.
1970 SendRequestNavigationWithParameters(
1971 main_test_rfh()->frame_tree_node(),
1972 kUrl,
1973 Referrer(),
1974 ui::PAGE_TRANSITION_LINK,
1975 FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE);
1976 contents()->GetMainFrame()->SendBeginNavigationWithURL(kUrl);
1977 // A NavigationRequest should have been generated.
1978 main_request = GetNavigationRequestForRenderFrameManager(render_manager);
1979 ASSERT_TRUE(main_request != NULL);
1980 EXPECT_EQ(FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE,
1981 main_request->common_params().navigation_type);
1982 }
1983
1894 } // namespace content 1984 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698