This source file includes following definitions.
- TEST
#include "chrome/common/chrome_paths_internal.h"
#include <stdlib.h>
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "chrome/common/chrome_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(ChromePaths, UserCacheDir) {
base::FilePath test_profile_dir, cache_dir;
#if defined(OS_MACOSX)
ASSERT_TRUE(PathService::Get(base::DIR_APP_DATA, &test_profile_dir));
test_profile_dir = test_profile_dir.Append("foobar");
base::FilePath expected_cache_dir;
ASSERT_TRUE(PathService::Get(base::DIR_CACHE, &expected_cache_dir));
expected_cache_dir = expected_cache_dir.Append("foobar");
#elif(OS_ANDROID)
base::FilePath expected_cache_dir;
ASSERT_TRUE(PathService::Get(base::DIR_CACHE, &expected_cache_dir));
#elif(OS_POSIX)
base::FilePath homedir = base::GetHomeDir();
test_profile_dir = homedir.Append(".config/foobar");
base::FilePath expected_cache_dir = homedir.Append(".cache/foobar");
#endif
#if !defined(OS_WIN)
chrome::GetUserCacheDirectory(test_profile_dir, &cache_dir);
EXPECT_EQ(expected_cache_dir.value(), cache_dir.value());
#endif
test_profile_dir = base::FilePath(FILE_PATH_LITERAL("/some/other/path"));
chrome::GetUserCacheDirectory(test_profile_dir, &cache_dir);
#if defined(OS_ANDROID)
EXPECT_EQ(expected_cache_dir.value(), cache_dir.value());
#else
EXPECT_EQ(test_profile_dir.value(), cache_dir.value());
#endif
}