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

Unified Diff: testing/utils/path_service.h

Issue 1411403012: Merge to XFA: Add path service to retrieve test data directory at run time so tests can be run from… (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: remove a blank line Created 5 years, 1 month 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
« no previous file with comments | « testing/test_support.cpp ('k') | testing/utils/path_service.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/utils/path_service.h
diff --git a/testing/utils/path_service.h b/testing/utils/path_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..96fd69e8894ab7e9e307b3c4f60df0abefd612dd
--- /dev/null
+++ b/testing/utils/path_service.h
@@ -0,0 +1,37 @@
+// Copyright 2015 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TESTING_UTILS_PATH_SERVICE_H_
+#define TESTING_UTILS_PATH_SERVICE_H_
+
+#include <string>
+
+#ifdef _WIN32
+#define PATH_SEPARATOR '\\'
+#else
+#define PATH_SEPARATOR '/'
+#endif
+
+// Get the various file directory and path information.
+class PathService {
+ public:
+ // Return true when the path ends with a path separator.
+ static bool EndsWithSeparator(const std::string& path);
+
+ // Retrieve the directory where executables run from.
+ static bool GetExecutableDir(std::string* path);
+
+ // Retrieve the root directory of the source tree.
+ // Assume executables always run from out/<Debug|Release>/, the source
+ // directory is two levels above the executable directory.
+ static bool GetSourceDir(std::string* path);
+
+ // Retrieve the test data directory where test files are stored.
+ // Currently, the test dir is under <source_dir>/testing/resources/.
+ static bool GetTestDataDir(std::string* path);
+
+ // Get the full path for a test file under the test data directory.
+ static bool GetTestFilePath(const std::string& file_name, std::string* path);
+};
+#endif // TESTING_UTILS_PATH_SERVICE_H_
« no previous file with comments | « testing/test_support.cpp ('k') | testing/utils/path_service.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698