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

Side by Side Diff: chrome/common/chrome_paths_unittest.cc

Issue 93263002: Move some more file utils to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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 "chrome/common/chrome_paths_internal.h" 5 #include "chrome/common/chrome_paths_internal.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 11 matching lines...) Expand all
22 base::FilePath expected_cache_dir; 22 base::FilePath expected_cache_dir;
23 ASSERT_TRUE(PathService::Get(base::DIR_CACHE, &expected_cache_dir)); 23 ASSERT_TRUE(PathService::Get(base::DIR_CACHE, &expected_cache_dir));
24 expected_cache_dir = expected_cache_dir.Append("foobar"); 24 expected_cache_dir = expected_cache_dir.Append("foobar");
25 #elif(OS_ANDROID) 25 #elif(OS_ANDROID)
26 // No matter what the test_profile_dir is, Android always use the 26 // No matter what the test_profile_dir is, Android always use the
27 // application's cache directory since multiple profiles are not 27 // application's cache directory since multiple profiles are not
28 // supported. 28 // supported.
29 base::FilePath expected_cache_dir; 29 base::FilePath expected_cache_dir;
30 ASSERT_TRUE(PathService::Get(base::DIR_CACHE, &expected_cache_dir)); 30 ASSERT_TRUE(PathService::Get(base::DIR_CACHE, &expected_cache_dir));
31 #elif(OS_POSIX) 31 #elif(OS_POSIX)
32 base::FilePath homedir = file_util::GetHomeDir(); 32 base::FilePath homedir = base::GetHomeDir();
33 // Note: we assume XDG_CACHE_HOME/XDG_CONFIG_HOME are at their 33 // Note: we assume XDG_CACHE_HOME/XDG_CONFIG_HOME are at their
34 // default settings. 34 // default settings.
35 test_profile_dir = homedir.Append(".config/foobar"); 35 test_profile_dir = homedir.Append(".config/foobar");
36 base::FilePath expected_cache_dir = homedir.Append(".cache/foobar"); 36 base::FilePath expected_cache_dir = homedir.Append(".cache/foobar");
37 #endif 37 #endif
38 38
39 // Verify that a profile in the special platform-specific source 39 // Verify that a profile in the special platform-specific source
40 // location ends up in the special target location. 40 // location ends up in the special target location.
41 #if !defined(OS_WIN) // No special behavior on Windows. 41 #if !defined(OS_WIN) // No special behavior on Windows.
42 chrome::GetUserCacheDirectory(test_profile_dir, &cache_dir); 42 chrome::GetUserCacheDirectory(test_profile_dir, &cache_dir);
43 EXPECT_EQ(expected_cache_dir.value(), cache_dir.value()); 43 EXPECT_EQ(expected_cache_dir.value(), cache_dir.value());
44 #endif 44 #endif
45 45
46 // Verify that a profile in some other random directory doesn't use 46 // Verify that a profile in some other random directory doesn't use
47 // the special cache dir. 47 // the special cache dir.
48 test_profile_dir = base::FilePath(FILE_PATH_LITERAL("/some/other/path")); 48 test_profile_dir = base::FilePath(FILE_PATH_LITERAL("/some/other/path"));
49 chrome::GetUserCacheDirectory(test_profile_dir, &cache_dir); 49 chrome::GetUserCacheDirectory(test_profile_dir, &cache_dir);
50 #if defined(OS_ANDROID) 50 #if defined(OS_ANDROID)
51 EXPECT_EQ(expected_cache_dir.value(), cache_dir.value()); 51 EXPECT_EQ(expected_cache_dir.value(), cache_dir.value());
52 #else 52 #else
53 EXPECT_EQ(test_profile_dir.value(), cache_dir.value()); 53 EXPECT_EQ(test_profile_dir.value(), cache_dir.value());
54 #endif 54 #endif
55 } 55 }
OLDNEW
« no previous file with comments | « chrome/common/chrome_paths_linux.cc ('k') | chrome/common/importer/firefox_importer_utils_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698