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

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: CR feedback per RyanSturm 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 void PageLoadMetricsObserverTestHarness::SimulateTimingAndMetadataUpdate( 143 void PageLoadMetricsObserverTestHarness::SimulateTimingAndMetadataUpdate(
144 const PageLoadTiming& timing, 144 const PageLoadTiming& timing,
145 const PageLoadMetadata& metadata) { 145 const PageLoadMetadata& metadata) {
146 observer_->OnMessageReceived(PageLoadMetricsMsg_TimingUpdated( 146 observer_->OnMessageReceived(PageLoadMetricsMsg_TimingUpdated(
147 observer_->routing_id(), timing, metadata), 147 observer_->routing_id(), timing, metadata),
148 web_contents()->GetMainFrame()); 148 web_contents()->GetMainFrame());
149 } 149 }
150 150
151 void PageLoadMetricsObserverTestHarness::SimulateStartedResource(
152 const ExtraRequestStartInfo& info) {
153 observer_->OnRequestStarted(content::GlobalRequestID(), info.resource_type,
154 base::TimeTicks::Now());
155 }
156
151 void PageLoadMetricsObserverTestHarness::SimulateLoadedResource( 157 void PageLoadMetricsObserverTestHarness::SimulateLoadedResource(
152 const ExtraRequestInfo& info) { 158 const ExtraRequestCompleteInfo& info) {
153 observer_->OnRequestComplete( 159 observer_->OnRequestComplete(
154 content::GlobalRequestID(), content::RESOURCE_TYPE_SCRIPT, 160 content::GlobalRequestID(), content::RESOURCE_TYPE_SCRIPT,
155 info.was_cached, info.data_reduction_proxy_used, info.raw_body_bytes, 161 info.was_cached, info.data_reduction_proxy_used, info.raw_body_bytes,
156 info.original_network_content_length, base::TimeTicks::Now()); 162 info.original_network_content_length, base::TimeTicks::Now());
157 } 163 }
158 164
159 void PageLoadMetricsObserverTestHarness::SimulateInputEvent( 165 void PageLoadMetricsObserverTestHarness::SimulateInputEvent(
160 const blink::WebInputEvent& event) { 166 const blink::WebInputEvent& event) {
161 observer_->OnInputEvent(event); 167 observer_->OnInputEvent(event);
162 } 168 }
(...skipping 21 matching lines...) Expand all
184 } 190 }
185 191
186 void PageLoadMetricsObserverTestHarness::NavigateWithPageTransitionAndCommit( 192 void PageLoadMetricsObserverTestHarness::NavigateWithPageTransitionAndCommit(
187 const GURL& url, 193 const GURL& url,
188 ui::PageTransition transition) { 194 ui::PageTransition transition) {
189 controller().LoadURL(url, content::Referrer(), transition, std::string()); 195 controller().LoadURL(url, content::Referrer(), transition, std::string());
190 content::WebContentsTester::For(web_contents())->CommitPendingNavigation(); 196 content::WebContentsTester::For(web_contents())->CommitPendingNavigation();
191 } 197 }
192 198
193 } // namespace page_load_metrics 199 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698