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

Side by Side Diff: base/file_util_unittest.cc

Issue 6246036: FilePath: Remove most of ToWStringHack, adding a LossyDisplayName() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bug link Created 9 years, 10 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
« no previous file with comments | « base/file_path.cc ('k') | chrome/browser/chromeos/options/wifi_config_view.cc » ('j') | 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) 2011 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <winioctl.h> 9 #include <winioctl.h>
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 157
158 private: 158 private:
159 std::set<FilePath::StringType> files_; 159 std::set<FilePath::StringType> files_;
160 }; 160 };
161 161
162 // Simple function to dump some text into a new file. 162 // Simple function to dump some text into a new file.
163 void CreateTextFile(const FilePath& filename, 163 void CreateTextFile(const FilePath& filename,
164 const std::wstring& contents) { 164 const std::wstring& contents) {
165 std::ofstream file; 165 std::ofstream file;
166 file.open(WideToUTF8(filename.ToWStringHack()).c_str()); 166 file.open(filename.value().c_str());
167 ASSERT_TRUE(file.is_open()); 167 ASSERT_TRUE(file.is_open());
168 file << contents; 168 file << contents;
169 file.close(); 169 file.close();
170 } 170 }
171 171
172 // Simple function to take out some text from a file. 172 // Simple function to take out some text from a file.
173 std::wstring ReadTextFile(const FilePath& filename) { 173 std::wstring ReadTextFile(const FilePath& filename) {
174 wchar_t contents[64]; 174 wchar_t contents[64];
175 std::wifstream file; 175 std::wifstream file;
176 file.open(WideToUTF8(filename.ToWStringHack()).c_str()); 176 file.open(filename.value().c_str());
177 EXPECT_TRUE(file.is_open()); 177 EXPECT_TRUE(file.is_open());
178 file.getline(contents, 64); 178 file.getline(contents, 64);
179 file.close(); 179 file.close();
180 return std::wstring(contents); 180 return std::wstring(contents);
181 } 181 }
182 182
183 #if defined(OS_WIN) 183 #if defined(OS_WIN)
184 uint64 FileTimeAsUint64(const FILETIME& ft) { 184 uint64 FileTimeAsUint64(const FILETIME& ft) {
185 ULARGE_INTEGER u; 185 ULARGE_INTEGER u;
186 u.LowPart = ft.dwLowDateTime; 186 u.LowPart = ft.dwLowDateTime;
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir)); 1807 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir));
1808 1808
1809 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt"))); 1809 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt")));
1810 std::string bar("baz"); 1810 std::string bar("baz");
1811 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length())); 1811 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length()));
1812 1812
1813 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir)); 1813 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir));
1814 } 1814 }
1815 1815
1816 } // namespace 1816 } // namespace
OLDNEW
« no previous file with comments | « base/file_path.cc ('k') | chrome/browser/chromeos/options/wifi_config_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698