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

Unified Diff: chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc

Issue 2894973002: Provide WebContents::CreateParams to tab helpers. (Closed)
Patch Set: rebase Created 3 years, 7 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: chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
index 57e3b3ea0f6354e84656c09afbaf53552233374f..0bfd94916283c6b0d18365a65e4f0d7a4c7793a3 100644
--- a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
+++ b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
@@ -342,6 +342,31 @@ IN_PROC_BROWSER_TEST_P(PageLoadMetricsBrowserTest, NewPage) {
EXPECT_FALSE(NoPageLoadMetricsRecorded());
}
+IN_PROC_BROWSER_TEST_P(PageLoadMetricsBrowserTest, NewPageInNewForegroundTab) {
+ ASSERT_TRUE(embedded_test_server()->Start());
+
+ // The IPCTypeVerifier watches for IPCs in the main web contents. This test
+ // navigates in a new web contents, so we need to indicate that we expect no
+ // timing updates in the main web contents.
+ ExpectNoTimingUpdates();
+
+ chrome::NavigateParams params(browser(),
+ embedded_test_server()->GetURL("/title1.html"),
+ ui::PAGE_TRANSITION_LINK);
+ params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
+ chrome::Navigate(&params);
+ auto waiter = base::MakeUnique<PageLoadMetricsWaiter>(params.target_contents);
+ waiter->AddMainFrameExpectation(TimingField::LOAD_EVENT);
+ waiter->Wait();
+
+ // Due to crbug.com/725347, with browser side navigation enabled, navigations
+ // in new tabs were recorded as starting in the background. Here we verify
+ // that navigations initiated in a new tab are recorded as happening in the
+ // foreground.
+ histogram_tester_.ExpectTotalCount(internal::kHistogramLoad, 1);
+ histogram_tester_.ExpectTotalCount(internal::kBackgroundHistogramLoad, 0);
+}
+
IN_PROC_BROWSER_TEST_P(PageLoadMetricsBrowserTest, NoPaintForEmptyDocument) {
ASSERT_TRUE(embedded_test_server()->Start());

Powered by Google App Engine
This is Rietveld 408576698