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

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

Issue 2729893002: Page load metrics: improve flaky CSSTiming (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bd43931446f71d19bd76b7e1b020774e849e76cb..b1db1900d6cc6f6516562c43184f511b835c7b61 100644
--- a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
+++ b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
@@ -45,7 +45,8 @@ class TimingUpdatedObserver : public content::BrowserMessageFilter {
// A bitvector to express which timing fields to match on.
enum ExpectedTimingFields {
FIRST_PAINT = 1 << 0,
- FIRST_CONTENTFUL_PAINT = 1 << 1
+ FIRST_CONTENTFUL_PAINT = 1 << 1,
+ STYLE_UPDATE_BEFORE_FCP = 1 << 2
};
explicit TimingUpdatedObserver(content::RenderWidgetHost* render_widget_host)
@@ -112,7 +113,9 @@ class TimingUpdatedObserver : public content::BrowserMessageFilter {
if ((!(matching_fields_ & FIRST_PAINT) || timing.first_paint) &&
(!(matching_fields_ & FIRST_CONTENTFUL_PAINT) ||
- timing.first_contentful_paint)) {
+ timing.first_contentful_paint) &&
+ (!(matching_fields_ & STYLE_UPDATE_BEFORE_FCP) ||
+ timing.style_sheet_timing.update_style_duration_before_fcp)) {
// Ensure that any other handlers of this message, for example the real
// PageLoadMetric observers, get a chance to handle this message before
// this waiter unblocks.
@@ -719,6 +722,11 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest,
IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, CSSTiming) {
ASSERT_TRUE(embedded_test_server()->Start());
+ scoped_refptr<TimingUpdatedObserver> fcp_observer =
+ CreateTimingUpdatedObserver();
+ fcp_observer->AddMatchingFields(
+ TimingUpdatedObserver::STYLE_UPDATE_BEFORE_FCP);
+
// Careful: Blink code clamps timestamps to 5us, so any CSS parsing we do here
// must take >> 5us, otherwise we'll log 0 for the value and it will remain
// unset here.
@@ -726,6 +734,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, CSSTiming) {
browser(),
embedded_test_server()->GetURL("/page_load_metrics/page_with_css.html"));
NavigateToUntrackedUrl();
+ fcp_observer->WaitForMatchingIPC();
histogram_tester_.ExpectTotalCount(internal::kHistogramFirstContentfulPaint,
1);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698