Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1288 | 1288 |
| 1289 // Test the PrintTo overload for FilePath (used when a test fails to compare two | 1289 // Test the PrintTo overload for FilePath (used when a test fails to compare two |
| 1290 // FilePaths). | 1290 // FilePaths). |
| 1291 TEST_F(FilePathTest, PrintTo) { | 1291 TEST_F(FilePathTest, PrintTo) { |
| 1292 std::stringstream ss; | 1292 std::stringstream ss; |
| 1293 FilePath fp(FPL("foo")); | 1293 FilePath fp(FPL("foo")); |
| 1294 base::PrintTo(fp, &ss); | 1294 base::PrintTo(fp, &ss); |
| 1295 EXPECT_EQ("foo", ss.str()); | 1295 EXPECT_EQ("foo", ss.str()); |
| 1296 } | 1296 } |
| 1297 | 1297 |
| 1298 // Test GetHFSDecomposedForm should return empty result for invalid UTF-8 | |
| 1299 // strings. | |
| 1300 #if defined(OS_MACOSX) | |
| 1301 TEST_F(FilePathTest, GetHFSDecomposedFormWithInvalidInput) { | |
| 1302 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
| |
| 1303 { FPL("\xc3\x28"), true }, | |
| 1304 { FPL("\xe2\x82\x28"), true }, | |
| 1305 { FPL("\xe2\x28\xa1"), true }, | |
| 1306 { FPL("\xf0\x28\x8c\xbc"), true }, | |
| 1307 { FPL("\xf0\x28\x8c\x28"), true }, | |
| 1308 }; | |
| 1309 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
| |
| 1310 FilePath::StringPieceType invalid_input(cases[i].input); | |
| 1311 FilePath::StringType observed = FilePath::GetHFSDecomposedForm( | |
| 1312 invalid_input); | |
| 1313 EXPECT_TRUE(observed.empty()); | |
| 1314 } | |
| 1315 } | |
| 1316 #endif | |
| 1317 | |
| 1298 } // namespace base | 1318 } // namespace base |
| OLD | NEW |