Chromium Code Reviews| 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); |
| } |