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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
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 69ea6f3f596ce7704a36afcd85d5aea1de114ee8..8d2cf170728132eb0e2147ec4559a3bb6dc6ebb0 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"
@@ -1864,4 +1865,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 also ignores in-tab renderer
+// initiated navigation for the non-enabled case.
+// 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 an in-tab renderer initiated navigation
+ int32 new_page_id = 1 + contents()->GetMaxPageIDForSiteInstance(
+ main_test_rfh()->GetSiteInstance());
+ main_test_rfh()->SendNavigate(new_page_id, kUrl0);
+ histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 1);
+
+ // Performs a PlzNavigate navigation
+ EnableBrowserSideNavigation();
+ contents()->NavigateAndCommit(kUrl1);
+ histo_tester.ExpectTotalCount("Navigation.TimeToCommit", 2);
+}
+
} // namespace content
« 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