| 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 FilePath::CharType* cases[] = { |
| 1303 FPL("\xc3\x28"), |
| 1304 FPL("\xe2\x82\x28"), |
| 1305 FPL("\xe2\x28\xa1"), |
| 1306 FPL("\xf0\x28\x8c\xbc"), |
| 1307 FPL("\xf0\x28\x8c\x28"), |
| 1308 }; |
| 1309 for (const auto& invalid_input : cases) { |
| 1310 FilePath::StringType observed = FilePath::GetHFSDecomposedForm( |
| 1311 invalid_input); |
| 1312 EXPECT_TRUE(observed.empty()); |
| 1313 } |
| 1314 } |
| 1315 #endif |
| 1316 |
| 1298 } // namespace base | 1317 } // namespace base |
| OLD | NEW |