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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2727803004: Replace string by enum in WebParsedFeaturePolicyDeclaration#feature (Closed)
Patch Set: Codereview: remeve error message for unrecognized features in parser 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 2dcae41818e9614ca9c2d5badce9478bd45e8257..14a0ef2a32b2c2498161fa0a7ecb4cd487fe8f43 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(
+ const blink::WebFeaturePolicyFeature feature,
pfeldman 2017/03/17 01:12:20 drop the const - it is a value type enum
+ 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) {
+ const blink::WebFeaturePolicyFeature feature) {
pfeldman 2017/03/17 01:12:20 ditto
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,
@@ -9090,13 +9089,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
@@ -9116,13 +9116,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
@@ -9144,18 +9145,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
@@ -9167,7 +9169,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