Restore old behavior for Android in fileutils.cc
From r7014 the Android APK tests are designed to be
build from a standalone WebRTC checkout instead of a
Chromium checkout. Because of that, the special handling
for both cases can be removed.
I also don't think we need to use the
base::android::GetExternalStorageDirectory() method since
all devices has a symlink at /sdcard that points
to /storage/emulated/legacy on the Android device.
This essentially reverts the changes in
https://webrtc-codereview.appspot.com/1754005/
plus some minor changes.
BUG=webrtc:3741
TEST=Locally running test_support_unittests APK test on an
Android device using:
CHECKOUT_SOURCE_ROOT=`pwd` build/android/test_runner.py gtest -s test_support_unittests --verbose --isolate-file-path=webrtc/test/test_support_unittests.isolate
R=henrike@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/15329004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7632 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/test/testsupport/fileutils.cc b/webrtc/test/testsupport/fileutils.cc
index a3e6620..36ca391 100644
--- a/webrtc/test/testsupport/fileutils.cc
+++ b/webrtc/test/testsupport/fileutils.cc
@@ -50,15 +50,15 @@
#endif
#ifdef WEBRTC_ANDROID
-const char* kResourcesDirName = "resources";
+const char* kRootDirName = "/sdcard/";
#else
// The file we're looking for to identify the project root dir.
const char* kProjectRootFileName = "DEPS";
-const char* kResourcesDirName = "resources";
-#endif
-
-const char* kFallbackPath = "./";
const char* kOutputDirName = "out";
+const char* kFallbackPath = "./";
+#endif
+const char* kResourcesDirName = "resources";
+
char relative_dir_path[FILENAME_MAX];
bool relative_dir_path_set = false;
@@ -66,9 +66,6 @@
const char* kCannotFindProjectRootDir = "ERROR_CANNOT_FIND_PROJECT_ROOT_DIR";
-std::string OutputPathAndroid();
-std::string ProjectRootPathAndroid();
-
void SetExecutablePath(const std::string& path) {
std::string working_dir = WorkingDir();
std::string temp_path = path;
@@ -95,30 +92,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 (!CreateDir(path)) {
- return kFallbackPath;
- }
- return path + kPathDelimiter;
-}
-
#ifdef WEBRTC_ANDROID
std::string ProjectRootPath() {
- return ProjectRootPathAndroid();
+ return kRootDirName;
}
std::string OutputPath() {
- return OutputPathAndroid();
+ return kRootDirName;
}
std::string WorkingDir() {
- return ProjectRootPath();
+ return kRootDirName;
}
#else // WEBRTC_ANDROID
@@ -148,7 +133,15 @@
}
std::string OutputPath() {
- return OutputPathImpl();
+ std::string path = ProjectRootPath();
+ if (path == kCannotFindProjectRootDir) {
+ return kFallbackPath;
+ }
+ path += kOutputDirName;
+ if (!CreateDir(path)) {
+ return kFallbackPath;
+ }
+ return path + kPathDelimiter;
}
std::string WorkingDir() {