Chromium Code Reviews| Index: content/browser/frame_host/render_frame_host_manager_unittest.cc |
| diff --git a/content/browser/frame_host/render_frame_host_manager_unittest.cc b/content/browser/frame_host/render_frame_host_manager_unittest.cc |
| index b23ecc97c42afdce13cb883c2ecd2120e086a4a8..7e50c70595722211c0217b0db930533b39092141 100644 |
| --- a/content/browser/frame_host/render_frame_host_manager_unittest.cc |
| +++ b/content/browser/frame_host/render_frame_host_manager_unittest.cc |
| @@ -5,6 +5,7 @@ |
| #include "base/command_line.h" |
| #include "base/files/file_path.h" |
| #include "base/strings/utf_string_conversions.h" |
| +#include "base/test/histogram_tester.h" |
| #include "base/time/time.h" |
| #include "content/browser/frame_host/cross_site_transferring_request.h" |
| #include "content/browser/frame_host/navigation_before_commit_info.h" |
| @@ -1860,4 +1861,30 @@ TEST_F(RenderFrameHostManagerTest, |
| EXPECT_EQ(kUrl2_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); |
| } |
| +// PlzNavigate: Tests that the navigation histograms are correctly tracked both |
| +// when PlzNavigate is enabled and disabled, and ignores in-tab renderer |
| +// initiated navigation. |
| +// Note: the related histogram, Navigation.TimeToURLJobStart, cannot be tracked |
| +// by this test as the IO thread is not running. |
| +TEST_F(RenderFrameHostManagerTest, BrowserSideNavigationHistogramTest) { |
| + const GURL kUrl0("http://www.google.com/"); |
| + const GURL kUrl1("http://www.chromium.org/"); |
| + base::HistogramTester histo_tester; |
| + |
| + // Performs a "normal" non-PlzNavigate navigation |
| + contents()->NavigateAndCommit(kUrl0); |
| + histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 1); |
| + |
| + // Performs a PlzNavigate navigation |
| + EnableBrowserSideNavigation(); |
| + contents()->NavigateAndCommit(kUrl1); |
| + histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 2); |
| + |
| + // 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
|
| + int32 new_page_id = 1 + contents()->GetMaxPageIDForSiteInstance( |
| + main_test_rfh()->GetSiteInstance()); |
| + main_test_rfh()->SendNavigate(new_page_id, kUrl1); |
| + histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 2); |
| +} |
| + |
| } // namespace content |