| Index: components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
|
| diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc b/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
|
| index b1f3228fd9c5529e40fbf03ea14f220d5eb51bdf..5dbfa12e11e018f8eb2d601244fc05a98d73d188 100644
|
| --- a/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
|
| +++ b/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
|
| @@ -440,6 +440,63 @@ TEST_F(MetricsWebContentsObserverTest, DontBackgroundQuickerLoad) {
|
| histogram_tester_.ExpectBucketCount(kHistogramFirstLayout,
|
| first_layout.InMilliseconds(), 1);
|
| histogram_tester_.ExpectTotalCount(kHistogramFirstTextPaint, 0);
|
| +
|
| + histogram_tester_.ExpectTotalCount(kHistogramProvisionalAbortNewNavigation,
|
| + 1);
|
| +}
|
| +
|
| +TEST_F(MetricsWebContentsObserverTest, AbortStopClose) {
|
| + PageLoadTiming timing;
|
| + timing.navigation_start = base::Time::FromDoubleT(1);
|
| + content::WebContentsTester* web_contents_tester =
|
| + content::WebContentsTester::For(web_contents());
|
| + web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl));
|
| + observer_->OnMessageReceived(
|
| + PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing),
|
| + main_rfh());
|
| + // Simulate the user pressing the stop button.
|
| + observer_->NavigationStopped();
|
| + web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2));
|
| + observer_->OnMessageReceived(
|
| + PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing),
|
| + main_rfh());
|
| + // Kill the MetricsWebContentsObserver to simulate closing the tab.
|
| + observer_.reset();
|
| + histogram_tester_.ExpectTotalCount(kHistogramCommittedAbortStop, 1);
|
| + histogram_tester_.ExpectTotalCount(kHistogramCommittedAbortClose, 1);
|
| +}
|
| +
|
| +TEST_F(MetricsWebContentsObserverTest, AbortNewNavigation) {
|
| + PageLoadTiming timing;
|
| + timing.navigation_start = base::Time::FromDoubleT(1);
|
| + content::WebContentsTester* web_contents_tester =
|
| + content::WebContentsTester::For(web_contents());
|
| + web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl));
|
| + observer_->OnMessageReceived(
|
| + PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing),
|
| + main_rfh());
|
| + // Simulate the user performaning another navigation before first paint.
|
| + web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2));
|
| + histogram_tester_.ExpectTotalCount(kHistogramCommittedAbortNewNavigation, 1);
|
| +}
|
| +
|
| +TEST_F(MetricsWebContentsObserverTest, AbortBackground) {
|
| + PageLoadTiming timing;
|
| + timing.navigation_start = base::Time::FromDoubleT(1);
|
| + timing.first_paint = base::TimeDelta::FromSeconds(10);
|
| + content::WebContentsTester* web_contents_tester =
|
| + content::WebContentsTester::For(web_contents());
|
| + web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl));
|
| + // Background the tab and go for a coffee or something.
|
| + observer_->WasHidden();
|
| + observer_->OnMessageReceived(
|
| + PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing),
|
| + main_rfh());
|
| + // Come back and start browsing again.
|
| + observer_->WasShown();
|
| + // Simulate the user performaning another navigation.
|
| + web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2));
|
| + histogram_tester_.ExpectTotalCount(kHistogramCommittedAbortBackground, 1);
|
| }
|
|
|
| TEST_F(MetricsWebContentsObserverTest, FailProvisionalLoad) {
|
|
|