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

Unified 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 a DRP PageLoadMetricsObserver 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 side-by-side diff with in-line comments
Download patch
Index: content/test/test_web_contents.cc
diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc
index c424f939f82602b0c376637bef1bd4e7e7432fa2..55c71c0ed775c10afca2882fadb32efa17950882 100644
--- a/content/test/test_web_contents.cc
+++ b/content/test/test_web_contents.cc
@@ -23,22 +23,22 @@
#include "content/public/test/mock_render_process_host.h"
#include "content/test/test_render_view_host.h"
#include "ui/base/page_transition_types.h"
namespace content {
TestWebContents::TestWebContents(BrowserContext* browser_context)
: WebContentsImpl(browser_context),
delegate_view_override_(NULL),
expect_set_history_offset_and_length_(false),
- expect_set_history_offset_and_length_history_length_(0) {
-}
+ expect_set_history_offset_and_length_history_length_(0),
+ simulate_fetch_via_data_reduction_proxy_(false) {}
TestWebContents* TestWebContents::Create(BrowserContext* browser_context,
SiteInstance* instance) {
TestWebContents* test_web_contents = new TestWebContents(browser_context);
test_web_contents->Init(WebContents::CreateParams(browser_context, instance));
return test_web_contents;
}
TestWebContents::~TestWebContents() {
EXPECT_FALSE(expect_set_history_offset_and_length_);
@@ -131,20 +131,21 @@ void TestWebContents::TestDidNavigateWithReferrer(
params.should_update_history = false;
params.searchable_form_url = GURL();
params.searchable_form_encoding = std::string();
params.did_create_new_entry = did_create_new_entry;
params.security_info = std::string();
params.gesture = NavigationGestureUser;
params.was_within_same_page = false;
params.is_post = false;
params.page_state = PageState::CreateFromURL(url);
params.contents_mime_type = std::string("text/html");
+ params.used_data_reduction_proxy = simulate_fetch_via_data_reduction_proxy_;
rfh->SendNavigateWithParams(&params);
}
const std::string& TestWebContents::GetSaveFrameHeaders() {
return save_frame_headers_;
}
bool TestWebContents::CrossProcessNavigationPending() {
if (IsBrowserSideNavigationEnabled()) {
@@ -245,23 +246,26 @@ void TestWebContents::CommitPendingNavigation() {
CHECK(!browser_side_navigation || rfh->is_loading());
CHECK(!browser_side_navigation ||
!rfh->frame_tree_node()->navigation_request());
int page_id = entry->GetPageID();
if (page_id == -1) {
// It's a new navigation, assign a never-seen page id to it.
page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1;
}
+ rfh->set_simulate_used_data_reduction_proxy(
+ simulate_fetch_via_data_reduction_proxy_);
rfh->SendNavigate(page_id, entry->GetUniqueID(),
GetController().GetPendingEntryIndex() == -1,
entry->GetURL());
+ rfh->set_simulate_used_data_reduction_proxy(false);
// Simulate the SwapOut_ACK. This is needed when cross-site navigation
// happens.
if (old_rfh != rfh)
old_rfh->OnSwappedOut();
}
void TestWebContents::ProceedWithCrossSiteNavigation() {
if (!GetPendingMainFrame())
return;
GetMainFrame()->SendBeforeUnloadACK(true);

Powered by Google App Engine
This is Rietveld 408576698