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

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: Minor changes for addressing CR comments 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 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

Powered by Google App Engine
This is Rietveld 408576698