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

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 one forgotten copyright header. 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
« no previous file with comments | « chrome/browser/policy/policy_path_parser_posix.cc ('k') | chrome/browser/policy/policy_path_parser_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..faac5b501b539e74f4f3b08ef630f83811422c4b 100644
--- a/chrome/browser/policy/policy_path_parser_unittest.cc
+++ b/chrome/browser/policy/policy_path_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -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);
« no previous file with comments | « chrome/browser/policy/policy_path_parser_posix.cc ('k') | chrome/browser/policy/policy_path_parser_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698