OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/page_load_metrics/browser/metrics_web_contents_observer.h" | 5 #include "components/page_load_metrics/browser/metrics_web_contents_observer.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 AssertNoTimingReported(); | 277 AssertNoTimingReported(); |
278 CheckErrorEvent(ERR_IPC_WITH_NO_RELEVANT_LOAD, 1); | 278 CheckErrorEvent(ERR_IPC_WITH_NO_RELEVANT_LOAD, 1); |
279 CheckTotalErrorEvents(); | 279 CheckTotalErrorEvents(); |
280 } | 280 } |
281 | 281 |
282 TEST_F(MetricsWebContentsObserverTest, DontLogAbortChains) { | 282 TEST_F(MetricsWebContentsObserverTest, DontLogAbortChains) { |
283 NavigateAndCommit(GURL(kDefaultTestUrl)); | 283 NavigateAndCommit(GURL(kDefaultTestUrl)); |
284 NavigateAndCommit(GURL(kDefaultTestUrl2)); | 284 NavigateAndCommit(GURL(kDefaultTestUrl2)); |
285 NavigateAndCommit(GURL(kDefaultTestUrl)); | 285 NavigateAndCommit(GURL(kDefaultTestUrl)); |
286 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNewNavigation, 0); | 286 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNewNavigation, 0); |
287 CheckErrorEvent(ERR_NO_IPCS_RECEIVED, 2); | 287 CheckNoErrorEvents(); |
288 CheckTotalErrorEvents(); | 288 CheckTotalErrorEvents(); |
289 } | 289 } |
290 | 290 |
291 TEST_F(MetricsWebContentsObserverTest, LogAbortChains) { | 291 TEST_F(MetricsWebContentsObserverTest, LogAbortChains) { |
292 content::WebContentsTester* web_contents_tester = | 292 content::WebContentsTester* web_contents_tester = |
293 content::WebContentsTester::For(web_contents()); | 293 content::WebContentsTester::For(web_contents()); |
294 content::RenderFrameHostTester* rfh_tester = | 294 content::RenderFrameHostTester* rfh_tester = |
295 content::RenderFrameHostTester::For(main_rfh()); | 295 content::RenderFrameHostTester::For(main_rfh()); |
296 // Start and abort three loads before one finally commits. | 296 // Start and abort three loads before one finally commits. |
297 web_contents_tester->StartNavigation(GURL(kDefaultTestUrl)); | 297 web_contents_tester->StartNavigation(GURL(kDefaultTestUrl)); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 rfh_tester->SimulateNavigationStop(); | 358 rfh_tester->SimulateNavigationStop(); |
359 | 359 |
360 web_contents()->Stop(); | 360 web_contents()->Stop(); |
361 | 361 |
362 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNoCommit, 1); | 362 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNoCommit, 1); |
363 histogram_tester_.ExpectBucketCount(internal::kAbortChainSizeNoCommit, 3, | 363 histogram_tester_.ExpectBucketCount(internal::kAbortChainSizeNoCommit, 3, |
364 1); | 364 1); |
365 } | 365 } |
366 | 366 |
367 } // namespace page_load_metrics | 367 } // namespace page_load_metrics |
OLD | NEW |