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

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

Issue 577963002: Add time-to-network histogram considering browser side navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing new build issues 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/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/frame_host/render_frame_proxy_host.h" 18 #include "content/browser/frame_host/render_frame_proxy_host.h"
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 render_manager->CommitNavigation(nbc_info); 1858 render_manager->CommitNavigation(nbc_info);
1858 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); 1859 EXPECT_EQ(kUrl0_site, main_test_rfh()->GetSiteInstance()->GetSiteURL());
1859 1860
1860 // Confirms that a valid, request-matching commit is correctly processed. 1861 // Confirms that a valid, request-matching commit is correctly processed.
1861 nbc_info.navigation_url = kUrl2; 1862 nbc_info.navigation_url = kUrl2;
1862 nbc_info.navigation_request_id = request_id2; 1863 nbc_info.navigation_request_id = request_id2;
1863 render_manager->CommitNavigation(nbc_info); 1864 render_manager->CommitNavigation(nbc_info);
1864 EXPECT_EQ(kUrl2_site, main_test_rfh()->GetSiteInstance()->GetSiteURL()); 1865 EXPECT_EQ(kUrl2_site, main_test_rfh()->GetSiteInstance()->GetSiteURL());
1865 } 1866 }
1866 1867
1868 // PlzNavigate: Tests that the navigation histograms are correctly tracked both
1869 // when PlzNavigate is enabled and disabled, and also ignores in-tab renderer
1870 // initiated navigation for the non-enabled case.
1871 // Note: the related histogram, Navigation.TimeToURLJobStart, cannot be tracked
1872 // by this test as the IO thread is not running.
1873 TEST_F(RenderFrameHostManagerTest, BrowserSideNavigationHistogramTest) {
1874 const GURL kUrl0("http://www.google.com/");
1875 const GURL kUrl1("http://www.chromium.org/");
1876 base::HistogramTester histo_tester;
1877
1878 // Performs a "normal" non-PlzNavigate navigation
1879 contents()->NavigateAndCommit(kUrl0);
1880 histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 1);
1881
1882 // Performs an in-tab renderer initiated navigation
1883 int32 new_page_id = 1 + contents()->GetMaxPageIDForSiteInstance(
1884 main_test_rfh()->GetSiteInstance());
1885 main_test_rfh()->SendNavigate(new_page_id, kUrl0);
1886 histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 1);
1887
1888 // Performs a PlzNavigate navigation
1889 EnableBrowserSideNavigation();
1890 contents()->NavigateAndCommit(kUrl1);
1891 histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 2);
1892 }
1893
1867 } // namespace content 1894 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698