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_unittest.cc b/base/files/file_path_unittest.cc
index c162938..60eaa8f 100644
--- a/base/files/file_path_unittest.cc
+++ b/base/files/file_path_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <sstream>
+
#include "base/basictypes.h"
#include "base/files/file_path.h"
#include "base/strings/utf_string_conversions.h"
@@ -1273,4 +1275,13 @@
}
#endif
+// Test the PrintTo overload for FilePath (used when a test fails to compare two
+// FilePaths).
+TEST_F(FilePathTest, PrintTo) {
+ std::stringstream ss;
+ FilePath fp(FPL("foo"));
+ base::PrintTo(fp, &ss);
+ EXPECT_EQ("foo", ss.str());
+}
+
} // namespace base