diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 22:15:57 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-21 22:15:57 +0000 |
commit | 835c74a3356031e0d7a1974c1a0ff9225bb315e1 (patch) | |
tree | 0f775f7be0ecfc469750d2cf391c3d2c9abf09b3 /base/file_path_unittest.cc | |
parent | c092b6c600d77f4ece53b3bb31642963ee8be47a (diff) | |
download | chromium_src-835c74a3356031e0d7a1974c1a0ff9225bb315e1.zip chromium_src-835c74a3356031e0d7a1974c1a0ff9225bb315e1.tar.gz chromium_src-835c74a3356031e0d7a1974c1a0ff9225bb315e1.tar.bz2 |
Adds AppendASCII which will append an ASCII path component.
Since this is safe to do on all platform path encodings (even Linux), this allows path components to be taken from ASCII sources without #ifdefs for the caller.
Review URL: http://codereview.chromium.org/18134
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_path_unittest.cc')
-rw-r--r-- | base/file_path_unittest.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/base/file_path_unittest.cc b/base/file_path_unittest.cc index b237af6..3439c6c 100644 --- a/base/file_path_unittest.cc +++ b/base/file_path_unittest.cc @@ -5,7 +5,7 @@ #include "base/basictypes.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/path_service.h" +#include "base/string_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -293,6 +293,17 @@ TEST_F(FilePathTest, Append) { FilePath observed_path = root.Append(FilePath(leaf)); EXPECT_EQ(FilePath::StringType(cases[i].expected), observed_path.value()) << "i: " << i << ", root: " << root.value() << ", leaf: " << leaf; + + // TODO(erikkay): It would be nice to have a unicode test append value to + // handle the case when AppendASCII is passed UTF8 +#if defined(OS_WIN) + std::string ascii = WideToASCII(leaf); +#elif defined(OS_POSIX) + std::string ascii = leaf; +#endif + observed_str = root.AppendASCII(ascii); + EXPECT_EQ(FilePath::StringType(cases[i].expected), observed_str.value()) << + "i: " << i << ", root: " << root.value() << ", leaf: " << leaf; } } |