OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/i18n/file_util_icu.h" | 5 #include "base/i18n/file_util_icu.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 PlatformTest::TearDown(); | 28 PlatformTest::TearDown(); |
29 // Clean up test directory | 29 // Clean up test directory |
30 ASSERT_TRUE(file_util::Delete(test_dir_, true)); | 30 ASSERT_TRUE(file_util::Delete(test_dir_, true)); |
31 ASSERT_FALSE(file_util::PathExists(test_dir_)); | 31 ASSERT_FALSE(file_util::PathExists(test_dir_)); |
32 } | 32 } |
33 | 33 |
34 // the path to temporary directory used to contain the test operations | 34 // the path to temporary directory used to contain the test operations |
35 FilePath test_dir_; | 35 FilePath test_dir_; |
36 }; | 36 }; |
37 | 37 |
38 #if defined(OS_LINUX) | 38 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
39 | 39 |
40 // Linux disallows some evil ASCII characters, but passes all non-ASCII. | 40 // Linux disallows some evil ASCII characters, but passes all non-ASCII. |
41 static const struct goodbad_pair { | 41 static const struct goodbad_pair { |
42 const char* bad_name; | 42 const char* bad_name; |
43 const char* good_name; | 43 const char* good_name; |
44 } kIllegalCharacterCases[] = { | 44 } kIllegalCharacterCases[] = { |
45 {"bad*file:name?.jpg", "bad-file-name-.jpg"}, | 45 {"bad*file:name?.jpg", "bad-file-name-.jpg"}, |
46 {"**********::::.txt", "--------------.txt"}, | 46 {"**********::::.txt", "--------------.txt"}, |
47 {"\xe9\xf0zzzz.\xff", "\xe9\xf0zzzz.\xff"}, | 47 {"\xe9\xf0zzzz.\xff", "\xe9\xf0zzzz.\xff"}, |
48 }; | 48 }; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 #elif defined(OS_MACOSX) | 96 #elif defined(OS_MACOSX) |
97 std::string bad_name(WideToUTF8(kIllegalCharacterCases[i].bad_name)); | 97 std::string bad_name(WideToUTF8(kIllegalCharacterCases[i].bad_name)); |
98 file_util::ReplaceIllegalCharactersInPath(&bad_name, '-'); | 98 file_util::ReplaceIllegalCharactersInPath(&bad_name, '-'); |
99 EXPECT_EQ(WideToUTF8(kIllegalCharacterCases[i].good_name), bad_name); | 99 EXPECT_EQ(WideToUTF8(kIllegalCharacterCases[i].good_name), bad_name); |
100 #endif | 100 #endif |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 #endif | 104 #endif |
105 | 105 |
OLD | NEW |