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

Side by Side Diff: base/file_util_unittest.cc

Issue 159833003: Add support for GetHomeDir for Mac and Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 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_util_posix.cc ('k') | base/file_util_win.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) 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 "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 <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 EXPECT_TRUE(temp_dir_.path().IsParent(new_dir)); 1684 EXPECT_TRUE(temp_dir_.path().IsParent(new_dir));
1685 EXPECT_TRUE(DeleteFile(new_dir, false)); 1685 EXPECT_TRUE(DeleteFile(new_dir, false));
1686 } 1686 }
1687 1687
1688 TEST_F(FileUtilTest, GetShmemTempDirTest) { 1688 TEST_F(FileUtilTest, GetShmemTempDirTest) {
1689 FilePath dir; 1689 FilePath dir;
1690 EXPECT_TRUE(GetShmemTempDir(false, &dir)); 1690 EXPECT_TRUE(GetShmemTempDir(false, &dir));
1691 EXPECT_TRUE(DirectoryExists(dir)); 1691 EXPECT_TRUE(DirectoryExists(dir));
1692 } 1692 }
1693 1693
1694 TEST_F(FileUtilTest, GetHomeDirTest) {
1695 #if !defined(OS_ANDROID) // Not implemented on Android.
1696 // We don't actually know what the home directory is supposed to be without
1697 // calling some OS functions which would just duplicate the implementation.
1698 // So here we just test that it returns something "reasonable".
1699 FilePath home = GetHomeDir();
1700 ASSERT_FALSE(home.empty());
1701 ASSERT_TRUE(home.IsAbsolute());
1702 #endif
1703 }
1704
1694 TEST_F(FileUtilTest, CreateDirectoryTest) { 1705 TEST_F(FileUtilTest, CreateDirectoryTest) {
1695 FilePath test_root = 1706 FilePath test_root =
1696 temp_dir_.path().Append(FILE_PATH_LITERAL("create_directory_test")); 1707 temp_dir_.path().Append(FILE_PATH_LITERAL("create_directory_test"));
1697 #if defined(OS_WIN) 1708 #if defined(OS_WIN)
1698 FilePath test_path = 1709 FilePath test_path =
1699 test_root.Append(FILE_PATH_LITERAL("dir\\tree\\likely\\doesnt\\exist\\")); 1710 test_root.Append(FILE_PATH_LITERAL("dir\\tree\\likely\\doesnt\\exist\\"));
1700 #elif defined(OS_POSIX) 1711 #elif defined(OS_POSIX)
1701 FilePath test_path = 1712 FilePath test_path =
1702 test_root.Append(FILE_PATH_LITERAL("dir/tree/likely/doesnt/exist/")); 1713 test_root.Append(FILE_PATH_LITERAL("dir/tree/likely/doesnt/exist/"));
1703 #endif 1714 #endif
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
2448 int fd = OpenContentUriForRead(path); 2459 int fd = OpenContentUriForRead(path);
2449 EXPECT_EQ(-1, fd); 2460 EXPECT_EQ(-1, fd);
2450 } 2461 }
2451 #endif 2462 #endif
2452 2463
2453 #endif // defined(OS_POSIX) 2464 #endif // defined(OS_POSIX)
2454 2465
2455 } // namespace 2466 } // namespace
2456 2467
2457 } // namespace base 2468 } // namespace base
OLDNEW
« no previous file with comments | « base/file_util_posix.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698