Skip to content

Commit

Permalink
Fix fledge web platform tests
Browse files Browse the repository at this point in the history
Implement IsPrivacySandboxReportingDestinationAttested for headless
shell as suggested in [1].

[1] https://g-issues.chromium.org/issues/338066470#comment11

Bug: 338066470
Change-Id: Ibc740ea4cf344f07a3ea390686ca32e42a4811be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5772963
Commit-Queue: Weizhong Xia <weizhong@google.com>
Reviewed-by: Peter Kvitek <kvitekp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1340463}
  • Loading branch information
WeizhongX authored and pull[bot] committed Aug 12, 2024
1 parent 9bd9226 commit 1440123
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions headless/lib/browser/headless_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,15 @@ bool HeadlessContentBrowserClient::IsInterestGroupAPIAllowed(
return true;
}

bool HeadlessContentBrowserClient::IsPrivacySandboxReportingDestinationAttested(
content::BrowserContext* browser_context,
const url::Origin& destination_origin,
content::PrivacySandboxInvokingAPI invoking_api,
bool post_impression_reporting) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
return command_line->HasSwitch(switches::kForceReportingDestinationAttested);
}

bool HeadlessContentBrowserClient::IsSharedStorageAllowed(
content::BrowserContext* browser_context,
content::RenderFrameHost* rfh,
Expand Down
6 changes: 6 additions & 0 deletions headless/lib/browser/headless_content_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ class HeadlessContentBrowserClient : public content::ContentBrowserClient {
const url::Origin& top_frame_origin,
const url::Origin& api_origin) override;

bool IsPrivacySandboxReportingDestinationAttested(
content::BrowserContext* browser_context,
const url::Origin& destination_origin,
content::PrivacySandboxInvokingAPI invoking_api,
bool post_impression_reporting) override;

bool IsSharedStorageAllowed(
content::BrowserContext* browser_context,
content::RenderFrameHost* rfh,
Expand Down
4 changes: 4 additions & 0 deletions headless/public/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ inline constexpr char kFontRenderHinting[] = "font-render-hinting";
inline constexpr char kForceNewBrowsingInstance[] =
"force-new-browsing-instance";

// Force reporting destination attested for headless shell.
inline constexpr char kForceReportingDestinationAttested[] =
"force-reporting-destination-attested";

// Forces Incognito mode even if user data directory is specified using the
// --user-data-dir switch.
inline constexpr char kIncognito[] = "incognito";
Expand Down
1 change: 1 addition & 0 deletions third_party/blink/tools/blinkpy/wpt_tests/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def additional_binary_args(self):
"--canvas-2d-layers",
'--enable-bfcache',
'--enable-field-trial-config',
'--force-reporting-destination-attested',
# `headless_shell` doesn't send the `Accept-Language` header by
# default, so set an arbitrary one that some tests expect.
'--accept-lang=en-US,en',
Expand Down

0 comments on commit 1440123

Please sign in to comment.