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

Side by Side Diff: base/files/file_util_unittest.cc

Issue 2731263002: Use UTF-8 rather than UNICODE for the OpenFile w/ character set test. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <fstream> 9 #include <fstream>
10 #include <initializer_list> 10 #include <initializer_list>
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 ::_tputenv_s(kTmpKey, _T("")); 1737 ::_tputenv_s(kTmpKey, _T(""));
1738 } 1738 }
1739 } 1739 }
1740 #endif // OS_WIN 1740 #endif // OS_WIN
1741 1741
1742 // Test that files opened by OpenFile are not set up for inheritance into child 1742 // Test that files opened by OpenFile are not set up for inheritance into child
1743 // procs. 1743 // procs.
1744 TEST_F(FileUtilTest, OpenFileNoInheritance) { 1744 TEST_F(FileUtilTest, OpenFileNoInheritance) {
1745 FilePath file_path(temp_dir_.GetPath().Append(FPL("a_file"))); 1745 FilePath file_path(temp_dir_.GetPath().Append(FPL("a_file")));
1746 1746
1747 for (const char* mode : {"wb", "r,ccs=UNICODE"}) { 1747 for (const char* mode : {"wb", "r,ccs=UTF-8"}) {
1748 SCOPED_TRACE(mode); 1748 SCOPED_TRACE(mode);
1749 ASSERT_NO_FATAL_FAILURE(CreateTextFile(file_path, L"Geepers")); 1749 ASSERT_NO_FATAL_FAILURE(CreateTextFile(file_path, L"Geepers"));
1750 FILE* file = OpenFile(file_path, mode); 1750 FILE* file = OpenFile(file_path, mode);
1751 ASSERT_NE(nullptr, file); 1751 ASSERT_NE(nullptr, file);
1752 { 1752 {
1753 ScopedClosureRunner file_closer(Bind(IgnoreResult(&CloseFile), file)); 1753 ScopedClosureRunner file_closer(Bind(IgnoreResult(&CloseFile), file));
1754 bool is_inheritable = true; 1754 bool is_inheritable = true;
1755 ASSERT_NO_FATAL_FAILURE(GetIsInheritable(file, &is_inheritable)); 1755 ASSERT_NO_FATAL_FAILURE(GetIsInheritable(file, &is_inheritable));
1756 EXPECT_FALSE(is_inheritable); 1756 EXPECT_FALSE(is_inheritable);
1757 } 1757 }
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 // Trying to close it should crash. This is important for security. 2616 // Trying to close it should crash. This is important for security.
2617 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); 2617 EXPECT_DEATH(CloseWithScopedFD(fds[1]), "");
2618 #endif 2618 #endif
2619 } 2619 }
2620 2620
2621 #endif // defined(OS_POSIX) 2621 #endif // defined(OS_POSIX)
2622 2622
2623 } // namespace 2623 } // namespace
2624 2624
2625 } // namespace base 2625 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698