OLD | NEW |
---|---|
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/time/time.h" | 9 #include "base/time/time.h" |
9 #include "content/browser/frame_host/cross_site_transferring_request.h" | 10 #include "content/browser/frame_host/cross_site_transferring_request.h" |
10 #include "content/browser/frame_host/navigation_before_commit_info.h" | 11 #include "content/browser/frame_host/navigation_before_commit_info.h" |
11 #include "content/browser/frame_host/navigation_controller_impl.h" | 12 #include "content/browser/frame_host/navigation_controller_impl.h" |
12 #include "content/browser/frame_host/navigation_entry_impl.h" | 13 #include "content/browser/frame_host/navigation_entry_impl.h" |
13 #include "content/browser/frame_host/navigation_request.h" | 14 #include "content/browser/frame_host/navigation_request.h" |
14 #include "content/browser/frame_host/navigator.h" | 15 #include "content/browser/frame_host/navigator.h" |
15 #include "content/browser/frame_host/navigator_impl.h" | 16 #include "content/browser/frame_host/navigator_impl.h" |
16 #include "content/browser/frame_host/render_frame_host_manager.h" | 17 #include "content/browser/frame_host/render_frame_host_manager.h" |
17 #include "content/browser/site_instance_impl.h" | 18 #include "content/browser/site_instance_impl.h" |
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1853 render_manager->CommitNavigation(nbc_info); | 1854 render_manager->CommitNavigation(nbc_info); |
1854 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); | 1855 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); |
1855 | 1856 |
1856 // Confirms that a valid, request-matching commit is correctly processed. | 1857 // Confirms that a valid, request-matching commit is correctly processed. |
1857 nbc_info.navigation_url = kUrl2; | 1858 nbc_info.navigation_url = kUrl2; |
1858 nbc_info.navigation_request_id = request_id2; | 1859 nbc_info.navigation_request_id = request_id2; |
1859 render_manager->CommitNavigation(nbc_info); | 1860 render_manager->CommitNavigation(nbc_info); |
1860 EXPECT_EQ(kUrl2_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); | 1861 EXPECT_EQ(kUrl2_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); |
1861 } | 1862 } |
1862 | 1863 |
1864 // PlzNavigate: Tests that the navigation histograms are correctly tracked both | |
1865 // when PlzNavigate is enabled and disabled, and ignores in-tab renderer | |
1866 // initiated navigation. | |
1867 // Note: the related histogram, Navigation.TimeToURLJobStart, cannot be tracked | |
1868 // by this test as the IO thread is not running. | |
1869 TEST_F(RenderFrameHostManagerTest, BrowserSideNavigationHistogramTest) { | |
1870 const GURL kUrl0("http://www.google.com/"); | |
1871 const GURL kUrl1("http://www.chromium.org/"); | |
1872 base::HistogramTester histo_tester; | |
1873 | |
1874 // Performs a "normal" non-PlzNavigate navigation | |
1875 contents()->NavigateAndCommit(kUrl0); | |
1876 histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 1); | |
1877 | |
1878 // Performs a PlzNavigate navigation | |
1879 EnableBrowserSideNavigation(); | |
1880 contents()->NavigateAndCommit(kUrl1); | |
1881 histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 2); | |
1882 | |
1883 // Performs an in-tab renderer initiated navigation | |
clamy
2014/09/26 14:48:32
I think it would make more sense to test that rend
carlosk
2014/09/26 15:50:25
Done! And updated the test comment to explain what
| |
1884 int32 new_page_id = 1 + contents()->GetMaxPageIDForSiteInstance( | |
1885 main_test_rfh()->GetSiteInstance()); | |
1886 main_test_rfh()->SendNavigate(new_page_id, kUrl1); | |
1887 histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 2); | |
1888 } | |
1889 | |
1863 } // namespace content | 1890 } // namespace content |
OLD | NEW |