Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc

Issue 2056153002: Convert PageLoadMetrics to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/components_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_param_traits.h"
12 #include "content/public/browser/navigation_entry.h" 12 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/test/web_contents_tester.h" 14 #include "content/public/test/web_contents_tester.h"
15 #include "third_party/WebKit/public/web/WebInputEvent.h" 15 #include "third_party/WebKit/public/web/WebInputEvent.h"
16 16
17 namespace page_load_metrics { 17 namespace page_load_metrics {
18 18
19 namespace { 19 namespace {
20 20
21 class TestPageLoadMetricsEmbedderInterface 21 class TestPageLoadMetricsEmbedderInterface
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 void PageLoadMetricsObserverTestHarness::SimulateTimingUpdate( 118 void PageLoadMetricsObserverTestHarness::SimulateTimingUpdate(
119 const PageLoadTiming& timing) { 119 const PageLoadTiming& timing) {
120 SimulateTimingAndMetadataUpdate(timing, PageLoadMetadata()); 120 SimulateTimingAndMetadataUpdate(timing, PageLoadMetadata());
121 } 121 }
122 122
123 void PageLoadMetricsObserverTestHarness::SimulateTimingAndMetadataUpdate( 123 void PageLoadMetricsObserverTestHarness::SimulateTimingAndMetadataUpdate(
124 const PageLoadTiming& timing, 124 const PageLoadTiming& timing,
125 const PageLoadMetadata& metadata) { 125 const PageLoadMetadata& metadata) {
126 observer_->OnMessageReceived(PageLoadMetricsMsg_TimingUpdated( 126 observer_->OnTimingUpdated(web_contents()->GetMainFrame(), timing, metadata);
127 observer_->routing_id(), timing, metadata),
128 web_contents()->GetMainFrame());
129 } 127 }
130 128
131 void PageLoadMetricsObserverTestHarness::SimulateInputEvent( 129 void PageLoadMetricsObserverTestHarness::SimulateInputEvent(
132 const blink::WebInputEvent& event) { 130 const blink::WebInputEvent& event) {
133 observer_->OnInputEvent(event); 131 observer_->OnInputEvent(event);
134 } 132 }
135 133
136 const base::HistogramTester& 134 const base::HistogramTester&
137 PageLoadMetricsObserverTestHarness::histogram_tester() const { 135 PageLoadMetricsObserverTestHarness::histogram_tester() const {
138 return histogram_tester_; 136 return histogram_tester_;
139 } 137 }
140 138
141 const PageLoadExtraInfo 139 const PageLoadExtraInfo
142 PageLoadMetricsObserverTestHarness::GetPageLoadExtraInfoForCommittedLoad() { 140 PageLoadMetricsObserverTestHarness::GetPageLoadExtraInfoForCommittedLoad() {
143 return observer_->GetPageLoadExtraInfoForCommittedLoad(); 141 return observer_->GetPageLoadExtraInfoForCommittedLoad();
144 } 142 }
145 143
146 void PageLoadMetricsObserverTestHarness::NavigateWithPageTransitionAndCommit( 144 void PageLoadMetricsObserverTestHarness::NavigateWithPageTransitionAndCommit(
147 const GURL& url, 145 const GURL& url,
148 ui::PageTransition transition) { 146 ui::PageTransition transition) {
149 controller().LoadURL(url, content::Referrer(), transition, std::string()); 147 controller().LoadURL(url, content::Referrer(), transition, std::string());
150 int pending_id = controller().GetPendingEntry()->GetUniqueID(); 148 int pending_id = controller().GetPendingEntry()->GetUniqueID();
151 const bool did_create_new_entry = true; 149 const bool did_create_new_entry = true;
152 content::WebContentsTester::For(web_contents()) 150 content::WebContentsTester::For(web_contents())
153 ->TestDidNavigate(web_contents()->GetMainFrame(), 1, pending_id, 151 ->TestDidNavigate(web_contents()->GetMainFrame(), 1, pending_id,
154 did_create_new_entry, url, transition); 152 did_create_new_entry, url, transition);
155 } 153 }
156 154
157 } // namespace page_load_metrics 155 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « no previous file | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698