Chromium Code Reviews| Index: base/files/file_path_unittest.cc |
| diff --git a/base/files/file_path_unittest.cc b/base/files/file_path_unittest.cc |
| index f57de67911a2af81689bb382f2f1a59445f695a6..a753bcde7780f86ca051ddcf62a2e4eabd236dd6 100644 |
| --- a/base/files/file_path_unittest.cc |
| +++ b/base/files/file_path_unittest.cc |
| @@ -1295,4 +1295,24 @@ TEST_F(FilePathTest, PrintTo) { |
| EXPECT_EQ("foo", ss.str()); |
| } |
| +// Test GetHFSDecomposedForm should return empty result for invalid UTF-8 |
| +// strings. |
| +#if defined(OS_MACOSX) |
| +TEST_F(FilePathTest, GetHFSDecomposedFormWithInvalidInput) { |
| + const struct UnaryBooleanTestData cases[] = { |
|
Lei Zhang
2016/03/30 21:53:08
You are not using UnaryBooleanTestData's |expected
Jialiu Lin
2016/03/31 00:44:51
Done
|
| + { FPL("\xc3\x28"), true }, |
| + { FPL("\xe2\x82\x28"), true }, |
| + { FPL("\xe2\x28\xa1"), true }, |
| + { FPL("\xf0\x28\x8c\xbc"), true }, |
| + { FPL("\xf0\x28\x8c\x28"), true }, |
| + }; |
| + for (size_t i = 0; i < arraysize(cases); i++) { |
|
Lei Zhang
2016/03/30 21:53:08
You can probably slightly simplify this to:
for (
Jialiu Lin
2016/03/31 00:44:51
Done
|
| + FilePath::StringPieceType invalid_input(cases[i].input); |
| + FilePath::StringType observed = FilePath::GetHFSDecomposedForm( |
| + invalid_input); |
| + EXPECT_TRUE(observed.empty()); |
| + } |
| +} |
| +#endif |
| + |
| } // namespace base |