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

Side by Side Diff: base/file_util_unittest.cc

Issue 6057010: base: Remove deprecated file_util::GetFilenameFromPath function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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_util_deprecated.h ('k') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 #elif defined(OS_POSIX) 244 #elif defined(OS_POSIX)
245 {L"/foo/bar", L"bar"}, 245 {L"/foo/bar", L"bar"},
246 {L"/foo/bar/", L""}, 246 {L"/foo/bar/", L""},
247 {L"/filename.exe", L"filename.exe"}, 247 {L"/filename.exe", L"filename.exe"},
248 {L"filename.exe", L"filename.exe"}, 248 {L"filename.exe", L"filename.exe"},
249 {L"", L""}, 249 {L"", L""},
250 {L"/", L""}, 250 {L"/", L""},
251 #endif 251 #endif
252 }; 252 };
253 253
254 #if defined(OS_WIN)
255 // This function is deprecated on non-Windows.
256 TEST_F(FileUtilTest, GetFilenameFromPath) {
257 for (unsigned int i = 0; i < arraysize(filename_cases); ++i) {
258 const filename_case& value = filename_cases[i];
259 std::wstring result = file_util::GetFilenameFromPath(value.path);
260 EXPECT_EQ(value.filename, result);
261 }
262 }
263 #endif
264
265 // Test finding the file type from a path name 254 // Test finding the file type from a path name
266 static const struct extension_case { 255 static const struct extension_case {
267 const wchar_t* path; 256 const wchar_t* path;
268 const wchar_t* extension; 257 const wchar_t* extension;
269 } extension_cases[] = { 258 } extension_cases[] = {
270 #if defined(OS_WIN) 259 #if defined(OS_WIN)
271 {L"C:\\colon\\backslash\\filename.extension", L"extension"}, 260 {L"C:\\colon\\backslash\\filename.extension", L"extension"},
272 {L"C:\\colon\\backslash\\filename.", L""}, 261 {L"C:\\colon\\backslash\\filename.", L""},
273 {L"C:\\colon\\backslash\\filename", L""}, 262 {L"C:\\colon\\backslash\\filename", L""},
274 {L"C:\\colon\\backslash\\", L""}, 263 {L"C:\\colon\\backslash\\", L""},
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir)); 1816 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir));
1828 1817
1829 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt"))); 1818 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt")));
1830 std::string bar("baz"); 1819 std::string bar("baz");
1831 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length())); 1820 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length()));
1832 1821
1833 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir)); 1822 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir));
1834 } 1823 }
1835 1824
1836 } // namespace 1825 } // namespace
OLDNEW
« no previous file with comments | « base/file_util_deprecated.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698