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 21 matching lines...) Expand all Loading... |
32 // provided std::vector, so they can be analyzed by unit tests. | 32 // provided std::vector, so they can be analyzed by unit tests. |
33 class TestPageLoadMetricsObserver : public PageLoadMetricsObserver { | 33 class TestPageLoadMetricsObserver : public PageLoadMetricsObserver { |
34 public: | 34 public: |
35 explicit TestPageLoadMetricsObserver( | 35 explicit TestPageLoadMetricsObserver( |
36 std::vector<PageLoadTiming>* observed_timings, | 36 std::vector<PageLoadTiming>* observed_timings, |
37 std::vector<GURL>* observed_committed_urls) | 37 std::vector<GURL>* observed_committed_urls) |
38 : observed_timings_(observed_timings), | 38 : observed_timings_(observed_timings), |
39 observed_committed_urls_(observed_committed_urls) {} | 39 observed_committed_urls_(observed_committed_urls) {} |
40 | 40 |
41 void OnStart(content::NavigationHandle* navigation_handle, | 41 void OnStart(content::NavigationHandle* navigation_handle, |
| 42 content::WebContents* web_contents, |
42 const GURL& currently_committed_url) override { | 43 const GURL& currently_committed_url) override { |
43 observed_committed_urls_->push_back(currently_committed_url); | 44 observed_committed_urls_->push_back(currently_committed_url); |
44 } | 45 } |
45 | 46 |
46 void OnComplete(const PageLoadTiming& timing, | 47 void OnComplete(const PageLoadTiming& timing, |
47 const PageLoadExtraInfo& extra_info) override { | 48 const PageLoadExtraInfo& extra_info) override { |
48 observed_timings_->push_back(timing); | 49 observed_timings_->push_back(timing); |
49 } | 50 } |
50 | 51 |
51 private: | 52 private: |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 rfh_tester->SimulateNavigationStop(); | 408 rfh_tester->SimulateNavigationStop(); |
408 | 409 |
409 web_contents()->Stop(); | 410 web_contents()->Stop(); |
410 | 411 |
411 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNoCommit, 1); | 412 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNoCommit, 1); |
412 histogram_tester_.ExpectBucketCount(internal::kAbortChainSizeNoCommit, 3, | 413 histogram_tester_.ExpectBucketCount(internal::kAbortChainSizeNoCommit, 3, |
413 1); | 414 1); |
414 } | 415 } |
415 | 416 |
416 } // namespace page_load_metrics | 417 } // namespace page_load_metrics |
OLD | NEW |