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

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

Issue 2780003003: Send an event to the page load metrics to track resource starting. (Closed)
Patch Set: Fix browser tests Created 3 years, 8 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
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 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 void PageLoadMetricsObserverTestHarness::SimulateTimingAndMetadataUpdate( 131 void PageLoadMetricsObserverTestHarness::SimulateTimingAndMetadataUpdate(
132 const PageLoadTiming& timing, 132 const PageLoadTiming& timing,
133 const PageLoadMetadata& metadata) { 133 const PageLoadMetadata& metadata) {
134 observer_->OnMessageReceived(PageLoadMetricsMsg_TimingUpdated( 134 observer_->OnMessageReceived(PageLoadMetricsMsg_TimingUpdated(
135 observer_->routing_id(), timing, metadata), 135 observer_->routing_id(), timing, metadata),
136 web_contents()->GetMainFrame()); 136 web_contents()->GetMainFrame());
137 } 137 }
138 138
139 void PageLoadMetricsObserverTestHarness::SimulateStartedResource(
140 const ExtraRequestStartInfo& info) {
141 observer_->OnRequestStarted(content::GlobalRequestID(), info.resource_type,
142 base::TimeTicks::Now());
143 }
144
139 void PageLoadMetricsObserverTestHarness::SimulateLoadedResource( 145 void PageLoadMetricsObserverTestHarness::SimulateLoadedResource(
140 const ExtraRequestInfo& info) { 146 const ExtraRequestCompleteInfo& info) {
141 observer_->OnRequestComplete( 147 observer_->OnRequestComplete(
142 content::GlobalRequestID(), content::RESOURCE_TYPE_SCRIPT, 148 content::GlobalRequestID(), content::RESOURCE_TYPE_SCRIPT,
143 info.was_cached, info.data_reduction_proxy_used, info.raw_body_bytes, 149 info.was_cached, info.data_reduction_proxy_used, info.raw_body_bytes,
144 info.original_network_content_length, base::TimeTicks::Now()); 150 info.original_network_content_length, base::TimeTicks::Now());
145 } 151 }
146 152
147 void PageLoadMetricsObserverTestHarness::SimulateInputEvent( 153 void PageLoadMetricsObserverTestHarness::SimulateInputEvent(
148 const blink::WebInputEvent& event) { 154 const blink::WebInputEvent& event) {
149 observer_->OnInputEvent(event); 155 observer_->OnInputEvent(event);
150 } 156 }
(...skipping 21 matching lines...) Expand all
172 } 178 }
173 179
174 void PageLoadMetricsObserverTestHarness::NavigateWithPageTransitionAndCommit( 180 void PageLoadMetricsObserverTestHarness::NavigateWithPageTransitionAndCommit(
175 const GURL& url, 181 const GURL& url,
176 ui::PageTransition transition) { 182 ui::PageTransition transition) {
177 controller().LoadURL(url, content::Referrer(), transition, std::string()); 183 controller().LoadURL(url, content::Referrer(), transition, std::string());
178 content::WebContentsTester::For(web_contents())->CommitPendingNavigation(); 184 content::WebContentsTester::For(web_contents())->CommitPendingNavigation();
179 } 185 }
180 186
181 } // namespace page_load_metrics 187 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698