| OLD | NEW |
| 1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "testing/utils/path_service.h" | 5 #include "testing/utils/path_service.h" |
| 6 | 6 |
| 7 #ifdef _WIN32 | 7 #ifdef _WIN32 |
| 8 #include <Windows.h> | 8 #include <Windows.h> |
| 9 #elif defined(__APPLE__) | 9 #elif defined(__APPLE__) |
| 10 #include <mach-o/dyld.h> | 10 #include <mach-o/dyld.h> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // static | 67 // static |
| 68 bool PathService::GetSourceDir(std::string* path) { | 68 bool PathService::GetSourceDir(std::string* path) { |
| 69 if (!GetExecutableDir(path)) | 69 if (!GetExecutableDir(path)) |
| 70 return false; | 70 return false; |
| 71 | 71 |
| 72 if (!EndsWithSeparator(*path)) | 72 if (!EndsWithSeparator(*path)) |
| 73 path->push_back(PATH_SEPARATOR); | 73 path->push_back(PATH_SEPARATOR); |
| 74 path->append(".."); | 74 path->append(".."); |
| 75 path->push_back(PATH_SEPARATOR); | 75 path->push_back(PATH_SEPARATOR); |
| 76 #if defined(ANDROID) |
| 77 path->append("chromium_tests_root"); |
| 78 #else // Non-Android |
| 76 path->append(".."); | 79 path->append(".."); |
| 80 #endif // defined(ANDROID) |
| 77 return true; | 81 return true; |
| 78 } | 82 } |
| 79 | 83 |
| 80 // static | 84 // static |
| 81 bool PathService::GetTestDataDir(std::string* path) { | 85 bool PathService::GetTestDataDir(std::string* path) { |
| 82 if (!GetSourceDir(path)) | 86 if (!GetSourceDir(path)) |
| 83 return false; | 87 return false; |
| 84 | 88 |
| 85 if (!EndsWithSeparator(*path)) | 89 if (!EndsWithSeparator(*path)) |
| 86 path->push_back(PATH_SEPARATOR); | 90 path->push_back(PATH_SEPARATOR); |
| 87 path->append("testing"); | 91 path->append("testing"); |
| 88 path->push_back(PATH_SEPARATOR); | 92 path->push_back(PATH_SEPARATOR); |
| 89 path->append("resources"); | 93 path->append("resources"); |
| 90 return true; | 94 return true; |
| 91 } | 95 } |
| 92 | 96 |
| 93 // static | 97 // static |
| 94 bool PathService::GetTestFilePath(const std::string& file_name, | 98 bool PathService::GetTestFilePath(const std::string& file_name, |
| 95 std::string* path) { | 99 std::string* path) { |
| 96 if (!GetTestDataDir(path)) | 100 if (!GetTestDataDir(path)) |
| 97 return false; | 101 return false; |
| 98 | 102 |
| 99 if (!EndsWithSeparator(*path)) | 103 if (!EndsWithSeparator(*path)) |
| 100 path->push_back(PATH_SEPARATOR); | 104 path->push_back(PATH_SEPARATOR); |
| 101 path->append(file_name); | 105 path->append(file_name); |
| 102 return true; | 106 return true; |
| 103 } | 107 } |
| OLD | NEW |