Commit f456efff authored by Charlie Hu's avatar Charlie Hu Committed by Chromium LUCI CQ

[Document Policy] Remove feature for test in document policy features

As PRESUBMIT check on code generation is added in previous CL(
https://chromium-review.googlesource.com/c/chromium/src/+/2633734),
we can now remove the feature for test in document policy features.

Change-Id: I51e104cc9d77ad0339bcdd8c6c09dbb88af5e705
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2636942Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Charlie Hu <chenleihu@google.com>
Cr-Commit-Position: refs/heads/master@{#846178}
parent 50118483
...@@ -5076,70 +5076,6 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, ...@@ -5076,70 +5076,6 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest,
EXPECT_EQ("POST", root_frame_host()->last_http_method()); EXPECT_EQ("POST", root_frame_host()->last_http_method());
} }
struct DocumentPolicyDefaultValueBrowserTestCase {
std::initializer_list<base::Feature> enabled_features;
std::initializer_list<base::Feature> disabled_features;
bool expected_feature_state;
};
// The test on Document Policy default value control must be browsertest
// as the initialization of default value in
// |blink::GetDocumentPolicyFeatureInfoMap| only happens once per browser
// instance.
class DocumentPolicyDefaultValueBrowserTest
: public RenderFrameHostImplBrowserTest,
public ::testing::WithParamInterface<
DocumentPolicyDefaultValueBrowserTestCase> {
public:
static const DocumentPolicyDefaultValueBrowserTestCase kCases[];
DocumentPolicyDefaultValueBrowserTest() {
const auto& test_case = GetParam();
feature_list_.InitWithFeatures(test_case.enabled_features,
test_case.disabled_features);
}
private:
base::test::ScopedFeatureList feature_list_;
};
// Following flag control logic is defined in
// blink/renderer/core/feature_policy/document_policy_features.json5.
const DocumentPolicyDefaultValueBrowserTestCase
DocumentPolicyDefaultValueBrowserTest::kCases[] = {
{{},
{blink::features::kDocumentPolicyRuntimeFlag1ForTest,
blink::features::kDocumentPolicyRuntimeFlag2ForTest},
true},
{{blink::features::kDocumentPolicyRuntimeFlag1ForTest},
{blink::features::kDocumentPolicyRuntimeFlag2ForTest},
false},
{{blink::features::kDocumentPolicyRuntimeFlag2ForTest},
{blink::features::kDocumentPolicyRuntimeFlag1ForTest},
true},
{{blink::features::kDocumentPolicyRuntimeFlag2ForTest,
blink::features::kDocumentPolicyRuntimeFlag1ForTest},
{},
false},
};
INSTANTIATE_TEST_SUITE_P(
All,
DocumentPolicyDefaultValueBrowserTest,
testing::ValuesIn(DocumentPolicyDefaultValueBrowserTest::kCases));
IN_PROC_BROWSER_TEST_P(DocumentPolicyDefaultValueBrowserTest,
DocumentPolicyDefaultValueBehindFlag) {
const auto& test_case = GetParam();
std::unique_ptr<blink::DocumentPolicy> document_policy =
blink::DocumentPolicy::CreateWithHeaderPolicy({});
EXPECT_EQ(
document_policy->IsFeatureEnabled(
blink::mojom::DocumentPolicyFeature::kDefaultValueFeatureForTest),
test_case.expected_feature_state);
}
// Check Chrome won't attempt automatically loading the /favicon.ico if it would // Check Chrome won't attempt automatically loading the /favicon.ico if it would
// be blocked by CSP. // be blocked by CSP.
IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest,
......
...@@ -863,12 +863,6 @@ const base::Feature kInterestCohortAPIOriginTrial{ ...@@ -863,12 +863,6 @@ const base::Feature kInterestCohortAPIOriginTrial{
const base::Feature kInterestCohortFeaturePolicy{ const base::Feature kInterestCohortFeaturePolicy{
"InterestCohortFeaturePolicy", base::FEATURE_DISABLED_BY_DEFAULT}; "InterestCohortFeaturePolicy", base::FEATURE_DISABLED_BY_DEFAULT};
// Flags only used for testing purposes. No effect when enabled.
const base::Feature kDocumentPolicyRuntimeFlag1ForTest{
"kDocumentPolicyRuntimeFlag1ForTest", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kDocumentPolicyRuntimeFlag2ForTest{
"kDocumentPolicyRuntimeFlag2ForTest", base::FEATURE_DISABLED_BY_DEFAULT};
// Changes the default background color of the Text Fragment from // Changes the default background color of the Text Fragment from
// bright yellow rgb(255, 255, 0) to light purple rgb(233, 210, 253) // bright yellow rgb(255, 255, 0) to light purple rgb(233, 210, 253)
const base::Feature kTextFragmentColorChange{"TextFragmentColorChange", const base::Feature kTextFragmentColorChange{"TextFragmentColorChange",
......
...@@ -355,13 +355,6 @@ BLINK_COMMON_EXPORT extern const base::Feature kInterestCohortAPIOriginTrial; ...@@ -355,13 +355,6 @@ BLINK_COMMON_EXPORT extern const base::Feature kInterestCohortAPIOriginTrial;
BLINK_COMMON_EXPORT extern const base::Feature kInterestCohortFeaturePolicy; BLINK_COMMON_EXPORT extern const base::Feature kInterestCohortFeaturePolicy;
// Flags used to test DocumentPolicy's default value being controlled by
// different runtime flag states.
BLINK_COMMON_EXPORT extern const base::Feature
kDocumentPolicyRuntimeFlag1ForTest;
BLINK_COMMON_EXPORT extern const base::Feature
kDocumentPolicyRuntimeFlag2ForTest;
BLINK_COMMON_EXPORT extern const base::Feature kTextFragmentColorChange; BLINK_COMMON_EXPORT extern const base::Feature kTextFragmentColorChange;
} // namespace features } // namespace features
......
...@@ -36,9 +36,6 @@ enum DocumentPolicyFeature { ...@@ -36,9 +36,6 @@ enum DocumentPolicyFeature {
kJSProfiling = 11, kJSProfiling = 11,
// Controls use of synchronous XMLHTTPRequest API. // Controls use of synchronous XMLHTTPRequest API.
kSyncXHR = 12, kSyncXHR = 12,
// Feature for testing 'default_value_behind_flag' field in
// document_policy_features.json5.
kDefaultValueFeatureForTest = 13,
// Don't change assigned numbers of any item, and don't reuse removed slots. // Don't change assigned numbers of any item, and don't reuse removed slots.
// Add new features at the end of the enum. // Add new features at the end of the enum.
// Also, run update_document_policy_enum.py in // Also, run update_document_policy_enum.py in
......
...@@ -49,19 +49,6 @@ ...@@ -49,19 +49,6 @@
}, },
data: [ data: [
{
name: "DefaultValueFeatureForTest",
// Setting document_policy_name to "", so that it will not be recognized
// by the parser, as structured header token cannot be empty.
document_policy_name: "",
value_type: "Bool",
default_value: "true",
depends_on: [],
default_value_behind_flag: [
["DocumentPolicyRuntimeFlag1ForTest", "false"],
["DocumentPolicyRuntimeFlag2ForTest", "true"],
]
},
{ {
name: "Default", name: "Default",
document_policy_name: "*", document_policy_name: "*",
......
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