Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: base/i18n/file_util_icu_unittest.cc

Issue 6793008: Replacing base::DIR_TEMP with ScopedTempDir when appropriate. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Needed to rebase; patch didn't apply cleanly to save_package_unittest. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
9 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
10 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h" 10 #include "testing/platform_test.h"
12 11
13 // file_util winds up using autoreleased objects on the Mac, so this needs 12 // file_util winds up using autoreleased objects on the Mac, so this needs
14 // to be a PlatformTest 13 // to be a PlatformTest
15 class FileUtilICUTest : public PlatformTest { 14 class FileUtilICUTest : public PlatformTest {
16 protected:
17 virtual void SetUp() {
18 PlatformTest::SetUp();
19 // Name a subdirectory of the temp directory.
20 ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &test_dir_));
21 test_dir_ = test_dir_.Append(FILE_PATH_LITERAL("FileUtilTest"));
22
23 // Create a fresh, empty copy of this directory.
24 file_util::Delete(test_dir_, true);
25 file_util::CreateDirectory(test_dir_);
26 }
27 virtual void TearDown() {
28 PlatformTest::TearDown();
29 // Clean up test directory
30 ASSERT_TRUE(file_util::Delete(test_dir_, true));
31 ASSERT_FALSE(file_util::PathExists(test_dir_));
32 }
33
34 // the path to temporary directory used to contain the test operations
35 FilePath test_dir_;
36 }; 15 };
37 16
38 #if defined(OS_POSIX) && !defined(OS_MACOSX) 17 #if defined(OS_POSIX) && !defined(OS_MACOSX)
39 18
40 // Linux disallows some evil ASCII characters, but passes all non-ASCII. 19 // Linux disallows some evil ASCII characters, but passes all non-ASCII.
41 static const struct goodbad_pair { 20 static const struct goodbad_pair {
42 const char* bad_name; 21 const char* bad_name;
43 const char* good_name; 22 const char* good_name;
44 } kIllegalCharacterCases[] = { 23 } kIllegalCharacterCases[] = {
45 {"bad*file:name?.jpg", "bad-file-name-.jpg"}, 24 {"bad*file:name?.jpg", "bad-file-name-.jpg"},
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 #elif defined(OS_MACOSX) 75 #elif defined(OS_MACOSX)
97 std::string bad_name(WideToUTF8(kIllegalCharacterCases[i].bad_name)); 76 std::string bad_name(WideToUTF8(kIllegalCharacterCases[i].bad_name));
98 file_util::ReplaceIllegalCharactersInPath(&bad_name, '-'); 77 file_util::ReplaceIllegalCharactersInPath(&bad_name, '-');
99 EXPECT_EQ(WideToUTF8(kIllegalCharacterCases[i].good_name), bad_name); 78 EXPECT_EQ(WideToUTF8(kIllegalCharacterCases[i].good_name), bad_name);
100 #endif 79 #endif
101 } 80 }
102 } 81 }
103 82
104 #endif 83 #endif
105 84
OLDNEW
« no previous file with comments | « app/sql/transaction_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_html_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698