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

Unified Diff: base/path_service_unittest.cc

Issue 12035095: Enforce no path service has improper path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Limit checks on OSX Created 7 years, 11 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 | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/path_service_unittest.cc
diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc
index 0b96c123e97abbdca9490c1e3edf593f120651ba..b71f078709326ad022f8c3c0cb53fb226093fd88 100644
--- a/base/path_service_unittest.cc
+++ b/base/path_service_unittest.cc
@@ -28,6 +28,7 @@ namespace {
bool ReturnsValidPath(int dir_type) {
FilePath path;
bool result = PathService::Get(dir_type, &path);
+
// Some paths might not exist on some platforms in which case confirming
// |result| is true and !path.empty() is the best we can do.
bool check_path_exists = true;
@@ -61,6 +62,16 @@ bool ReturnsValidPath(int dir_type) {
check_path_exists = false;
}
#endif
+#if defined(OS_MAC)
Nico 2013/03/13 23:18:40 It's OS_MAXOSX (https://codereview.chromium.org/12
+ if (dir_type != base::DIR_EXE && dir_type != base::DIR_MODULE &&
+ dir_type != base::FILE_EXE && dir_type != base::FILE_MODULE) {
+ if (path.ReferencesParent())
+ return false;
+ }
+#else
+ if (path.ReferencesParent())
+ return false;
+#endif
return result && !path.empty() && (!check_path_exists ||
file_util::PathExists(path));
}
« no previous file with comments | « no previous file | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698