Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2727803004: Replace string by enum in WebParsedFeaturePolicyDeclaration#feature (Closed)
Patch Set: Codereview: nit -- add comments to introduce features Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/child/feature_policy/feature_policy_platform.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 9e9f43e459b17e1cf09417c6e3e8216d843a4f3a..012d0fdf59831aefd01ab36e14f577deb2ad72f6 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -716,10 +716,11 @@ class SitePerProcessFeaturePolicyBrowserTest
"FeaturePolicy");
}
- ParsedFeaturePolicyHeader CreateFPHeader(const std::string& feature_name,
- const std::vector<GURL>& origins) {
+ ParsedFeaturePolicyHeader CreateFPHeader(
+ blink::WebFeaturePolicyFeature feature,
+ const std::vector<GURL>& origins) {
ParsedFeaturePolicyHeader result(1);
- result[0].feature_name = feature_name;
+ result[0].feature = feature;
result[0].matches_all_origins = false;
DCHECK(!origins.empty());
for (const GURL& origin : origins)
@@ -728,9 +729,9 @@ class SitePerProcessFeaturePolicyBrowserTest
}
ParsedFeaturePolicyHeader CreateFPHeaderMatchesAll(
- const std::string& feature_name) {
+ blink::WebFeaturePolicyFeature feature) {
ParsedFeaturePolicyHeader result(1);
- result[0].feature_name = feature_name;
+ result[0].feature = feature;
result[0].matches_all_origins = true;
return result;
}
@@ -738,10 +739,8 @@ class SitePerProcessFeaturePolicyBrowserTest
bool operator==(const ParsedFeaturePolicyDeclaration& first,
const ParsedFeaturePolicyDeclaration& second) {
- return std::tie(first.feature_name, first.matches_all_origins,
- first.origins) == std::tie(second.feature_name,
- second.matches_all_origins,
- second.origins);
+ return std::tie(first.feature, first.matches_all_origins, first.origins) ==
+ std::tie(second.feature, second.matches_all_origins, second.origins);
}
IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest,
@@ -9190,13 +9189,14 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessFeaturePolicyBrowserTest,
EXPECT_TRUE(NavigateToURL(shell(), start_url));
FrameTreeNode* root = web_contents()->GetFrameTree()->root();
- EXPECT_EQ(CreateFPHeader("vibrate", {start_url.GetOrigin()}),
+ EXPECT_EQ(CreateFPHeader(blink::WebFeaturePolicyFeature::Vibrate,
+ {start_url.GetOrigin()}),
root->current_replication_state().feature_policy_header);
// When the main frame navigates to a page with a new policy, it should
// overwrite the old one.
EXPECT_TRUE(NavigateToURL(shell(), first_nav_url));
- EXPECT_EQ(CreateFPHeaderMatchesAll("vibrate"),
+ EXPECT_EQ(CreateFPHeaderMatchesAll(blink::WebFeaturePolicyFeature::Vibrate),
root->current_replication_state().feature_policy_header);
// When the main frame navigates to a page without a policy, the replicated
@@ -9216,13 +9216,14 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessFeaturePolicyBrowserTest,
EXPECT_TRUE(NavigateToURL(shell(), start_url));
FrameTreeNode* root = web_contents()->GetFrameTree()->root();
- EXPECT_EQ(CreateFPHeader("vibrate", {start_url.GetOrigin()}),
+ EXPECT_EQ(CreateFPHeader(blink::WebFeaturePolicyFeature::Vibrate,
+ {start_url.GetOrigin()}),
root->current_replication_state().feature_policy_header);
// When the main frame navigates to a page with a new policy, it should
// overwrite the old one.
EXPECT_TRUE(NavigateToURL(shell(), first_nav_url));
- EXPECT_EQ(CreateFPHeaderMatchesAll("vibrate"),
+ EXPECT_EQ(CreateFPHeaderMatchesAll(blink::WebFeaturePolicyFeature::Vibrate),
root->current_replication_state().feature_policy_header);
// When the main frame navigates to a page without a policy, the replicated
@@ -9244,18 +9245,19 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessFeaturePolicyBrowserTest,
EXPECT_TRUE(NavigateToURL(shell(), main_url));
FrameTreeNode* root = web_contents()->GetFrameTree()->root();
- EXPECT_EQ(CreateFPHeader("vibrate",
+ EXPECT_EQ(CreateFPHeader(blink::WebFeaturePolicyFeature::Vibrate,
{main_url.GetOrigin(), GURL("http://example.com/")}),
root->current_replication_state().feature_policy_header);
EXPECT_EQ(1UL, root->child_count());
EXPECT_EQ(
- CreateFPHeader("vibrate", {main_url.GetOrigin()}),
+ CreateFPHeader(blink::WebFeaturePolicyFeature::Vibrate,
+ {main_url.GetOrigin()}),
root->child_at(0)->current_replication_state().feature_policy_header);
// Navigate the iframe cross-site.
NavigateFrameToURL(root->child_at(0), first_nav_url);
EXPECT_EQ(
- CreateFPHeaderMatchesAll("vibrate"),
+ CreateFPHeaderMatchesAll(blink::WebFeaturePolicyFeature::Vibrate),
root->child_at(0)->current_replication_state().feature_policy_header);
// Navigate the iframe to another location, this one with no policy header
@@ -9267,7 +9269,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessFeaturePolicyBrowserTest,
// Navigate the iframe back to a page with a policy
NavigateFrameToURL(root->child_at(0), first_nav_url);
EXPECT_EQ(
- CreateFPHeaderMatchesAll("vibrate"),
+ CreateFPHeaderMatchesAll(blink::WebFeaturePolicyFeature::Vibrate),
root->child_at(0)->current_replication_state().feature_policy_header);
}
« no previous file with comments | « no previous file | content/child/feature_policy/feature_policy_platform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698