Commit 91e4b73f authored by Yao Xiao's avatar Yao Xiao Committed by Chromium LUCI CQ

[floc] For the OT, set allows_third_party and make it finch controllable

We expect doing 3rd-party OT for FLoC, thus setting
origin_trial_allows_third_party. Also, gate the OT by a base::Feature,
as this allows us to keep the experimentation under the global usage
limit.

Bug: 1163394
Change-Id: Ibaf9554397f8d46fa68c837fe58acc66676a2401
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611953Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842729}
parent ddcc7624
......@@ -21,7 +21,10 @@ constexpr char kBaseDataDir[] = "chrome/test/data/federated_learning";
class FlocOriginTrialBrowserTest : public InProcessBrowserTest {
public:
FlocOriginTrialBrowserTest() = default;
FlocOriginTrialBrowserTest() {
scoped_feature_list_.InitAndEnableFeature(
blink::features::kInterestCohortAPIOriginTrial);
}
void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();
......@@ -71,6 +74,9 @@ class FlocOriginTrialBrowserTest : public InProcessBrowserTest {
return browser()->tab_strip_model()->GetActiveWebContents();
}
protected:
base::test::ScopedFeatureList scoped_feature_list_;
private:
std::unique_ptr<content::URLLoaderInterceptor> url_loader_interceptor_;
};
......@@ -87,4 +93,23 @@ IN_PROC_BROWSER_TEST_F(FlocOriginTrialBrowserTest, OriginTrialDisabled) {
EXPECT_FALSE(HasInterestCohortApi(web_contents()));
}
class FlocOriginTrialBrowserTestBaseFeatureDisabled
: public FlocOriginTrialBrowserTest {
public:
FlocOriginTrialBrowserTestBaseFeatureDisabled() {
scoped_feature_list_.Reset();
scoped_feature_list_.InitAndDisableFeature(
blink::features::kInterestCohortAPIOriginTrial);
}
};
IN_PROC_BROWSER_TEST_F(FlocOriginTrialBrowserTestBaseFeatureDisabled,
OriginTrialEnabled) {
ui_test_utils::NavigateToURL(browser(), OriginTrialEnabledURL());
// If the base::Feature is disabled, the OT / API is disabled regardless of
// the OT config.
EXPECT_FALSE(HasInterestCohortApi(web_contents()));
}
} // namespace federated_learning
......@@ -859,5 +859,11 @@ const base::Feature kSendCnameAliasesToSubresourceFilterFromRenderer{
"SendCnameAliasesToSubresourceFilterFromRenderer",
base::FEATURE_DISABLED_BY_DEFAULT};
// Kill switch for the InterestCohort API origin trial, i.e. if disabled, the
// API exposure will be disabled regardless of the OT config.
// (See https://github.com/WICG/floc.)
const base::Feature kInterestCohortAPIOriginTrial{
"InterestCohortAPIOriginTrial", base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace features
} // namespace blink
......@@ -354,6 +354,8 @@ BLINK_COMMON_EXPORT extern const base::Feature kWebRtcDistinctWorkerThread;
BLINK_COMMON_EXPORT extern const base::Feature
kSendCnameAliasesToSubresourceFilterFromRenderer;
BLINK_COMMON_EXPORT extern const base::Feature kInterestCohortAPIOriginTrial;
} // namespace features
} // namespace blink
......
......@@ -384,7 +384,10 @@ bool OriginTrialContext::CanEnableTrialFromName(const StringView& trial_name) {
!base::FeatureList::IsEnabled(network::features::kTrustTokens)) {
return false;
}
if (trial_name == "InterestCohortAPI" &&
!base::FeatureList::IsEnabled(features::kInterestCohortAPIOriginTrial)) {
return false;
}
return true;
}
......
......@@ -1035,6 +1035,7 @@
{
name: "InterestCohortAPI",
origin_trial_feature_name: "InterestCohortAPI",
origin_trial_allows_third_party: true,
},
{
name: "IntersectionObserverDocumentScrollingElementRoot",
......
......@@ -768,6 +768,11 @@
"bases": [ "http/tests/origin_trials/webexposed/bfcache-experiment-http-header-origin-trial.php" ],
"args": [ "--enable-features=BackForwardCacheABExperimentControl" ]
},
{
"prefix": "interest-cohort-api-origin-trial",
"bases": [ "http/tests/origin_trials/webexposed/interest-cohort-origin-trial-interfaces.html" ],
"args": [ "--enable-features=InterestCohortAPIOriginTrial" ]
},
{
"prefix": "threaded-composited-iframes",
"bases": ["external/wpt/is-input-pending"],
......
......@@ -5,14 +5,20 @@ generate_token.py http://127.0.0.1:8000 InterestCohortAPI --expire-timestamp=200
-->
<meta http-equiv="origin-trial" content="A1q7Ss8yaDaFBy5/0JLZCpLDbCD0o4uPIJkE9YEkUUuOBdvmdJiBcoNSy9OvLuRh+XsWnW3zP+0UcWI2T1vP1AwAAABZeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiSW50ZXJlc3RDb2hvcnRBUEkiLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0=" />
<title>Interest Cohort API - interfaces exposed by origin trial</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/origin-trials-helper.js"></script>
<body>
<p>Test that the API exists with origin trial token</p>
<div id="result"></div>
<script>
'use strict'
test(t => {
assert_true(document.interestCohort instanceof Function, 'interestCohort function can be accessed on document');
}, 'Interest Cohort API entry point in Origin-Trial enabled document.');
if (window.testRunner) {
testRunner.dumpAsText();
}
if (document.interestCohort instanceof Function) {
document.getElementById("result").innerHTML += "SUCCESS";
} else {
document.getElementById("result").innerHTML += "FAILURE";
}
</script>
</body>
*This suite runs the tests with**
`--enable-features=InterestCohortAPIOriginTrial`
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