Commit 5236f98e authored by David Bokan's avatar David Bokan Committed by Commit Bot

UMA: Remove OverviewZoom and extend MetaTagType

The Viewport.MetaTagType UMA is broadly useful to get an understanding
of what percentage of pages are "mobile optimized" so we extend it until
M95.

However, this CL removes the more specific Viewport.OverviewZoom
histogram as it's no longer useful.

Bug: 1089632
Change-Id: I0e4a06f043389bbc20e8d07a64263e2e9fccfba4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432770Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811820}
parent ba8eca05
...@@ -267,21 +267,6 @@ void ViewportDescription::ReportMobilePageStats( ...@@ -267,21 +267,6 @@ void ViewportDescription::ReportMobilePageStats(
if (max_width.IsFixed()) { if (max_width.IsFixed()) {
meta_tag_type_histogram.Count( meta_tag_type_histogram.Count(
static_cast<int>(ViewportUMAType::kConstantWidth)); static_cast<int>(ViewportUMAType::kConstantWidth));
if (main_frame->View()) {
// To get an idea of how "far" the viewport is from the device's ideal
// width, we report the zoom level that we'd need to be at for the
// entire page to be visible.
int viewport_width = max_width.IntValue();
int window_width =
main_frame->GetPage()->GetVisualViewport().Size().Width();
int overview_zoom_percent =
100 * window_width / static_cast<float>(viewport_width);
DEFINE_STATIC_LOCAL(SparseHistogram, overview_zoom_histogram,
("Viewport.OverviewZoom"));
overview_zoom_histogram.Sample(overview_zoom_percent);
}
} else if (max_width.IsDeviceWidth() || max_width.IsExtendToZoom()) { } else if (max_width.IsDeviceWidth() || max_width.IsExtendToZoom()) {
meta_tag_type_histogram.Count( meta_tag_type_histogram.Count(
static_cast<int>(ViewportUMAType::kDeviceWidth)); static_cast<int>(ViewportUMAType::kDeviceWidth));
......
...@@ -3304,11 +3304,6 @@ class ViewportHistogramsTest : public SimTest { ...@@ -3304,11 +3304,6 @@ class ViewportHistogramsTest : public SimTest {
static_cast<int>(type), 1); static_cast<int>(type), 1);
} }
void ExpectOverviewZoom(int sample) {
histogram_tester_.ExpectTotalCount("Viewport.OverviewZoom", 1);
histogram_tester_.ExpectBucketCount("Viewport.OverviewZoom", sample, 1);
}
void ExpectTotalCount(const std::string& histogram, int count) { void ExpectTotalCount(const std::string& histogram, int count) {
histogram_tester_.ExpectTotalCount(histogram, 0); histogram_tester_.ExpectTotalCount(histogram, 0);
} }
...@@ -3331,19 +3326,16 @@ TEST_F(ViewportHistogramsTest, NoOpOnWhenViewportDisabled) { ...@@ -3331,19 +3326,16 @@ TEST_F(ViewportHistogramsTest, NoOpOnWhenViewportDisabled) {
UseMetaTag("<meta name='viewport' content='width=device-width'>"); UseMetaTag("<meta name='viewport' content='width=device-width'>");
ExpectTotalCount("Viewport.MetaTagType", 0); ExpectTotalCount("Viewport.MetaTagType", 0);
ExpectTotalCount("Viewport.OverviewZoom", 0);
} }
TEST_F(ViewportHistogramsTest, TypeNone) { TEST_F(ViewportHistogramsTest, TypeNone) {
UseMetaTag(""); UseMetaTag("");
ExpectType(ViewportDescription::ViewportUMAType::kNoViewportTag); ExpectType(ViewportDescription::ViewportUMAType::kNoViewportTag);
ExpectTotalCount("Viewport.OverviewZoom", 0);
} }
TEST_F(ViewportHistogramsTest, TypeDeviceWidth) { TEST_F(ViewportHistogramsTest, TypeDeviceWidth) {
UseMetaTag("<meta name='viewport' content='width=device-width'>"); UseMetaTag("<meta name='viewport' content='width=device-width'>");
ExpectType(ViewportDescription::ViewportUMAType::kDeviceWidth); ExpectType(ViewportDescription::ViewportUMAType::kDeviceWidth);
ExpectTotalCount("Viewport.OverviewZoom", 0);
} }
TEST_F(ViewportHistogramsTest, TypeConstant) { TEST_F(ViewportHistogramsTest, TypeConstant) {
...@@ -3354,13 +3346,11 @@ TEST_F(ViewportHistogramsTest, TypeConstant) { ...@@ -3354,13 +3346,11 @@ TEST_F(ViewportHistogramsTest, TypeConstant) {
TEST_F(ViewportHistogramsTest, TypeHandheldFriendlyMeta) { TEST_F(ViewportHistogramsTest, TypeHandheldFriendlyMeta) {
UseMetaTag("<meta name='HandheldFriendly' content='true'/> "); UseMetaTag("<meta name='HandheldFriendly' content='true'/> ");
ExpectType(ViewportDescription::ViewportUMAType::kMetaHandheldFriendly); ExpectType(ViewportDescription::ViewportUMAType::kMetaHandheldFriendly);
ExpectTotalCount("Viewport.OverviewZoom", 0);
} }
TEST_F(ViewportHistogramsTest, TypeMobileOptimizedMeta) { TEST_F(ViewportHistogramsTest, TypeMobileOptimizedMeta) {
UseMetaTag("<meta name='MobileOptimized' content='320'/> "); UseMetaTag("<meta name='MobileOptimized' content='320'/> ");
ExpectType(ViewportDescription::ViewportUMAType::kMetaMobileOptimized); ExpectType(ViewportDescription::ViewportUMAType::kMetaMobileOptimized);
ExpectTotalCount("Viewport.OverviewZoom", 0);
} }
TEST_F(ViewportHistogramsTest, TypeXhtml) { TEST_F(ViewportHistogramsTest, TypeXhtml) {
...@@ -3368,15 +3358,6 @@ TEST_F(ViewportHistogramsTest, TypeXhtml) { ...@@ -3368,15 +3358,6 @@ TEST_F(ViewportHistogramsTest, TypeXhtml) {
"<!DOCTYPE html PUBLIC '-//WAPFORUM//DTD XHTML Mobile 1.1//EN' " "<!DOCTYPE html PUBLIC '-//WAPFORUM//DTD XHTML Mobile 1.1//EN' "
"'http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd'"); "'http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd'");
ExpectType(ViewportDescription::ViewportUMAType::kXhtmlMobileProfile); ExpectType(ViewportDescription::ViewportUMAType::kXhtmlMobileProfile);
ExpectTotalCount("Viewport.OverviewZoom", 0);
}
TEST_F(ViewportHistogramsTest, OverviewZoom) {
UseMetaTag("<meta name='viewport' content='width=1000'>");
// Since the viewport is 500px wide and the layout width is 1000px we expect
// the metric to report 50%.
ExpectOverviewZoom(50);
} }
} // namespace blink } // namespace blink
...@@ -15399,6 +15399,7 @@ regressions. --> ...@@ -15399,6 +15399,7 @@ regressions. -->
<histogram name="Viewport.DidScalePage" enum="BooleanDidScalePage" <histogram name="Viewport.DidScalePage" enum="BooleanDidScalePage"
expires_after="M90"> expires_after="M90">
<owner>bokan@chromium.org</owner> <owner>bokan@chromium.org</owner>
<owner>input-dev@chromium.org</owner>
<summary> <summary>
Tracks the proportion of non-mobile optimized (i.e. zoom disabled or layout Tracks the proportion of non-mobile optimized (i.e. zoom disabled or layout
width matches viewport) page views that had a user-initiated page scale width matches viewport) page views that had a user-initiated page scale
...@@ -15410,6 +15411,7 @@ regressions. --> ...@@ -15410,6 +15411,7 @@ regressions. -->
<histogram name="Viewport.MaxPageScale" enum="PageScaleFactorRange" <histogram name="Viewport.MaxPageScale" enum="PageScaleFactorRange"
expires_after="M90"> expires_after="M90">
<owner>bokan@chromium.org</owner> <owner>bokan@chromium.org</owner>
<owner>input-dev@chromium.org</owner>
<summary> <summary>
Tracks the maximum scale factor that a user has scaled to over the lifetime Tracks the maximum scale factor that a user has scaled to over the lifetime
of the page. The scale is counted at pinch end (e.g. zooming to 300% and of the page. The scale is counted at pinch end (e.g. zooming to 300% and
...@@ -15421,15 +15423,20 @@ regressions. --> ...@@ -15421,15 +15423,20 @@ regressions. -->
</histogram> </histogram>
<histogram name="Viewport.MetaTagType" enum="MetaTagTypeEnum" <histogram name="Viewport.MetaTagType" enum="MetaTagTypeEnum"
expires_after="M85"> expires_after="M95">
<owner>bokan@chromium.org</owner> <owner>bokan@chromium.org</owner>
<owner>input-dev@chromium.org</owner>
<summary> <summary>
The viewport meta tag type seen on each page load. Only recorded on Android. The viewport meta tag type seen on each page load. Only recorded on Android.
</summary> </summary>
</histogram> </histogram>
<histogram name="Viewport.OverviewZoom" units="%" expires_after="M85"> <histogram name="Viewport.OverviewZoom" units="%" expires_after="M85">
<obsolete>
Expired in M85.
</obsolete>
<owner>bokan@chromium.org</owner> <owner>bokan@chromium.org</owner>
<owner>input-dev@chromium.org</owner>
<summary> <summary>
The screen width as a percentage of viewport width (i.e. zoom at which we The screen width as a percentage of viewport width (i.e. zoom at which we
can see the whole page). Only recorded on Android and for viewport meta tags can see the whole page). Only recorded on Android and for viewport meta tags
......
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