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

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: FREEZE.unindexed - took merge and fixed it up 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 143
144 void PageLoadMetricsObserverTestHarness::SimulateTimingAndMetadataUpdate( 144 void PageLoadMetricsObserverTestHarness::SimulateTimingAndMetadataUpdate(
145 const PageLoadTiming& timing, 145 const PageLoadTiming& timing,
146 const PageLoadMetadata& metadata) { 146 const PageLoadMetadata& metadata) {
147 observer_->OnMessageReceived(PageLoadMetricsMsg_TimingUpdated( 147 observer_->OnMessageReceived(PageLoadMetricsMsg_TimingUpdated(
148 observer_->routing_id(), timing, metadata), 148 observer_->routing_id(), timing, metadata),
149 web_contents()->GetMainFrame()); 149 web_contents()->GetMainFrame());
150 } 150 }
151 151
152 void PageLoadMetricsObserverTestHarness::SimulateStartedResource(
153 const ExtraRequestStartInfo& info) {
154 observer_->OnRequestStarted(content::GlobalRequestID(), info.resource_type,
155 base::TimeTicks::Now());
156 }
157
152 void PageLoadMetricsObserverTestHarness::SimulateLoadedResource( 158 void PageLoadMetricsObserverTestHarness::SimulateLoadedResource(
153 const ExtraRequestInfo& info) { 159 const ExtraRequestCompleteInfo& info) {
154 observer_->OnRequestComplete(content::GlobalRequestID(), 160 observer_->OnRequestComplete(content::GlobalRequestID(),
155 content::RESOURCE_TYPE_SCRIPT, info.was_cached, 161 content::RESOURCE_TYPE_SCRIPT, info.was_cached,
156 info.data_reduction_proxy_data 162 info.data_reduction_proxy_data
157 ? info.data_reduction_proxy_data->DeepCopy() 163 ? info.data_reduction_proxy_data->DeepCopy()
158 : nullptr, 164 : nullptr,
159 info.raw_body_bytes, 165 info.raw_body_bytes,
160 info.original_network_content_length, 166 info.original_network_content_length,
161 base::TimeTicks::Now()); 167 base::TimeTicks::Now());
162 } 168 }
163 169
(...skipping 25 matching lines...) Expand all
189 } 195 }
190 196
191 void PageLoadMetricsObserverTestHarness::NavigateWithPageTransitionAndCommit( 197 void PageLoadMetricsObserverTestHarness::NavigateWithPageTransitionAndCommit(
192 const GURL& url, 198 const GURL& url,
193 ui::PageTransition transition) { 199 ui::PageTransition transition) {
194 controller().LoadURL(url, content::Referrer(), transition, std::string()); 200 controller().LoadURL(url, content::Referrer(), transition, std::string());
195 content::WebContentsTester::For(web_contents())->CommitPendingNavigation(); 201 content::WebContentsTester::For(web_contents())->CommitPendingNavigation();
196 } 202 }
197 203
198 } // namespace page_load_metrics 204 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698