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

Unified Diff: chrome/browser/policy/policy_path_parser_unittest.cc

Issue 6966032: Sanitize enclosing quotes around paths in policies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed the unit tests. Created 9 years, 7 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
Index: chrome/browser/policy/policy_path_parser_unittest.cc
diff --git a/chrome/browser/policy/policy_path_parser_unittest.cc b/chrome/browser/policy/policy_path_parser_unittest.cc
index 2c379e41da5b65a014460218128db59c8255425e..bf844e147ad33b5054f56b54308acfe4d2b2f4fb 100644
--- a/chrome/browser/policy/policy_path_parser_unittest.cc
+++ b/chrome/browser/policy/policy_path_parser_unittest.cc
@@ -33,6 +33,16 @@ TEST_F(PolicyPathParserTests, AllPlatformVariables) {
path_parser::ExpandPathVariables(unknown_vars);
ASSERT_EQ(unknown_vars_result, unknown_vars);
+ // Trim quotes around, but not inside paths. Test against bug 80211.
+ FilePath::StringType no_quotes(FILE_PATH_LITERAL("//$C/\"a\"/$path"));
+ FilePath::StringType single_quotes(FILE_PATH_LITERAL("'//$C/\"a\"/$path'"));
+ FilePath::StringType double_quotes(FILE_PATH_LITERAL("\"//$C/\"a\"/$path\""));
+ FilePath::StringType quotes_result =
+ path_parser::ExpandPathVariables(single_quotes);
+ ASSERT_EQ(quotes_result, no_quotes);
+ quotes_result = path_parser::ExpandPathVariables(double_quotes);
+ ASSERT_EQ(quotes_result, no_quotes);
+
// Both should have been substituted.
FilePath::StringType vars(FILE_PATH_LITERAL("${user_name}${machine_name}"));
FilePath::StringType vars_result = path_parser::ExpandPathVariables(vars);

Powered by Google App Engine
This is Rietveld 408576698