| Index: third_party/crashpad/crashpad/test/test_paths.cc
|
| diff --git a/third_party/crashpad/crashpad/test/paths.cc b/third_party/crashpad/crashpad/test/test_paths.cc
|
| similarity index 66%
|
| rename from third_party/crashpad/crashpad/test/paths.cc
|
| rename to third_party/crashpad/crashpad/test/test_paths.cc
|
| index b5eb60b90b9ab7a49df8405b8e6c2e9b791ab7aa..4c25603049c6aa9ea0a6ccfd24a6948345d927d2 100644
|
| --- a/third_party/crashpad/crashpad/test/paths.cc
|
| +++ b/third_party/crashpad/crashpad/test/test_paths.cc
|
| @@ -12,13 +12,14 @@
|
| // See the License for the specific language governing permissions and
|
| // limitations under the License.
|
|
|
| -#include "test/paths.h"
|
| +#include "test/test_paths.h"
|
|
|
| #include <stdlib.h>
|
| #include <sys/stat.h>
|
|
|
| #include "base/logging.h"
|
| #include "build/build_config.h"
|
| +#include "util/misc/paths.h"
|
|
|
| namespace crashpad {
|
| namespace test {
|
| @@ -28,7 +29,7 @@ namespace {
|
| bool IsTestDataRoot(const base::FilePath& candidate) {
|
| const base::FilePath marker_path =
|
| candidate.Append(FILE_PATH_LITERAL("test"))
|
| - .Append(FILE_PATH_LITERAL("paths_test_data_root.txt"));
|
| + .Append(FILE_PATH_LITERAL("test_paths_test_data_root.txt"));
|
|
|
| #if !defined(OS_WIN)
|
| struct stat stat_buf;
|
| @@ -59,23 +60,25 @@ base::FilePath TestDataRootInternal() {
|
|
|
| // In a standalone build, the test executable is usually at
|
| // out/{Debug,Release} relative to the Crashpad root.
|
| - const base::FilePath executable = Paths::Executable();
|
| - base::FilePath candidate =
|
| - base::FilePath(executable.DirName()
|
| - .Append(base::FilePath::kParentDirectory)
|
| - .Append(base::FilePath::kParentDirectory));
|
| - if (IsTestDataRoot(candidate)) {
|
| - return candidate;
|
| - }
|
| + base::FilePath executable_path;
|
| + if (Paths::Executable(&executable_path)) {
|
| + base::FilePath candidate =
|
| + base::FilePath(executable_path.DirName()
|
| + .Append(base::FilePath::kParentDirectory)
|
| + .Append(base::FilePath::kParentDirectory));
|
| + if (IsTestDataRoot(candidate)) {
|
| + return candidate;
|
| + }
|
|
|
| - // In an in-Chromium build, the test executable is usually at
|
| - // out/{Debug,Release} relative to the Chromium root, and the Crashpad root is
|
| - // at third_party/crashpad/crashpad relative to the Chromium root.
|
| - candidate = candidate.Append(FILE_PATH_LITERAL("third_party"))
|
| - .Append(FILE_PATH_LITERAL("crashpad"))
|
| - .Append(FILE_PATH_LITERAL("crashpad"));
|
| - if (IsTestDataRoot(candidate)) {
|
| - return candidate;
|
| + // In an in-Chromium build, the test executable is usually at
|
| + // out/{Debug,Release} relative to the Chromium root, and the Crashpad root
|
| + // is at third_party/crashpad/crashpad relative to the Chromium root.
|
| + candidate = candidate.Append(FILE_PATH_LITERAL("third_party"))
|
| + .Append(FILE_PATH_LITERAL("crashpad"))
|
| + .Append(FILE_PATH_LITERAL("crashpad"));
|
| + if (IsTestDataRoot(candidate)) {
|
| + return candidate;
|
| + }
|
| }
|
|
|
| // If nothing else worked, use the current directory, issuing a warning if it
|
| @@ -90,7 +93,14 @@ base::FilePath TestDataRootInternal() {
|
| } // namespace
|
|
|
| // static
|
| -base::FilePath Paths::TestDataRoot() {
|
| +base::FilePath TestPaths::Executable() {
|
| + base::FilePath executable_path;
|
| + CHECK(Paths::Executable(&executable_path));
|
| + return executable_path;
|
| +}
|
| +
|
| +// static
|
| +base::FilePath TestPaths::TestDataRoot() {
|
| static base::FilePath* test_data_root =
|
| new base::FilePath(TestDataRootInternal());
|
| return *test_data_root;
|
|
|