| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_
test_harness.h" | 5 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_
test_harness.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "components/page_load_metrics/common/page_load_metrics_messages.h" | 11 #include "components/page_load_metrics/common/page_load_metrics_messages.h" |
| 12 #include "content/public/browser/navigation_entry.h" |
| 13 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/test/web_contents_tester.h" |
| 12 #include "third_party/WebKit/public/web/WebInputEvent.h" | 15 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 13 | 16 |
| 14 namespace page_load_metrics { | 17 namespace page_load_metrics { |
| 15 | 18 |
| 16 namespace { | 19 namespace { |
| 17 | 20 |
| 18 class TestPageLoadMetricsEmbedderInterface | 21 class TestPageLoadMetricsEmbedderInterface |
| 19 : public PageLoadMetricsEmbedderInterface { | 22 : public PageLoadMetricsEmbedderInterface { |
| 20 public: | 23 public: |
| 21 explicit TestPageLoadMetricsEmbedderInterface( | 24 explicit TestPageLoadMetricsEmbedderInterface( |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 const base::HistogramTester& | 131 const base::HistogramTester& |
| 129 PageLoadMetricsObserverTestHarness::histogram_tester() const { | 132 PageLoadMetricsObserverTestHarness::histogram_tester() const { |
| 130 return histogram_tester_; | 133 return histogram_tester_; |
| 131 } | 134 } |
| 132 | 135 |
| 133 const PageLoadExtraInfo | 136 const PageLoadExtraInfo |
| 134 PageLoadMetricsObserverTestHarness::GetPageLoadExtraInfoForCommittedLoad() { | 137 PageLoadMetricsObserverTestHarness::GetPageLoadExtraInfoForCommittedLoad() { |
| 135 return observer_->GetPageLoadExtraInfoForCommittedLoad(); | 138 return observer_->GetPageLoadExtraInfoForCommittedLoad(); |
| 136 } | 139 } |
| 137 | 140 |
| 141 void PageLoadMetricsObserverTestHarness::NavigateWithPageTransitionAndCommit( |
| 142 const GURL& url, |
| 143 ui::PageTransition transition) { |
| 144 controller().LoadURL(url, content::Referrer(), transition, std::string()); |
| 145 int pending_id = controller().GetPendingEntry()->GetUniqueID(); |
| 146 const bool did_create_new_entry = true; |
| 147 content::WebContentsTester::For(web_contents()) |
| 148 ->TestDidNavigate(web_contents()->GetMainFrame(), 1, pending_id, |
| 149 did_create_new_entry, url, transition); |
| 150 } |
| 151 |
| 138 } // namespace page_load_metrics | 152 } // namespace page_load_metrics |
| OLD | NEW |