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

Unified Diff: net/test/python_utils.cc

Issue 979643002: Fix the following browser_tests in the Linux GN build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« chrome/test/BUILD.gn ('K') | « net/BUILD.gn ('k') | ppapi/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/python_utils.cc
diff --git a/net/test/python_utils.cc b/net/test/python_utils.cc
index 9de1e7de8646b4c3cc30706932cd398a92e2b521..7d137b7c4117054e20c153a028f6e71a1029e6ae 100644
--- a/net/test/python_utils.cc
+++ b/net/test/python_utils.cc
@@ -17,6 +17,10 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#if defined(OS_MACOSX)
+#include "base/mac/foundation_util.h"
+#endif
+
const char kPythonPathEnv[] = "PYTHONPATH";
void AppendToPythonPath(const base::FilePath& dir) {
@@ -50,25 +54,26 @@ bool GetPyProtoPath(base::FilePath* dir) {
return false;
}
+#if defined(OS_MACOSX)
+ if (base::mac::AmIBundled())
+ generated_code_dir = generated_code_dir.DirName().DirName().DirName();
+#endif
+
+ // Used for GYP. TODO(jam): remove after GN conversion.
const base::FilePath kPyProto(FILE_PATH_LITERAL("pyproto"));
+ if (base::DirectoryExists(generated_code_dir.Append(kPyProto))) {
+ *dir = generated_code_dir.Append(kPyProto);
+ return true;
+ }
-#if defined(OS_MACOSX)
- // On Mac, DIR_EXE might be pointing deep into the Release/ (or Debug/)
- // directory and we can't depend on how far down it goes. So we walk upwards
- // from DIR_EXE until we find a likely looking spot.
- while (!base::DirectoryExists(generated_code_dir.Append(kPyProto))) {
- base::FilePath parent = generated_code_dir.DirName();
- if (parent == generated_code_dir) {
- // We hit the root directory. Maybe we didn't build any targets which
- // produced Python protocol buffers.
- return false;
- }
- generated_code_dir = parent;
+ // Used for GN.
+ const base::FilePath kGen(FILE_PATH_LITERAL("gen"));
+ if (base::DirectoryExists(generated_code_dir.Append(kGen))) {
+ *dir = generated_code_dir.Append(kGen);
+ return true;
}
-#endif
- *dir = generated_code_dir.Append(kPyProto);
- VLOG(2) << "Found " << kPyProto.value() << " in " << dir->value();
- return true;
+
+ return false;
}
#if defined(OS_WIN)
« chrome/test/BUILD.gn ('K') | « net/BUILD.gn ('k') | ppapi/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698