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

Unified Diff: chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc

Issue 1837233002: Optional <TimeDelta> since they may be non existent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, Fixed non-deterministic tests and Bryan's review comments. Created 4 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/observers/aborts_page_load_metrics_observer_unittest.cc
diff --git a/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc
index 812fb06fb3a1886fe92d41cff7e8853ba5739421..483b7a1fd3096d3a4b92aaed2c78c0c36ee5fe67 100644
--- a/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc
@@ -152,7 +152,20 @@ TEST_F(AbortsPageLoadMetricsObserverTest, NoAbortNewNavigationAfterPaint) {
PopulateRequiredTimingFields(&timing);
NavigateAndCommit(GURL("https://www.google.com"));
SimulateTimingUpdate(timing);
+
+ // If the system clock is low resolution
Charlie Harrison 2016/05/19 18:20:48 Looks like you can fit more words on some of these
shivanisha 2016/05/23 15:06:43 Updated the comment formatting. The current logic
+ // PageLoadTracker's abort time may be <= first_paint.
+ // In that case the histogram will be logged else it will not be logged. This
+ // is a case where we cannot retrieve the above navigation's abort time
+ // in the test since it will be computed and destroyed in the following
+ // NavigateAndCommit call, thus both 0 and 1 counts of histograms is
+ // considered good.
+
NavigateAndCommit(GURL("https://www.example.com"));
- histogram_tester().ExpectTotalCount(
- internal::kHistogramAbortNewNavigationBeforePaint, 0);
+
+ base::HistogramTester::CountsMap counts_map =
+ histogram_tester().GetTotalCountsForPrefix(
+ internal::kHistogramAbortNewNavigationBeforePaint);
+
+ EXPECT_TRUE(counts_map.empty() || counts_map.begin()->second == 1);
}

Powered by Google App Engine
This is Rietveld 408576698