Revert 4298 "Makes it possible to find files used by some unit t..."
> Makes it possible to find files used by some unit tests when running them as Chrome native tests.
>
> BUG=N/A
> R=andrew@webrtc.org
>
> Review URL: https://webrtc-codereview.appspot.com/1749004
Broke Android NDK/Android.mk builds.
TBR=henrike@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/1752006
git-svn-id: http://webrtc.googlecode.com/svn/trunk@4299 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/test/testsupport/fileutils.cc b/webrtc/test/testsupport/fileutils.cc
index 84945ff..61e4bcf 100644
--- a/webrtc/test/testsupport/fileutils.cc
+++ b/webrtc/test/testsupport/fileutils.cc
@@ -31,33 +31,28 @@
namespace webrtc {
namespace test {
-namespace {
-
#ifdef WIN32
-const char* kPathDelimiter = "\\";
+static const char* kPathDelimiter = "\\";
#else
-const char* kPathDelimiter = "/";
+static const char* kPathDelimiter = "/";
#endif
#ifdef WEBRTC_ANDROID
-const char* kResourcesDirName = "resources";
+static const char* kRootDirName = "/sdcard/";
+static const char* kResourcesDirName = "resources";
#else
// The file we're looking for to identify the project root dir.
-const char* kProjectRootFileName = "DEPS";
-const char* kResourcesDirName = "resources";
+static const char* kProjectRootFileName = "DEPS";
+static const char* kOutputDirName = "out";
+static const char* kFallbackPath = "./";
+static const char* kResourcesDirName = "resources";
#endif
-
-const char* kFallbackPath = "./";
-const char* kOutputDirName = "out";
-char relative_dir_path[FILENAME_MAX];
-bool relative_dir_path_set = false;
-
-} // namespace
-
const char* kCannotFindProjectRootDir = "ERROR_CANNOT_FIND_PROJECT_ROOT_DIR";
-std::string OutputPathAndroid();
-std::string ProjectRoothPathAndroid();
+namespace {
+char relative_dir_path[FILENAME_MAX];
+bool relative_dir_path_set = false;
+}
void SetExecutablePath(const std::string& path) {
std::string working_dir = WorkingDir();
@@ -78,30 +73,18 @@
return stat(file_name.c_str(), &file_info) == 0;
}
-std::string OutputPathImpl() {
- std::string path = ProjectRootPath();
- if (path == kCannotFindProjectRootDir) {
- return kFallbackPath;
- }
- path += kOutputDirName;
- if (!CreateDirectory(path)) {
- return kFallbackPath;
- }
- return path + kPathDelimiter;
-}
-
#ifdef WEBRTC_ANDROID
std::string ProjectRootPath() {
- return ProjectRoothPathAndroid();
+ return kRootDirName;
}
std::string OutputPath() {
- return OutputPathAndroid();
+ return kRootDirName;
}
std::string WorkingDir() {
- return ProjectRootPath();
+ return kRootDirName;
}
#else // WEBRTC_ANDROID
@@ -131,7 +114,15 @@
}
std::string OutputPath() {
- return OutputPathImpl();
+ std::string path = ProjectRootPath();
+ if (path == kCannotFindProjectRootDir) {
+ return kFallbackPath;
+ }
+ path += kOutputDirName;
+ if (!CreateDirectory(path)) {
+ return kFallbackPath;
+ }
+ return path + kPathDelimiter;
}
std::string WorkingDir() {