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

Side by Side Diff: content/test/test_web_contents.cc

Issue 1721813002: Adding DRP specfic UMA for FirstContentfulPaint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/test/test_web_contents.h" 5 #include "content/test/test_web_contents.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/browser_url_handler_impl.h" 9 #include "content/browser/browser_url_handler_impl.h"
10 #include "content/browser/frame_host/cross_process_frame_connector.h" 10 #include "content/browser/frame_host/cross_process_frame_connector.h"
(...skipping 12 matching lines...) Expand all
23 #include "content/public/test/mock_render_process_host.h" 23 #include "content/public/test/mock_render_process_host.h"
24 #include "content/test/test_render_view_host.h" 24 #include "content/test/test_render_view_host.h"
25 #include "ui/base/page_transition_types.h" 25 #include "ui/base/page_transition_types.h"
26 26
27 namespace content { 27 namespace content {
28 28
29 TestWebContents::TestWebContents(BrowserContext* browser_context) 29 TestWebContents::TestWebContents(BrowserContext* browser_context)
30 : WebContentsImpl(browser_context), 30 : WebContentsImpl(browser_context),
31 delegate_view_override_(NULL), 31 delegate_view_override_(NULL),
32 expect_set_history_offset_and_length_(false), 32 expect_set_history_offset_and_length_(false),
33 expect_set_history_offset_and_length_history_length_(0) { 33 expect_set_history_offset_and_length_history_length_(0),
34 } 34 simulate_fetch_via_data_reduction_proxy_(false) {}
35 35
36 TestWebContents* TestWebContents::Create(BrowserContext* browser_context, 36 TestWebContents* TestWebContents::Create(BrowserContext* browser_context,
37 SiteInstance* instance) { 37 SiteInstance* instance) {
38 TestWebContents* test_web_contents = new TestWebContents(browser_context); 38 TestWebContents* test_web_contents = new TestWebContents(browser_context);
39 test_web_contents->Init(WebContents::CreateParams(browser_context, instance)); 39 test_web_contents->Init(WebContents::CreateParams(browser_context, instance));
40 return test_web_contents; 40 return test_web_contents;
41 } 41 }
42 42
43 TestWebContents::~TestWebContents() { 43 TestWebContents::~TestWebContents() {
44 EXPECT_FALSE(expect_set_history_offset_and_length_); 44 EXPECT_FALSE(expect_set_history_offset_and_length_);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 params.should_update_history = false; 131 params.should_update_history = false;
132 params.searchable_form_url = GURL(); 132 params.searchable_form_url = GURL();
133 params.searchable_form_encoding = std::string(); 133 params.searchable_form_encoding = std::string();
134 params.did_create_new_entry = did_create_new_entry; 134 params.did_create_new_entry = did_create_new_entry;
135 params.security_info = std::string(); 135 params.security_info = std::string();
136 params.gesture = NavigationGestureUser; 136 params.gesture = NavigationGestureUser;
137 params.was_within_same_page = false; 137 params.was_within_same_page = false;
138 params.is_post = false; 138 params.is_post = false;
139 params.page_state = PageState::CreateFromURL(url); 139 params.page_state = PageState::CreateFromURL(url);
140 params.contents_mime_type = std::string("text/html"); 140 params.contents_mime_type = std::string("text/html");
141 params.was_fetched_via_data_reduction_proxy =
142 simulate_fetch_via_data_reduction_proxy_;
141 143
142 rfh->SendNavigateWithParams(&params); 144 rfh->SendNavigateWithParams(&params);
143 } 145 }
144 146
145 const std::string& TestWebContents::GetSaveFrameHeaders() { 147 const std::string& TestWebContents::GetSaveFrameHeaders() {
146 return save_frame_headers_; 148 return save_frame_headers_;
147 } 149 }
148 150
149 bool TestWebContents::CrossProcessNavigationPending() { 151 bool TestWebContents::CrossProcessNavigationPending() {
150 if (IsBrowserSideNavigationEnabled()) { 152 if (IsBrowserSideNavigationEnabled()) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 CHECK(!browser_side_navigation || rfh->is_loading()); 226 CHECK(!browser_side_navigation || rfh->is_loading());
225 CHECK(!browser_side_navigation || 227 CHECK(!browser_side_navigation ||
226 !rfh->frame_tree_node()->navigation_request()); 228 !rfh->frame_tree_node()->navigation_request());
227 229
228 int page_id = entry->GetPageID(); 230 int page_id = entry->GetPageID();
229 if (page_id == -1) { 231 if (page_id == -1) {
230 // It's a new navigation, assign a never-seen page id to it. 232 // It's a new navigation, assign a never-seen page id to it.
231 page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1; 233 page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1;
232 } 234 }
233 235
236 rfh->set_simulate_fetch_via_data_reduction_proxy(
237 simulate_fetch_via_data_reduction_proxy_);
234 rfh->SendNavigate(page_id, entry->GetUniqueID(), 238 rfh->SendNavigate(page_id, entry->GetUniqueID(),
235 GetController().GetPendingEntryIndex() == -1, 239 GetController().GetPendingEntryIndex() == -1,
236 entry->GetURL()); 240 entry->GetURL());
241 rfh->set_simulate_fetch_via_data_reduction_proxy(false);
237 // Simulate the SwapOut_ACK. This is needed when cross-site navigation 242 // Simulate the SwapOut_ACK. This is needed when cross-site navigation
238 // happens. 243 // happens.
239 if (old_rfh != rfh) 244 if (old_rfh != rfh)
240 old_rfh->OnSwappedOut(); 245 old_rfh->OnSwappedOut();
241 } 246 }
242 247
243 void TestWebContents::ProceedWithCrossSiteNavigation() { 248 void TestWebContents::ProceedWithCrossSiteNavigation() {
244 if (!GetPendingMainFrame()) 249 if (!GetPendingMainFrame())
245 return; 250 return;
246 GetMainFrame()->SendBeforeUnloadACK(true); 251 GetMainFrame()->SendBeforeUnloadACK(true);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { 327 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) {
323 } 328 }
324 329
325 void TestWebContents::SaveFrameWithHeaders(const GURL& url, 330 void TestWebContents::SaveFrameWithHeaders(const GURL& url,
326 const Referrer& referrer, 331 const Referrer& referrer,
327 const std::string& headers) { 332 const std::string& headers) {
328 save_frame_headers_ = headers; 333 save_frame_headers_ = headers;
329 } 334 }
330 335
331 } // namespace content 336 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698