Commit 6b1d7dff authored by Ryan Sturm's avatar Ryan Sturm Committed by Commit Bot

Replacing LoFiOn UMA with LitePages UMA

This change removes PageLoad.Clients.DataReductionProxy.LoFiOn.* and
adds PageLoad.Clients.Previews.LitePages. The key difference in these
two histograms is the earlier triggers for all pages that use server
LoFi or server LitePages, whereas the new UMA will only trigger for
pages that use server LitePages.

Bug: 720035
Change-Id: I48c6f349aa5e1a6dfc2e261729ca8d3d624cb08d
Reviewed-on: https://chromium-review.googlesource.com/1060098Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Ryan Sturm <ryansturm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558884}
parent 6ff1e15c
......@@ -51,9 +51,9 @@ std::string GetConstHistogramWithSuffix(const char* suffix) {
#define RECORD_HISTOGRAMS_FOR_SUFFIX(data, value, histogram_suffix) \
do { \
PAGE_LOAD_HISTOGRAM(GetConstHistogramWithSuffix(histogram_suffix), value); \
if (data->lofi_requested()) { \
if (data->lite_page_received()) { \
PAGE_LOAD_HISTOGRAM( \
std::string(internal::kHistogramDataReductionProxyLoFiOnPrefix) \
std::string(internal::kHistogramDataReductionProxyLitePagePrefix) \
.append(histogram_suffix), \
value); \
} \
......@@ -75,8 +75,8 @@ namespace internal {
const char kHistogramDataReductionProxyPrefix[] =
"PageLoad.Clients.DataReductionProxy.";
const char kHistogramDataReductionProxyLoFiOnPrefix[] =
"PageLoad.Clients.DataReductionProxy.LoFiOn.";
const char kHistogramDataReductionProxyLitePagePrefix[] =
"PageLoad.Clients.Previews.LitePages.";
const char kResourcesPercentProxied[] =
"Experimental.CompletedResources.Network.PercentProxied";
......
......@@ -30,7 +30,7 @@ namespace internal {
// Various UMA histogram names for DataReductionProxy core page load metrics.
extern const char kHistogramDataReductionProxyPrefix[];
extern const char kHistogramDataReductionProxyLoFiOnPrefix[];
extern const char kHistogramDataReductionProxyLitePagePrefix[];
// Byte and request specific histogram suffixes.
extern const char kResourcesPercentProxied[];
......
......@@ -113,11 +113,11 @@ class TestDataReductionProxyMetricsObserver
TestDataReductionProxyMetricsObserver(content::WebContents* web_contents,
TestPingbackClient* pingback_client,
bool data_reduction_proxy_used,
bool lofi_used)
bool lite_page_used)
: web_contents_(web_contents),
pingback_client_(pingback_client),
data_reduction_proxy_used_(data_reduction_proxy_used),
lofi_used_(lofi_used) {}
lite_page_used_(lite_page_used) {}
~TestDataReductionProxyMetricsObserver() override {}
......@@ -128,7 +128,7 @@ class TestDataReductionProxyMetricsObserver
DataForNavigationHandle(web_contents_, navigation_handle);
data->set_used_data_reduction_proxy(data_reduction_proxy_used_);
data->set_request_url(GURL(kDefaultTestUrl));
data->set_lofi_requested(lofi_used_);
data->set_lite_page_received(lite_page_used_);
return DataReductionProxyMetricsObserver::OnCommit(navigation_handle,
source_id);
}
......@@ -160,7 +160,7 @@ class TestDataReductionProxyMetricsObserver
content::WebContents* web_contents_;
TestPingbackClient* pingback_client_;
bool data_reduction_proxy_used_;
bool lofi_used_;
bool lite_page_used_;
DISALLOW_COPY_AND_ASSIGN(TestDataReductionProxyMetricsObserver);
};
......@@ -171,7 +171,7 @@ class DataReductionProxyMetricsObserverTest
DataReductionProxyMetricsObserverTest()
: pingback_client_(new TestPingbackClient()),
data_reduction_proxy_used_(false),
is_using_lofi_(false),
is_using_lite_page_(false),
opt_out_expected_(false) {}
void ResetTest() {
......@@ -195,10 +195,10 @@ class DataReductionProxyMetricsObserverTest
}
void RunTest(bool data_reduction_proxy_used,
bool is_using_lofi,
bool is_using_lite_page,
bool opt_out_expected) {
data_reduction_proxy_used_ = data_reduction_proxy_used;
is_using_lofi_ = is_using_lofi;
is_using_lite_page_ = is_using_lite_page;
opt_out_expected_ = opt_out_expected;
NavigateAndCommit(GURL(kDefaultTestUrl));
SimulateTimingUpdate(timing_);
......@@ -206,9 +206,9 @@ class DataReductionProxyMetricsObserverTest
}
void RunTestAndNavigateToUntrackedUrl(bool data_reduction_proxy_used,
bool is_using_lofi,
bool is_using_lite_page,
bool opt_out_expected) {
RunTest(data_reduction_proxy_used, is_using_lofi, opt_out_expected);
RunTest(data_reduction_proxy_used, is_using_lite_page, opt_out_expected);
NavigateToUntrackedUrl();
}
......@@ -301,9 +301,9 @@ class DataReductionProxyMetricsObserverTest
.append(histogram_suffix),
data_reduction_proxy_used_ ? 1 : 0);
histogram_tester().ExpectTotalCount(
std::string(internal::kHistogramDataReductionProxyLoFiOnPrefix)
std::string(internal::kHistogramDataReductionProxyLitePagePrefix)
.append(histogram_suffix),
is_using_lofi_ ? 1 : 0);
is_using_lite_page_ ? 1 : 0);
if (!data_reduction_proxy_used_)
return;
histogram_tester().ExpectUniqueSample(
......@@ -312,12 +312,12 @@ class DataReductionProxyMetricsObserverTest
static_cast<base::HistogramBase::Sample>(
event.value().InMilliseconds()),
1);
if (!is_using_lofi_)
if (!is_using_lite_page_)
return;
histogram_tester().ExpectUniqueSample(
std::string(internal::kHistogramDataReductionProxyLoFiOnPrefix)
std::string(internal::kHistogramDataReductionProxyLitePagePrefix)
.append(histogram_suffix),
event.value().InMilliseconds(), is_using_lofi_ ? 1 : 0);
event.value().InMilliseconds(), is_using_lite_page_ ? 1 : 0);
}
void ValidateDataHistograms(int network_resources,
......@@ -397,7 +397,7 @@ class DataReductionProxyMetricsObserverTest
tracker->AddObserver(
std::make_unique<TestDataReductionProxyMetricsObserver>(
web_contents(), pingback_client_.get(), data_reduction_proxy_used_,
is_using_lofi_));
is_using_lite_page_));
}
std::unique_ptr<TestPingbackClient> pingback_client_;
......@@ -405,7 +405,7 @@ class DataReductionProxyMetricsObserverTest
private:
bool data_reduction_proxy_used_;
bool is_using_lofi_;
bool is_using_lite_page_;
bool opt_out_expected_;
DISALLOW_COPY_AND_ASSIGN(DataReductionProxyMetricsObserverTest);
......@@ -420,16 +420,16 @@ TEST_F(DataReductionProxyMetricsObserverTest, DataReductionProxyOff) {
TEST_F(DataReductionProxyMetricsObserverTest, DataReductionProxyOn) {
ResetTest();
// Verify that when the data reduction proxy was used, but lofi was not used,
// the correpsonding UMA is reported.
// Verify that when the data reduction proxy was used, but lite page was not
// used, the correpsonding UMA is reported.
RunTest(true, false, false);
ValidateHistograms();
}
TEST_F(DataReductionProxyMetricsObserverTest, LofiEnabled) {
TEST_F(DataReductionProxyMetricsObserverTest, LitePageEnabled) {
ResetTest();
// Verify that when the data reduction proxy was used and lofi was used, both
// histograms are reported.
// Verify that when the data reduction proxy was used and lite page was used,
// both histograms are reported.
RunTest(true, true, false);
ValidateHistograms();
}
......@@ -488,7 +488,6 @@ TEST_F(DataReductionProxyMetricsObserverTest, OnCompletePingback) {
data->set_lofi_received(true);
// Verify LoFi is tracked when a LoFi response is received.
page_load_metrics::ExtraRequestCompleteInfo resource = {
GURL(kResourceUrl),
net::HostPortPair(),
......
......@@ -115275,7 +115275,14 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<suffix name="Clients.DataReductionProxy.LoFiOn"
label="PageLoadMetrics that are a result of a navigation through the
data reduction proxy with session in LoFi enabled or control
field trial, and when the connection was slow."/>
field trial, and when the connection was slow.">
<obsolete>
Deprecated 05/2018.
</obsolete>
</suffix>
<suffix name="Clients.Previews.LitePages"
label="PageLoadMetrics that are a result of a navigation through the
data reduction proxy where a lite page response was received."/>
<affected-histogram
name="PageLoad.DocumentTiming.NavigationToDOMContentLoadedEventFired"/>
<affected-histogram name="PageLoad.DocumentTiming.NavigationToFirstLayout"/>
......@@ -115446,8 +115453,8 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<histogram_suffixes name="PageLoadMetricsClientsLoFi" separator="."
ordering="prefix">
<suffix name="Clients.LoFi"
label="PageLoadMetrics that are a result of a navigation caused by a
tab restore."/>
label="PageLoadMetrics that are a result of a navigation that displayed
a LoFi image."/>
<affected-histogram
name="PageLoad.DocumentTiming.NavigationToLoadEventFired"/>
<affected-histogram name="PageLoad.Experimental.Bytes.Network"/>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment