Enforce no path service has improper path.
[email protected],[email protected]
BUG=168890
Review URL: https://chromiumcodereview.appspot.com/12035095
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178932 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc
index 0b96c123..b71f078 100644
--- a/base/path_service_unittest.cc
+++ b/base/path_service_unittest.cc
@@ -28,6 +28,7 @@
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 @@
check_path_exists = false;
}
#endif
+#if defined(OS_MAC)
+ 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));
}