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" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "testing/gtest/include/gtest/gtest-spi.h" | 13 #include "testing/gtest/include/gtest/gtest-spi.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
16 | 16 |
17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
18 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
19 #endif | 19 #endif |
20 | 20 |
| 21 namespace base { |
| 22 |
21 namespace { | 23 namespace { |
22 | 24 |
23 // Returns true if PathService::Get returns true and sets the path parameter | 25 // Returns true if PathService::Get returns true and sets the path parameter |
24 // to non-empty for the given PathService::DirType enumeration value. | 26 // to non-empty for the given PathService::DirType enumeration value. |
25 bool ReturnsValidPath(int dir_type) { | 27 bool ReturnsValidPath(int dir_type) { |
26 base::FilePath path; | 28 FilePath path; |
27 bool result = PathService::Get(dir_type, &path); | 29 bool result = PathService::Get(dir_type, &path); |
28 | 30 |
29 // Some paths might not exist on some platforms in which case confirming | 31 // Some paths might not exist on some platforms in which case confirming |
30 // |result| is true and !path.empty() is the best we can do. | 32 // |result| is true and !path.empty() is the best we can do. |
31 bool check_path_exists = true; | 33 bool check_path_exists = true; |
32 #if defined(OS_POSIX) | 34 #if defined(OS_POSIX) |
33 // If chromium has never been started on this account, the cache path may not | 35 // If chromium has never been started on this account, the cache path may not |
34 // exist. | 36 // exist. |
35 if (dir_type == base::DIR_CACHE) | 37 if (dir_type == DIR_CACHE) |
36 check_path_exists = false; | 38 check_path_exists = false; |
37 #endif | 39 #endif |
38 #if defined(OS_LINUX) | 40 #if defined(OS_LINUX) |
39 // On the linux try-bots: a path is returned (e.g. /home/chrome-bot/Desktop), | 41 // On the linux try-bots: a path is returned (e.g. /home/chrome-bot/Desktop), |
40 // but it doesn't exist. | 42 // but it doesn't exist. |
41 if (dir_type == base::DIR_USER_DESKTOP) | 43 if (dir_type == DIR_USER_DESKTOP) |
42 check_path_exists = false; | 44 check_path_exists = false; |
43 #endif | 45 #endif |
44 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
45 if (dir_type == base::DIR_TASKBAR_PINS) { | 47 if (dir_type == DIR_TASKBAR_PINS) { |
46 // There is no pinned-to-taskbar shortcuts prior to Win7. | 48 // There is no pinned-to-taskbar shortcuts prior to Win7. |
47 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 49 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
48 check_path_exists = false; | 50 check_path_exists = false; |
49 } | 51 } |
50 #endif | 52 #endif |
51 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) |
52 if (dir_type != base::DIR_EXE && dir_type != base::DIR_MODULE && | 54 if (dir_type != DIR_EXE && dir_type != DIR_MODULE && |
53 dir_type != base::FILE_EXE && dir_type != base::FILE_MODULE) { | 55 dir_type != FILE_EXE && dir_type != FILE_MODULE) { |
54 if (path.ReferencesParent()) | 56 if (path.ReferencesParent()) |
55 return false; | 57 return false; |
56 } | 58 } |
57 #else | 59 #else |
58 if (path.ReferencesParent()) | 60 if (path.ReferencesParent()) |
59 return false; | 61 return false; |
60 #endif | 62 #endif |
61 return result && !path.empty() && (!check_path_exists || | 63 return result && !path.empty() && (!check_path_exists || PathExists(path)); |
62 base::PathExists(path)); | |
63 } | 64 } |
64 | 65 |
65 #if defined(OS_WIN) | 66 #if defined(OS_WIN) |
66 // Function to test any directory keys that are not supported on some versions | 67 // Function to test any directory keys that are not supported on some versions |
67 // of Windows. Checks that the function fails and that the returned path is | 68 // of Windows. Checks that the function fails and that the returned path is |
68 // empty. | 69 // empty. |
69 bool ReturnsInvalidPath(int dir_type) { | 70 bool ReturnsInvalidPath(int dir_type) { |
70 base::FilePath path; | 71 FilePath path; |
71 bool result = PathService::Get(dir_type, &path); | 72 bool result = PathService::Get(dir_type, &path); |
72 return !result && path.empty(); | 73 return !result && path.empty(); |
73 } | 74 } |
74 #endif | 75 #endif |
75 | 76 |
76 } // namespace | 77 } // namespace |
77 | 78 |
78 // On the Mac this winds up using some autoreleased objects, so we need to | 79 // On the Mac this winds up using some autoreleased objects, so we need to |
79 // be a PlatformTest. | 80 // be a PlatformTest. |
80 typedef PlatformTest PathServiceTest; | 81 typedef PlatformTest PathServiceTest; |
81 | 82 |
82 // Test that all PathService::Get calls return a value and a true result | 83 // Test that all PathService::Get calls return a value and a true result |
83 // in the development environment. (This test was created because a few | 84 // in the development environment. (This test was created because a few |
84 // later changes to Get broke the semantics of the function and yielded the | 85 // later changes to Get broke the semantics of the function and yielded the |
85 // correct value while returning false.) | 86 // correct value while returning false.) |
86 TEST_F(PathServiceTest, Get) { | 87 TEST_F(PathServiceTest, Get) { |
87 for (int key = base::PATH_START + 1; key < base::PATH_END; ++key) { | 88 for (int key = PATH_START + 1; key < PATH_END; ++key) { |
88 #if defined(OS_ANDROID) | 89 #if defined(OS_ANDROID) |
89 if (key == base::FILE_MODULE || key == base::DIR_USER_DESKTOP || | 90 if (key == FILE_MODULE || key == DIR_USER_DESKTOP || |
90 key == base::DIR_HOME) | 91 key == DIR_HOME) |
91 continue; // Android doesn't implement these. | 92 continue; // Android doesn't implement these. |
92 #elif defined(OS_IOS) | 93 #elif defined(OS_IOS) |
93 if (key == base::DIR_USER_DESKTOP) | 94 if (key == DIR_USER_DESKTOP) |
94 continue; // iOS doesn't implement DIR_USER_DESKTOP; | 95 continue; // iOS doesn't implement DIR_USER_DESKTOP; |
95 #endif | 96 #endif |
96 EXPECT_PRED1(ReturnsValidPath, key); | 97 EXPECT_PRED1(ReturnsValidPath, key); |
97 } | 98 } |
98 #if defined(OS_WIN) | 99 #if defined(OS_WIN) |
99 for (int key = base::PATH_WIN_START + 1; key < base::PATH_WIN_END; ++key) { | 100 for (int key = PATH_WIN_START + 1; key < PATH_WIN_END; ++key) { |
100 bool valid = true; | 101 bool valid = true; |
101 if (key == base::DIR_APP_SHORTCUTS) | 102 if (key == DIR_APP_SHORTCUTS) |
102 valid = base::win::GetVersion() >= base::win::VERSION_WIN8; | 103 valid = base::win::GetVersion() >= base::win::VERSION_WIN8; |
103 | 104 |
104 if (valid) | 105 if (valid) |
105 EXPECT_TRUE(ReturnsValidPath(key)) << key; | 106 EXPECT_TRUE(ReturnsValidPath(key)) << key; |
106 else | 107 else |
107 EXPECT_TRUE(ReturnsInvalidPath(key)) << key; | 108 EXPECT_TRUE(ReturnsInvalidPath(key)) << key; |
108 } | 109 } |
109 #elif defined(OS_MACOSX) | 110 #elif defined(OS_MACOSX) |
110 for (int key = base::PATH_MAC_START + 1; key < base::PATH_MAC_END; ++key) { | 111 for (int key = PATH_MAC_START + 1; key < PATH_MAC_END; ++key) { |
111 EXPECT_PRED1(ReturnsValidPath, key); | 112 EXPECT_PRED1(ReturnsValidPath, key); |
112 } | 113 } |
113 #elif defined(OS_ANDROID) | 114 #elif defined(OS_ANDROID) |
114 for (int key = base::PATH_ANDROID_START + 1; key < base::PATH_ANDROID_END; | 115 for (int key = PATH_ANDROID_START + 1; key < PATH_ANDROID_END; |
115 ++key) { | 116 ++key) { |
116 EXPECT_PRED1(ReturnsValidPath, key); | 117 EXPECT_PRED1(ReturnsValidPath, key); |
117 } | 118 } |
118 #elif defined(OS_POSIX) | 119 #elif defined(OS_POSIX) |
119 for (int key = base::PATH_POSIX_START + 1; key < base::PATH_POSIX_END; | 120 for (int key = PATH_POSIX_START + 1; key < PATH_POSIX_END; |
120 ++key) { | 121 ++key) { |
121 EXPECT_PRED1(ReturnsValidPath, key); | 122 EXPECT_PRED1(ReturnsValidPath, key); |
122 } | 123 } |
123 #endif | 124 #endif |
124 } | 125 } |
125 | 126 |
126 // Test that all versions of the Override function of PathService do what they | 127 // Test that all versions of the Override function of PathService do what they |
127 // are supposed to do. | 128 // are supposed to do. |
128 TEST_F(PathServiceTest, Override) { | 129 TEST_F(PathServiceTest, Override) { |
129 int my_special_key = 666; | 130 int my_special_key = 666; |
130 base::ScopedTempDir temp_dir; | 131 ScopedTempDir temp_dir; |
131 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 132 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
132 base::FilePath fake_cache_dir(temp_dir.path().AppendASCII("cache")); | 133 FilePath fake_cache_dir(temp_dir.path().AppendASCII("cache")); |
133 // PathService::Override should always create the path provided if it doesn't | 134 // PathService::Override should always create the path provided if it doesn't |
134 // exist. | 135 // exist. |
135 EXPECT_TRUE(PathService::Override(my_special_key, fake_cache_dir)); | 136 EXPECT_TRUE(PathService::Override(my_special_key, fake_cache_dir)); |
136 EXPECT_TRUE(base::PathExists(fake_cache_dir)); | 137 EXPECT_TRUE(PathExists(fake_cache_dir)); |
137 | 138 |
138 base::FilePath fake_cache_dir2(temp_dir.path().AppendASCII("cache2")); | 139 FilePath fake_cache_dir2(temp_dir.path().AppendASCII("cache2")); |
139 // PathService::OverrideAndCreateIfNeeded should obey the |create| parameter. | 140 // PathService::OverrideAndCreateIfNeeded should obey the |create| parameter. |
140 PathService::OverrideAndCreateIfNeeded(my_special_key, | 141 PathService::OverrideAndCreateIfNeeded(my_special_key, |
141 fake_cache_dir2, | 142 fake_cache_dir2, |
142 false, | 143 false, |
143 false); | 144 false); |
144 EXPECT_FALSE(base::PathExists(fake_cache_dir2)); | 145 EXPECT_FALSE(PathExists(fake_cache_dir2)); |
145 EXPECT_TRUE(PathService::OverrideAndCreateIfNeeded(my_special_key, | 146 EXPECT_TRUE(PathService::OverrideAndCreateIfNeeded(my_special_key, |
146 fake_cache_dir2, | 147 fake_cache_dir2, |
147 false, | 148 false, |
148 true)); | 149 true)); |
149 EXPECT_TRUE(base::PathExists(fake_cache_dir2)); | 150 EXPECT_TRUE(PathExists(fake_cache_dir2)); |
150 | 151 |
151 #if defined(OS_POSIX) | 152 #if defined(OS_POSIX) |
152 base::FilePath non_existent( | 153 FilePath non_existent( |
153 base::MakeAbsoluteFilePath(temp_dir.path()).AppendASCII("non_existent")); | 154 MakeAbsoluteFilePath(temp_dir.path()).AppendASCII("non_existent")); |
154 EXPECT_TRUE(non_existent.IsAbsolute()); | 155 EXPECT_TRUE(non_existent.IsAbsolute()); |
155 EXPECT_FALSE(base::PathExists(non_existent)); | 156 EXPECT_FALSE(PathExists(non_existent)); |
156 #if !defined(OS_ANDROID) | 157 #if !defined(OS_ANDROID) |
157 // This fails because MakeAbsoluteFilePath fails for non-existent files. | 158 // This fails because MakeAbsoluteFilePath fails for non-existent files. |
158 // Earlier versions of Bionic libc don't fail for non-existent files, so | 159 // Earlier versions of Bionic libc don't fail for non-existent files, so |
159 // skip this check on Android. | 160 // skip this check on Android. |
160 EXPECT_FALSE(PathService::OverrideAndCreateIfNeeded(my_special_key, | 161 EXPECT_FALSE(PathService::OverrideAndCreateIfNeeded(my_special_key, |
161 non_existent, | 162 non_existent, |
162 false, | 163 false, |
163 false)); | 164 false)); |
164 #endif | 165 #endif |
165 // This works because indicating that |non_existent| is absolute skips the | 166 // This works because indicating that |non_existent| is absolute skips the |
166 // internal MakeAbsoluteFilePath call. | 167 // internal MakeAbsoluteFilePath call. |
167 EXPECT_TRUE(PathService::OverrideAndCreateIfNeeded(my_special_key, | 168 EXPECT_TRUE(PathService::OverrideAndCreateIfNeeded(my_special_key, |
168 non_existent, | 169 non_existent, |
169 true, | 170 true, |
170 false)); | 171 false)); |
171 // Check that the path has been overridden and no directory was created. | 172 // Check that the path has been overridden and no directory was created. |
172 EXPECT_FALSE(base::PathExists(non_existent)); | 173 EXPECT_FALSE(PathExists(non_existent)); |
173 base::FilePath path; | 174 FilePath path; |
174 EXPECT_TRUE(PathService::Get(my_special_key, &path)); | 175 EXPECT_TRUE(PathService::Get(my_special_key, &path)); |
175 EXPECT_EQ(non_existent, path); | 176 EXPECT_EQ(non_existent, path); |
176 #endif | 177 #endif |
177 } | 178 } |
178 | 179 |
179 // Check if multiple overrides can co-exist. | 180 // Check if multiple overrides can co-exist. |
180 TEST_F(PathServiceTest, OverrideMultiple) { | 181 TEST_F(PathServiceTest, OverrideMultiple) { |
181 int my_special_key = 666; | 182 int my_special_key = 666; |
182 base::ScopedTempDir temp_dir; | 183 ScopedTempDir temp_dir; |
183 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 184 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
184 base::FilePath fake_cache_dir1(temp_dir.path().AppendASCII("1")); | 185 FilePath fake_cache_dir1(temp_dir.path().AppendASCII("1")); |
185 EXPECT_TRUE(PathService::Override(my_special_key, fake_cache_dir1)); | 186 EXPECT_TRUE(PathService::Override(my_special_key, fake_cache_dir1)); |
186 EXPECT_TRUE(base::PathExists(fake_cache_dir1)); | 187 EXPECT_TRUE(PathExists(fake_cache_dir1)); |
187 ASSERT_EQ(1, base::WriteFile(fake_cache_dir1.AppendASCII("t1"), ".", 1)); | 188 ASSERT_EQ(1, WriteFile(fake_cache_dir1.AppendASCII("t1"), ".", 1)); |
188 | 189 |
189 base::FilePath fake_cache_dir2(temp_dir.path().AppendASCII("2")); | 190 FilePath fake_cache_dir2(temp_dir.path().AppendASCII("2")); |
190 EXPECT_TRUE(PathService::Override(my_special_key + 1, fake_cache_dir2)); | 191 EXPECT_TRUE(PathService::Override(my_special_key + 1, fake_cache_dir2)); |
191 EXPECT_TRUE(base::PathExists(fake_cache_dir2)); | 192 EXPECT_TRUE(PathExists(fake_cache_dir2)); |
192 ASSERT_EQ(1, base::WriteFile(fake_cache_dir2.AppendASCII("t2"), ".", 1)); | 193 ASSERT_EQ(1, WriteFile(fake_cache_dir2.AppendASCII("t2"), ".", 1)); |
193 | 194 |
194 base::FilePath result; | 195 FilePath result; |
195 EXPECT_TRUE(PathService::Get(my_special_key, &result)); | 196 EXPECT_TRUE(PathService::Get(my_special_key, &result)); |
196 // Override might have changed the path representation but our test file | 197 // Override might have changed the path representation but our test file |
197 // should be still there. | 198 // should be still there. |
198 EXPECT_TRUE(base::PathExists(result.AppendASCII("t1"))); | 199 EXPECT_TRUE(PathExists(result.AppendASCII("t1"))); |
199 EXPECT_TRUE(PathService::Get(my_special_key + 1, &result)); | 200 EXPECT_TRUE(PathService::Get(my_special_key + 1, &result)); |
200 EXPECT_TRUE(base::PathExists(result.AppendASCII("t2"))); | 201 EXPECT_TRUE(PathExists(result.AppendASCII("t2"))); |
201 } | 202 } |
202 | 203 |
203 TEST_F(PathServiceTest, RemoveOverride) { | 204 TEST_F(PathServiceTest, RemoveOverride) { |
204 // Before we start the test we have to call RemoveOverride at least once to | 205 // Before we start the test we have to call RemoveOverride at least once to |
205 // clear any overrides that might have been left from other tests. | 206 // clear any overrides that might have been left from other tests. |
206 PathService::RemoveOverride(base::DIR_TEMP); | 207 PathService::RemoveOverride(DIR_TEMP); |
207 | 208 |
208 base::FilePath original_user_data_dir; | 209 FilePath original_user_data_dir; |
209 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &original_user_data_dir)); | 210 EXPECT_TRUE(PathService::Get(DIR_TEMP, &original_user_data_dir)); |
210 EXPECT_FALSE(PathService::RemoveOverride(base::DIR_TEMP)); | 211 EXPECT_FALSE(PathService::RemoveOverride(DIR_TEMP)); |
211 | 212 |
212 base::ScopedTempDir temp_dir; | 213 ScopedTempDir temp_dir; |
213 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 214 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
214 EXPECT_TRUE(PathService::Override(base::DIR_TEMP, temp_dir.path())); | 215 EXPECT_TRUE(PathService::Override(DIR_TEMP, temp_dir.path())); |
215 base::FilePath new_user_data_dir; | 216 FilePath new_user_data_dir; |
216 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); | 217 EXPECT_TRUE(PathService::Get(DIR_TEMP, &new_user_data_dir)); |
217 EXPECT_NE(original_user_data_dir, new_user_data_dir); | 218 EXPECT_NE(original_user_data_dir, new_user_data_dir); |
218 | 219 |
219 EXPECT_TRUE(PathService::RemoveOverride(base::DIR_TEMP)); | 220 EXPECT_TRUE(PathService::RemoveOverride(DIR_TEMP)); |
220 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); | 221 EXPECT_TRUE(PathService::Get(DIR_TEMP, &new_user_data_dir)); |
221 EXPECT_EQ(original_user_data_dir, new_user_data_dir); | 222 EXPECT_EQ(original_user_data_dir, new_user_data_dir); |
222 } | 223 } |
223 | 224 |
224 #if defined(OS_WIN) | 225 #if defined(OS_WIN) |
225 TEST_F(PathServiceTest, GetProgramFiles) { | 226 TEST_F(PathServiceTest, GetProgramFiles) { |
226 base::FilePath programfiles_dir; | 227 FilePath programfiles_dir; |
227 #if defined(_WIN64) | 228 #if defined(_WIN64) |
228 // 64-bit on 64-bit. | 229 // 64-bit on 64-bit. |
229 EXPECT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES, | 230 EXPECT_TRUE(PathService::Get(DIR_PROGRAM_FILES, |
230 &programfiles_dir)); | 231 &programfiles_dir)); |
231 EXPECT_EQ(programfiles_dir.value(), | 232 EXPECT_EQ(programfiles_dir.value(), |
232 FILE_PATH_LITERAL("C:\\Program Files")); | 233 FILE_PATH_LITERAL("C:\\Program Files")); |
233 EXPECT_TRUE(PathService::Get(base::DIR_PROGRAM_FILESX86, | 234 EXPECT_TRUE(PathService::Get(DIR_PROGRAM_FILESX86, |
234 &programfiles_dir)); | 235 &programfiles_dir)); |
235 EXPECT_EQ(programfiles_dir.value(), | 236 EXPECT_EQ(programfiles_dir.value(), |
236 FILE_PATH_LITERAL("C:\\Program Files (x86)")); | 237 FILE_PATH_LITERAL("C:\\Program Files (x86)")); |
237 EXPECT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES6432, | 238 EXPECT_TRUE(PathService::Get(DIR_PROGRAM_FILES6432, |
238 &programfiles_dir)); | 239 &programfiles_dir)); |
239 EXPECT_EQ(programfiles_dir.value(), | 240 EXPECT_EQ(programfiles_dir.value(), |
240 FILE_PATH_LITERAL("C:\\Program Files")); | 241 FILE_PATH_LITERAL("C:\\Program Files")); |
241 #else | 242 #else |
242 if (base::win::OSInfo::GetInstance()->wow64_status() == | 243 if (base::win::OSInfo::GetInstance()->wow64_status() == |
243 base::win::OSInfo::WOW64_ENABLED) { | 244 base::win::OSInfo::WOW64_ENABLED) { |
244 // 32-bit on 64-bit. | 245 // 32-bit on 64-bit. |
245 EXPECT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES, | 246 EXPECT_TRUE(PathService::Get(DIR_PROGRAM_FILES, |
246 &programfiles_dir)); | 247 &programfiles_dir)); |
247 EXPECT_EQ(programfiles_dir.value(), | 248 EXPECT_EQ(programfiles_dir.value(), |
248 FILE_PATH_LITERAL("C:\\Program Files (x86)")); | 249 FILE_PATH_LITERAL("C:\\Program Files (x86)")); |
249 EXPECT_TRUE(PathService::Get(base::DIR_PROGRAM_FILESX86, | 250 EXPECT_TRUE(PathService::Get(DIR_PROGRAM_FILESX86, |
250 &programfiles_dir)); | 251 &programfiles_dir)); |
251 EXPECT_EQ(programfiles_dir.value(), | 252 EXPECT_EQ(programfiles_dir.value(), |
252 FILE_PATH_LITERAL("C:\\Program Files (x86)")); | 253 FILE_PATH_LITERAL("C:\\Program Files (x86)")); |
253 EXPECT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES6432, | 254 EXPECT_TRUE(PathService::Get(DIR_PROGRAM_FILES6432, |
254 &programfiles_dir)); | 255 &programfiles_dir)); |
255 EXPECT_EQ(programfiles_dir.value(), | 256 EXPECT_EQ(programfiles_dir.value(), |
256 FILE_PATH_LITERAL("C:\\Program Files")); | 257 FILE_PATH_LITERAL("C:\\Program Files")); |
257 } else { | 258 } else { |
258 // 32-bit on 32-bit. | 259 // 32-bit on 32-bit. |
259 EXPECT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES, | 260 EXPECT_TRUE(PathService::Get(DIR_PROGRAM_FILES, |
260 &programfiles_dir)); | 261 &programfiles_dir)); |
261 EXPECT_EQ(programfiles_dir.value(), | 262 EXPECT_EQ(programfiles_dir.value(), |
262 FILE_PATH_LITERAL("C:\\Program Files")); | 263 FILE_PATH_LITERAL("C:\\Program Files")); |
263 EXPECT_TRUE(PathService::Get(base::DIR_PROGRAM_FILESX86, | 264 EXPECT_TRUE(PathService::Get(DIR_PROGRAM_FILESX86, |
264 &programfiles_dir)); | 265 &programfiles_dir)); |
265 EXPECT_EQ(programfiles_dir.value(), | 266 EXPECT_EQ(programfiles_dir.value(), |
266 FILE_PATH_LITERAL("C:\\Program Files")); | 267 FILE_PATH_LITERAL("C:\\Program Files")); |
267 EXPECT_TRUE(PathService::Get(base::DIR_PROGRAM_FILES6432, | 268 EXPECT_TRUE(PathService::Get(DIR_PROGRAM_FILES6432, |
268 &programfiles_dir)); | 269 &programfiles_dir)); |
269 EXPECT_EQ(programfiles_dir.value(), | 270 EXPECT_EQ(programfiles_dir.value(), |
270 FILE_PATH_LITERAL("C:\\Program Files")); | 271 FILE_PATH_LITERAL("C:\\Program Files")); |
271 } | 272 } |
272 #endif | 273 #endif |
273 } | 274 } |
274 #endif | 275 #endif |
| 276 |
| 277 } // namespace base |
OLD | NEW |