| OLD | NEW |
| 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_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 #if defined(OS_WIN) |
| 16 #include "base/base_paths_win.h" |
| 17 #elif defined(OS_MACOSX) |
| 18 #include "base/base_paths_mac.h" |
| 19 #endif |
| 20 |
| 21 #if defined(OS_POSIX) |
| 22 #include "base/base_paths_posix.h" |
| 23 #endif |
| 24 |
| 15 // Test the behavior of chrome::GetUserCacheDirectory. | 25 // Test the behavior of chrome::GetUserCacheDirectory. |
| 16 // See that function's comments for discussion of the subtleties. | 26 // See that function's comments for discussion of the subtleties. |
| 17 TEST(ChromePaths, UserCacheDir) { | 27 TEST(ChromePaths, UserCacheDir) { |
| 18 FilePath test_profile_dir, cache_dir; | 28 FilePath test_profile_dir, cache_dir; |
| 19 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
| 20 ASSERT_TRUE(PathService::Get(base::DIR_APP_DATA, &test_profile_dir)); | 30 ASSERT_TRUE(PathService::Get(base::DIR_APP_DATA, &test_profile_dir)); |
| 21 test_profile_dir = test_profile_dir.Append("foobar"); | 31 test_profile_dir = test_profile_dir.Append("foobar"); |
| 22 FilePath expected_cache_dir; | 32 FilePath expected_cache_dir; |
| 23 ASSERT_TRUE(PathService::Get(base::DIR_CACHE, &expected_cache_dir)); | 33 ASSERT_TRUE(PathService::Get(base::DIR_CACHE, &expected_cache_dir)); |
| 24 expected_cache_dir = expected_cache_dir.Append("foobar"); | 34 expected_cache_dir = expected_cache_dir.Append("foobar"); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 55 EXPECT_TRUE(PathService::Get(chrome::DIR_ALT_USER_DATA, alternate_dir)); | 65 EXPECT_TRUE(PathService::Get(chrome::DIR_ALT_USER_DATA, alternate_dir)); |
| 56 | 66 |
| 57 // And that it's not the same as the current dir. | 67 // And that it's not the same as the current dir. |
| 58 EXPECTE_NE(current_dir.value(), alternate_dir.value()); | 68 EXPECTE_NE(current_dir.value(), alternate_dir.value()); |
| 59 | 69 |
| 60 // And that it's the metro dir. | 70 // And that it's the metro dir. |
| 61 EXPECT_EQ(FilePath::StringType(kMetroChromeUserDataSubDir), | 71 EXPECT_EQ(FilePath::StringType(kMetroChromeUserDataSubDir), |
| 62 alternate_dir.DirName().BaseName().value()); | 72 alternate_dir.DirName().BaseName().value()); |
| 63 } | 73 } |
| 64 #endif | 74 #endif |
| OLD | NEW |