Testing: Fixed printing FilePaths when a test fails comparing them.
Moved PrintTo (for FilePath) into the base namespace (it was already
implemented, but in the wrong namespace). The PrintTo function has to be
in the same namespace as the class being printed.
BUG=488344
Review URL: https://codereview.chromium.org/1139883004
Cr-Commit-Position: refs/heads/master@{#331763}
CrOS-Libchrome-Original-Commit: abf18048b9a498ced34e2f8dff1fa1dcf6737927
diff --git a/base/files/file_path.h b/base/files/file_path.h
index 5225b12..3a0513d 100644
--- a/base/files/file_path.h
+++ b/base/files/file_path.h
@@ -103,6 +103,8 @@
#define BASE_FILES_FILE_PATH_H_
#include <stddef.h>
+
+#include <iosfwd>
#include <string>
#include <vector>
@@ -433,10 +435,13 @@
StringType path_;
};
-} // namespace base
-
// This is required by googletest to print a readable output on test failures.
-BASE_EXPORT extern void PrintTo(const base::FilePath& path, std::ostream* out);
+// This is declared here for use in gtest-based unit tests but is defined in
+// the test_support_base target. Depend on that to use this in your unit test.
+// This should not be used in production code - call ToString() instead.
+void PrintTo(const FilePath& path, std::ostream* out);
+
+} // namespace base
// Macros for string literal initialization of FilePath::CharType[], and for
// using a FilePath::CharType[] in a printf-style format string.