| 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 "base/path_service.h" | 5 #include "base/path_service.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 continue; // Android doesn't implement these. | 91 continue; // Android doesn't implement these. |
| 92 #elif defined(OS_IOS) | 92 #elif defined(OS_IOS) |
| 93 if (key == base::DIR_USER_DESKTOP) | 93 if (key == base::DIR_USER_DESKTOP) |
| 94 continue; // iOS doesn't implement DIR_USER_DESKTOP; | 94 continue; // iOS doesn't implement DIR_USER_DESKTOP; |
| 95 #endif | 95 #endif |
| 96 EXPECT_PRED1(ReturnsValidPath, key); | 96 EXPECT_PRED1(ReturnsValidPath, key); |
| 97 } | 97 } |
| 98 #if defined(OS_WIN) | 98 #if defined(OS_WIN) |
| 99 for (int key = base::PATH_WIN_START + 1; key < base::PATH_WIN_END; ++key) { | 99 for (int key = base::PATH_WIN_START + 1; key < base::PATH_WIN_END; ++key) { |
| 100 bool valid = true; | 100 bool valid = true; |
| 101 switch(key) { | 101 if (key == base::DIR_APP_SHORTCUTS) |
| 102 case base::DIR_LOCAL_APP_DATA_LOW: | 102 valid = base::win::GetVersion() >= base::win::VERSION_WIN8; |
| 103 // DIR_LOCAL_APP_DATA_LOW is not supported prior Vista and is expected | |
| 104 // to fail. | |
| 105 valid = base::win::GetVersion() >= base::win::VERSION_VISTA; | |
| 106 break; | |
| 107 case base::DIR_APP_SHORTCUTS: | |
| 108 // DIR_APP_SHORTCUTS is not supported prior Windows 8 and is expected to | |
| 109 // fail. | |
| 110 valid = base::win::GetVersion() >= base::win::VERSION_WIN8; | |
| 111 break; | |
| 112 } | |
| 113 | 103 |
| 114 if (valid) | 104 if (valid) |
| 115 EXPECT_TRUE(ReturnsValidPath(key)) << key; | 105 EXPECT_TRUE(ReturnsValidPath(key)) << key; |
| 116 else | 106 else |
| 117 EXPECT_TRUE(ReturnsInvalidPath(key)) << key; | 107 EXPECT_TRUE(ReturnsInvalidPath(key)) << key; |
| 118 } | 108 } |
| 119 #elif defined(OS_MACOSX) | 109 #elif defined(OS_MACOSX) |
| 120 for (int key = base::PATH_MAC_START + 1; key < base::PATH_MAC_END; ++key) { | 110 for (int key = base::PATH_MAC_START + 1; key < base::PATH_MAC_END; ++key) { |
| 121 EXPECT_PRED1(ReturnsValidPath, key); | 111 EXPECT_PRED1(ReturnsValidPath, key); |
| 122 } | 112 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 213 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 224 EXPECT_TRUE(PathService::Override(base::DIR_TEMP, temp_dir.path())); | 214 EXPECT_TRUE(PathService::Override(base::DIR_TEMP, temp_dir.path())); |
| 225 base::FilePath new_user_data_dir; | 215 base::FilePath new_user_data_dir; |
| 226 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); | 216 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); |
| 227 EXPECT_NE(original_user_data_dir, new_user_data_dir); | 217 EXPECT_NE(original_user_data_dir, new_user_data_dir); |
| 228 | 218 |
| 229 EXPECT_TRUE(PathService::RemoveOverride(base::DIR_TEMP)); | 219 EXPECT_TRUE(PathService::RemoveOverride(base::DIR_TEMP)); |
| 230 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); | 220 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); |
| 231 EXPECT_EQ(original_user_data_dir, new_user_data_dir); | 221 EXPECT_EQ(original_user_data_dir, new_user_data_dir); |
| 232 } | 222 } |
| OLD | NEW |