Commit 5c28afb4 authored by Tarun Bansal's avatar Tarun Bansal Committed by Commit Bot

Include viewport-width client hint on main frame navigations on desktop

Bug: 821974
Change-Id: Icceeabb2e31c702341d898193f5ad6870b2d3f1e
Reviewed-on: https://chromium-review.googlesource.com/967095
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Reviewed-by: default avatarRyan Sturm <ryansturm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543925}
parent f446ce58
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include <cmath>
#include "chrome/browser/client_hints/client_hints.h" #include "chrome/browser/client_hints/client_hints.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
...@@ -39,6 +41,27 @@ bool IsJavaScriptAllowed(Profile* profile, const GURL& url) { ...@@ -39,6 +41,27 @@ bool IsJavaScriptAllowed(Profile* profile, const GURL& url) {
std::string()) == CONTENT_SETTING_ALLOW; std::string()) == CONTENT_SETTING_ALLOW;
} }
// Returns the zoom factor for a given |url|.
double GetZoomFactor(content::BrowserContext* context, const GURL& url) {
// Android does not have the concept of zooming in like desktop.
#if defined(OS_ANDROID)
return 1.0;
#else
double zoom_level = content::HostZoomMap::GetDefaultForBrowserContext(context)
->GetZoomLevelForHostAndScheme(
url.scheme(), net::GetHostOrSpecFromURL(url));
if (zoom_level == 0.0) {
// Get default zoom level.
zoom_level = content::HostZoomMap::GetDefaultForBrowserContext(context)
->GetDefaultZoomLevel();
}
return content::ZoomLevelToZoomFactor(zoom_level);
#endif
}
} // namespace } // namespace
namespace client_hints { namespace client_hints {
...@@ -107,35 +130,35 @@ GetAdditionalNavigationRequestClientHintsHeaders( ...@@ -107,35 +130,35 @@ GetAdditionalNavigationRequestClientHintsHeaders(
->GetPrimaryDisplay() ->GetPrimaryDisplay()
.device_scale_factor(); .device_scale_factor();
} }
double zoom_factor = 1.0;
// Android does not have the concept of zooming in like desktop.
#if !defined(OS_ANDROID)
double zoom_level =
content::HostZoomMap::GetDefaultForBrowserContext(context)
->GetZoomLevelForHostAndScheme(url.scheme(),
net::GetHostOrSpecFromURL(url));
double default_zoom_level =
content::HostZoomMap::GetDefaultForBrowserContext(context)
->GetDefaultZoomLevel();
if (zoom_level <= 0.0)
zoom_level = default_zoom_level;
if (zoom_level > 0.0)
zoom_factor = content::ZoomLevelToZoomFactor(zoom_level);
#endif // !OS_ANDROID
DCHECK_LT(0.0, device_scale_factor); DCHECK_LT(0.0, device_scale_factor);
double zoom_factor = GetZoomFactor(context, url);
additional_headers->SetHeader( additional_headers->SetHeader(
blink::kClientHintsHeaderMapping[static_cast<int>( blink::kClientHintsHeaderMapping[static_cast<int>(
blink::mojom::WebClientHintsType::kDpr)], blink::mojom::WebClientHintsType::kDpr)],
base::NumberToString(device_scale_factor * zoom_factor)); base::NumberToString(device_scale_factor * zoom_factor));
} }
if (web_client_hints.IsEnabled(
blink::mojom::WebClientHintsType::kViewportWidth)) {
// TODO: https://crbug.com/821974: Viewport width client hint should be sent
// on non-Android main frame navigations as well.
#if !defined(OS_ANDROID)
double viewport_width = (display::Screen::GetScreen()
->GetPrimaryDisplay()
.GetSizeInPixel()
.width()) /
GetZoomFactor(context, url);
DCHECK_LT(0, viewport_width);
if (viewport_width > 0) {
additional_headers->SetHeader(
blink::kClientHintsHeaderMapping[static_cast<int>(
blink::mojom::WebClientHintsType::kViewportWidth)],
base::NumberToString(std::round(viewport_width)));
}
#endif // !OS_ANDROID
}
// Static assert that triggers if a new client hint header is added. If a new // Static assert that triggers if a new client hint header is added. If a new
// client hint header is added, the following assertion should be updated. // client hint header is added, the following assertion should be updated.
// If possible, logic should be added above so that the request headers for // If possible, logic should be added above so that the request headers for
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/test/histogram_tester.h" #include "base/test/histogram_tester.h"
#include "build/build_config.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/metrics/subprocess_metrics_provider.h" #include "chrome/browser/metrics/subprocess_metrics_provider.h"
...@@ -61,6 +62,9 @@ class ThirdPartyURLLoaderInterceptor { ...@@ -61,6 +62,9 @@ class ThirdPartyURLLoaderInterceptor {
if (params->url_request.headers.HasHeader("device-memory")) { if (params->url_request.headers.HasHeader("device-memory")) {
client_hints_count_seen_++; client_hints_count_seen_++;
} }
if (params->url_request.headers.HasHeader("viewport-width")) {
client_hints_count_seen_++;
}
return false; return false;
} }
...@@ -244,6 +248,30 @@ class ClientHintsBrowserTest : public InProcessBrowserTest { ...@@ -244,6 +248,30 @@ class ClientHintsBrowserTest : public InProcessBrowserTest {
base::ContainsKey(request.headers, "device-memory")); base::ContainsKey(request.headers, "device-memory"));
EXPECT_EQ(expect_client_hints_on_main_frame_, EXPECT_EQ(expect_client_hints_on_main_frame_,
base::ContainsKey(request.headers, "dpr")); base::ContainsKey(request.headers, "dpr"));
// Sending of viewport-width is not enabled on main frame navigations for
// Android.
#if defined(OS_ANDROID)
EXPECT_FALSE(base::ContainsKey(request.headers, "viewport-width"));
#else
EXPECT_EQ(expect_client_hints_on_main_frame_,
base::ContainsKey(request.headers, "viewport-width"));
#endif
if (expect_client_hints_on_main_frame_) {
double value = 0.0;
EXPECT_TRUE(base::StringToDouble(
request.headers.find("device-memory")->second, &value));
EXPECT_LT(0.0, value);
EXPECT_TRUE(
base::StringToDouble(request.headers.find("dpr")->second, &value));
EXPECT_LT(0.0, value);
#if !defined(OS_ANDROID)
EXPECT_TRUE(base::StringToDouble(
request.headers.find("viewport-width")->second, &value));
EXPECT_LT(0.0, value);
#endif
}
} }
if (!is_main_frame_navigation) { if (!is_main_frame_navigation) {
...@@ -251,6 +279,23 @@ class ClientHintsBrowserTest : public InProcessBrowserTest { ...@@ -251,6 +279,23 @@ class ClientHintsBrowserTest : public InProcessBrowserTest {
base::ContainsKey(request.headers, "device-memory")); base::ContainsKey(request.headers, "device-memory"));
EXPECT_EQ(expect_client_hints_on_subresources_, EXPECT_EQ(expect_client_hints_on_subresources_,
base::ContainsKey(request.headers, "dpr")); base::ContainsKey(request.headers, "dpr"));
EXPECT_EQ(expect_client_hints_on_subresources_,
base::ContainsKey(request.headers, "viewport-width"));
if (expect_client_hints_on_subresources_) {
double value = 0.0;
EXPECT_TRUE(base::StringToDouble(
request.headers.find("device-memory")->second, &value));
EXPECT_LT(0.0, value);
EXPECT_TRUE(
base::StringToDouble(request.headers.find("dpr")->second, &value));
EXPECT_LT(0.0, value);
EXPECT_TRUE(base::StringToDouble(
request.headers.find("viewport-width")->second, &value));
EXPECT_LT(0.0, value);
}
} }
if (base::ContainsKey(request.headers, "dpr")) if (base::ContainsKey(request.headers, "dpr"))
...@@ -258,6 +303,9 @@ class ClientHintsBrowserTest : public InProcessBrowserTest { ...@@ -258,6 +303,9 @@ class ClientHintsBrowserTest : public InProcessBrowserTest {
if (base::ContainsKey(request.headers, "device-memory")) if (base::ContainsKey(request.headers, "device-memory"))
count_client_hints_headers_seen_++; count_client_hints_headers_seen_++;
if (base::ContainsKey(request.headers, "viewport-width"))
count_client_hints_headers_seen_++;
} }
net::EmbeddedTestServer http_server_; net::EmbeddedTestServer http_server_;
...@@ -296,8 +344,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ClientHintsHttps) { ...@@ -296,8 +344,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ClientHintsHttps) {
content::FetchHistogramsFromChildProcesses(); content::FetchHistogramsFromChildProcesses();
SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting();
// client_hints_url() sets two client hints. // client_hints_url() sets three client hints.
histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 2, 1); histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 3, 1);
// accept_ch_with_lifetime_url() sets client hints persist duration to 3600 // accept_ch_with_lifetime_url() sets client hints persist duration to 3600
// seconds. // seconds.
histogram_tester.ExpectUniqueSample("ClientHints.PersistDuration", histogram_tester.ExpectUniqueSample("ClientHints.PersistDuration",
...@@ -349,9 +397,14 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -349,9 +397,14 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
content::FetchHistogramsFromChildProcesses(); content::FetchHistogramsFromChildProcesses();
SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting();
// Two client hints are attached to the image request, and the device-memory // Two client hints are attached to the image request, and the device-memory
// and dpr headers are attached to the main frame request. // and dpr headers are attached to the main frame request.
// On desktop, viewport-width is also attached to the main frame request.
#if defined(OS_ANDROID)
EXPECT_EQ(4u, count_client_hints_headers_seen()); EXPECT_EQ(4u, count_client_hints_headers_seen());
#else
EXPECT_EQ(6u, count_client_hints_headers_seen());
#endif
// Navigating to without_accept_ch_without_lifetime_img_foo_com() should not // Navigating to without_accept_ch_without_lifetime_img_foo_com() should not
// attach client hints to the image subresouce contained in that page since // attach client hints to the image subresouce contained in that page since
...@@ -363,7 +416,11 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -363,7 +416,11 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting();
// The device-memory and dprheader is attached to the main frame request. // The device-memory and dprheader is attached to the main frame request.
#if defined(OS_ANDROID)
EXPECT_EQ(6u, count_client_hints_headers_seen()); EXPECT_EQ(6u, count_client_hints_headers_seen());
#else
EXPECT_EQ(9u, count_client_hints_headers_seen());
#endif
// Requests to third party servers should not have client hints attached. // Requests to third party servers should not have client hints attached.
EXPECT_EQ(1u, third_party_request_count_seen()); EXPECT_EQ(1u, third_party_request_count_seen());
EXPECT_EQ(0u, third_party_client_hints_count_seen()); EXPECT_EQ(0u, third_party_client_hints_count_seen());
...@@ -420,8 +477,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -420,8 +477,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
content::FetchHistogramsFromChildProcesses(); content::FetchHistogramsFromChildProcesses();
SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting();
// client_hints_url() sets two client hints. // client_hints_url() sets three client hints.
histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 2, 1); histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 3, 1);
// accept_ch_with_lifetime_http_local_url() sets client hints persist duration // accept_ch_with_lifetime_http_local_url() sets client hints persist duration
// to 3600 seconds. // to 3600 seconds.
histogram_tester.ExpectUniqueSample("ClientHints.PersistDuration", histogram_tester.ExpectUniqueSample("ClientHints.PersistDuration",
...@@ -440,9 +497,14 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -440,9 +497,14 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
ui_test_utils::NavigateToURL(browser(), ui_test_utils::NavigateToURL(browser(),
without_accept_ch_without_lifetime_local_url()); without_accept_ch_without_lifetime_local_url());
// Two client hints are attached to the image request, and the device-memory // Two client hints are attached to the image request, and the device-memory
// header is attached to the main frame request. // header is attached to the main frame request.
// On desktop, viewport-width is also attached to the main frame request.
#if defined(OS_ANDROID)
EXPECT_EQ(4u, count_client_hints_headers_seen()); EXPECT_EQ(4u, count_client_hints_headers_seen());
#else
EXPECT_EQ(6u, count_client_hints_headers_seen());
#endif
} }
// Loads a webpage that does not request persisting of client hints. // Loads a webpage that does not request persisting of client hints.
...@@ -480,8 +542,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -480,8 +542,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
content::FetchHistogramsFromChildProcesses(); content::FetchHistogramsFromChildProcesses();
SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting();
// client_hints_url() sets two client hints. // client_hints_url() sets three client hints.
histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 2, 1); histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 3, 1);
// accept_ch_with_lifetime_url() sets client hints persist duration to 3600 // accept_ch_with_lifetime_url() sets client hints persist duration to 3600
// seconds. // seconds.
histogram_tester.ExpectUniqueSample("ClientHints.PersistDuration", histogram_tester.ExpectUniqueSample("ClientHints.PersistDuration",
...@@ -499,9 +561,14 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -499,9 +561,14 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
ui_test_utils::NavigateToURL(browser(), ui_test_utils::NavigateToURL(browser(),
without_accept_ch_without_lifetime_url()); without_accept_ch_without_lifetime_url());
// Two client hints are attached to the image request, and the device-memory // Two client hints are attached to the image request, and the device-memory
// and dpr headers are attached to the main frame request. // and dpr headers are attached to the main frame request.
// On desktop, viewport-width is also attached to the main frame request.
#if defined(OS_ANDROID)
EXPECT_EQ(4u, count_client_hints_headers_seen()); EXPECT_EQ(4u, count_client_hints_headers_seen());
#else
EXPECT_EQ(6u, count_client_hints_headers_seen());
#endif
} }
// Ensure that when cookies are blocked, client hint preferences are not // Ensure that when cookies are blocked, client hint preferences are not
...@@ -558,8 +625,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -558,8 +625,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
content::FetchHistogramsFromChildProcesses(); content::FetchHistogramsFromChildProcesses();
SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting();
// client_hints_url() sets two client hints. // client_hints_url() sets three client hints.
histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 2, 1); histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 3, 1);
// accept_ch_with_lifetime_url() tries to set client hints persist duration to // accept_ch_with_lifetime_url() tries to set client hints persist duration to
// 3600 seconds. // 3600 seconds.
histogram_tester.ExpectUniqueSample("ClientHints.PersistDuration", histogram_tester.ExpectUniqueSample("ClientHints.PersistDuration",
...@@ -592,9 +659,14 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -592,9 +659,14 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
SetClientHintExpectationsOnSubresources(true); SetClientHintExpectationsOnSubresources(true);
ui_test_utils::NavigateToURL(browser(), ui_test_utils::NavigateToURL(browser(),
without_accept_ch_without_lifetime_url()); without_accept_ch_without_lifetime_url());
// Two client hints are attached to the image request, and the device-memory // Two client hints are attached to the image request, and the device-memory
// header is attached to the main frame request. // header is attached to the main frame request.
// On desktop, viewport-width is also attached to the main frame request.
#if defined(OS_ANDROID)
EXPECT_EQ(4u, count_client_hints_headers_seen()); EXPECT_EQ(4u, count_client_hints_headers_seen());
#else
EXPECT_EQ(6u, count_client_hints_headers_seen());
#endif
// Clear settings. // Clear settings.
HostContentSettingsMapFactory::GetForProfile(browser()->profile()) HostContentSettingsMapFactory::GetForProfile(browser()->profile())
...@@ -658,8 +730,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -658,8 +730,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
content::FetchHistogramsFromChildProcesses(); content::FetchHistogramsFromChildProcesses();
SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting();
// client_hints_url() sets two client hints. // client_hints_url() sets three client hints.
histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 2, 1); histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 3, 1);
// accept_ch_with_lifetime_url() tries to set client hints persist duration to // accept_ch_with_lifetime_url() tries to set client hints persist duration to
// 3600 seconds. // 3600 seconds.
histogram_tester.ExpectUniqueSample("ClientHints.PersistDuration", histogram_tester.ExpectUniqueSample("ClientHints.PersistDuration",
...@@ -691,9 +763,14 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -691,9 +763,14 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
SetClientHintExpectationsOnSubresources(true); SetClientHintExpectationsOnSubresources(true);
ui_test_utils::NavigateToURL(browser(), ui_test_utils::NavigateToURL(browser(),
without_accept_ch_without_lifetime_url()); without_accept_ch_without_lifetime_url());
// Two client hints are attached to the image request, and the device-memory // Two client hints are attached to the image request, and the device-memory
// and dpr headers are attached to the main frame request. // and dpr headers are attached to the main frame request.
// On desktop, viewport-width is also attached to the main frame request.
#if defined(OS_ANDROID)
EXPECT_EQ(4u, count_client_hints_headers_seen()); EXPECT_EQ(4u, count_client_hints_headers_seen());
#else
EXPECT_EQ(6u, count_client_hints_headers_seen());
#endif
// Clear settings. // Clear settings.
HostContentSettingsMapFactory::GetForProfile(browser()->profile()) HostContentSettingsMapFactory::GetForProfile(browser()->profile())
...@@ -737,7 +814,7 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -737,7 +814,7 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
accept_ch_without_lifetime_img_localhost()); accept_ch_without_lifetime_img_localhost());
// Client hints are attached to only the first party image subresource. // Client hints are attached to only the first party image subresource.
EXPECT_EQ(2u, count_client_hints_headers_seen()); EXPECT_EQ(3u, count_client_hints_headers_seen());
EXPECT_EQ(2u, third_party_request_count_seen()); EXPECT_EQ(2u, third_party_request_count_seen());
EXPECT_EQ(0u, third_party_client_hints_count_seen()); EXPECT_EQ(0u, third_party_client_hints_count_seen());
...@@ -754,7 +831,7 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -754,7 +831,7 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
CONTENT_SETTING_BLOCK); CONTENT_SETTING_BLOCK);
ui_test_utils::NavigateToURL(browser(), ui_test_utils::NavigateToURL(browser(),
accept_ch_without_lifetime_img_localhost()); accept_ch_without_lifetime_img_localhost());
EXPECT_EQ(2u, count_client_hints_headers_seen()); EXPECT_EQ(3u, count_client_hints_headers_seen());
EXPECT_EQ(3u, third_party_request_count_seen()); EXPECT_EQ(3u, third_party_request_count_seen());
EXPECT_EQ(0u, third_party_client_hints_count_seen()); EXPECT_EQ(0u, third_party_client_hints_count_seen());
...@@ -800,7 +877,7 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -800,7 +877,7 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
ui_test_utils::NavigateToURL(browser(), ui_test_utils::NavigateToURL(browser(),
accept_ch_without_lifetime_img_localhost()); accept_ch_without_lifetime_img_localhost());
// Client hints are attached to only the first party image subresource. // Client hints are attached to only the first party image subresource.
EXPECT_EQ(2u, count_client_hints_headers_seen()); EXPECT_EQ(3u, count_client_hints_headers_seen());
EXPECT_EQ(2u, third_party_request_count_seen()); EXPECT_EQ(2u, third_party_request_count_seen());
EXPECT_EQ(0u, third_party_client_hints_count_seen()); EXPECT_EQ(0u, third_party_client_hints_count_seen());
...@@ -814,7 +891,7 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ...@@ -814,7 +891,7 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest,
ui_test_utils::NavigateToURL(browser(), ui_test_utils::NavigateToURL(browser(),
accept_ch_without_lifetime_img_localhost()); accept_ch_without_lifetime_img_localhost());
EXPECT_EQ(2u, count_client_hints_headers_seen()); EXPECT_EQ(3u, count_client_hints_headers_seen());
EXPECT_EQ(3u, third_party_request_count_seen()); EXPECT_EQ(3u, third_party_request_count_seen());
EXPECT_EQ(0u, third_party_client_hints_count_seen()); EXPECT_EQ(0u, third_party_client_hints_count_seen());
...@@ -838,8 +915,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ClientHintsHttpsIncognito) { ...@@ -838,8 +915,8 @@ IN_PROC_BROWSER_TEST_F(ClientHintsBrowserTest, ClientHintsHttpsIncognito) {
content::FetchHistogramsFromChildProcesses(); content::FetchHistogramsFromChildProcesses();
SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); SubprocessMetricsProvider::MergeHistogramDeltasForTesting();
// accept_ch_with_lifetime_url() sets two client hints. // accept_ch_with_lifetime_url() sets three client hints.
histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 2, 1); histogram_tester.ExpectUniqueSample("ClientHints.UpdateSize", 3, 1);
// At least one renderer must have been created. All the renderers created // At least one renderer must have been created. All the renderers created
// must have read 0 client hints. // must have read 0 client hints.
......
HTTP/1.1 200 OK HTTP/1.1 200 OK
Accept-CH: dpr,device-memory Accept-CH: dpr,device-memory,viewport-width
Accept-CH-Lifetime: 3600 Accept-CH-Lifetime: 3600
\ No newline at end of file
HTTP/1.1 200 OK HTTP/1.1 200 OK
Accept-CH: dpr,device-memory Accept-CH: dpr,device-memory,viewport-width
\ No newline at end of file \ No newline at end of file
HTTP/1.1 200 OK HTTP/1.1 200 OK
Accept-CH: dpr,device-memory Accept-CH: dpr,device-memory,viewport-width
\ No newline at end of file \ No newline at end of file
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