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

Side by Side Diff: base/file_util_unittest.cc

Issue 2861042: Deprecate more old filepath functions. (Closed)
Patch Set: Created 10 years, 5 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 | « base/file_util_deprecated.h ('k') | chrome/browser/tab_contents/navigation_controller.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) 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 #elif defined(OS_POSIX) 318 #elif defined(OS_POSIX)
319 {L"/foo/bar", L"bar"}, 319 {L"/foo/bar", L"bar"},
320 {L"/foo/bar/", L""}, 320 {L"/foo/bar/", L""},
321 {L"/filename.exe", L"filename.exe"}, 321 {L"/filename.exe", L"filename.exe"},
322 {L"filename.exe", L"filename.exe"}, 322 {L"filename.exe", L"filename.exe"},
323 {L"", L""}, 323 {L"", L""},
324 {L"/", L""}, 324 {L"/", L""},
325 #endif 325 #endif
326 }; 326 };
327 327
328 #if defined(OS_WIN)
329 // This function is deprecated on non-Windows.
328 TEST_F(FileUtilTest, GetFilenameFromPath) { 330 TEST_F(FileUtilTest, GetFilenameFromPath) {
329 for (unsigned int i = 0; i < arraysize(filename_cases); ++i) { 331 for (unsigned int i = 0; i < arraysize(filename_cases); ++i) {
330 const filename_case& value = filename_cases[i]; 332 const filename_case& value = filename_cases[i];
331 std::wstring result = file_util::GetFilenameFromPath(value.path); 333 std::wstring result = file_util::GetFilenameFromPath(value.path);
332 EXPECT_EQ(value.filename, result); 334 EXPECT_EQ(value.filename, result);
333 } 335 }
334 } 336 }
337 #endif
335 338
336 // Test finding the file type from a path name 339 // Test finding the file type from a path name
337 static const struct extension_case { 340 static const struct extension_case {
338 const wchar_t* path; 341 const wchar_t* path;
339 const wchar_t* extension; 342 const wchar_t* extension;
340 } extension_cases[] = { 343 } extension_cases[] = {
341 #if defined(OS_WIN) 344 #if defined(OS_WIN)
342 {L"C:\\colon\\backslash\\filename.extension", L"extension"}, 345 {L"C:\\colon\\backslash\\filename.extension", L"extension"},
343 {L"C:\\colon\\backslash\\filename.", L""}, 346 {L"C:\\colon\\backslash\\filename.", L""},
344 {L"C:\\colon\\backslash\\filename", L""}, 347 {L"C:\\colon\\backslash\\filename", L""},
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir)); 1851 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir));
1849 1852
1850 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt"))); 1853 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt")));
1851 std::string bar("baz"); 1854 std::string bar("baz");
1852 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length())); 1855 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length()));
1853 1856
1854 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir)); 1857 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir));
1855 } 1858 }
1856 1859
1857 } // namespace 1860 } // namespace
OLDNEW
« no previous file with comments | « base/file_util_deprecated.h ('k') | chrome/browser/tab_contents/navigation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698