Enforce no path service has improper path.

R=cpu@chromium.org,mark@chromium.org
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


CrOS-Libchrome-Original-Commit: f4f5c92ea1ed582d1af710691051635f19f4d8d2
diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc
index 0b96c12..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));
 }