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

Side by Side Diff: base/path_service_unittest.cc

Issue 159833003: Add support for GetHomeDir for Mac and Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 10 months 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
« no previous file with comments | « base/file_util_win.cc ('k') | chrome/browser/extensions/api/file_system/file_system_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // be a PlatformTest. 93 // be a PlatformTest.
94 typedef PlatformTest PathServiceTest; 94 typedef PlatformTest PathServiceTest;
95 95
96 // Test that all PathService::Get calls return a value and a true result 96 // Test that all PathService::Get calls return a value and a true result
97 // in the development environment. (This test was created because a few 97 // in the development environment. (This test was created because a few
98 // later changes to Get broke the semantics of the function and yielded the 98 // later changes to Get broke the semantics of the function and yielded the
99 // correct value while returning false.) 99 // correct value while returning false.)
100 TEST_F(PathServiceTest, Get) { 100 TEST_F(PathServiceTest, Get) {
101 for (int key = base::PATH_START + 1; key < base::PATH_END; ++key) { 101 for (int key = base::PATH_START + 1; key < base::PATH_END; ++key) {
102 #if defined(OS_ANDROID) 102 #if defined(OS_ANDROID)
103 if (key == base::FILE_MODULE || key == base::DIR_USER_DESKTOP) 103 if (key == base::FILE_MODULE || key == base::DIR_USER_DESKTOP ||
104 continue; // Android doesn't implement FILE_MODULE and DIR_USER_DESKTOP; 104 key == base::DIR_HOME)
105 continue; // Android doesn't implement these.
105 #elif defined(OS_IOS) 106 #elif defined(OS_IOS)
106 if (key == base::DIR_USER_DESKTOP) 107 if (key == base::DIR_USER_DESKTOP)
107 continue; // iOS doesn't implement DIR_USER_DESKTOP; 108 continue; // iOS doesn't implement DIR_USER_DESKTOP;
108 #endif 109 #endif
109 EXPECT_PRED1(ReturnsValidPath, key); 110 EXPECT_PRED1(ReturnsValidPath, key);
110 } 111 }
111 #if defined(OS_WIN) 112 #if defined(OS_WIN)
112 for (int key = base::PATH_WIN_START + 1; key < base::PATH_WIN_END; ++key) { 113 for (int key = base::PATH_WIN_START + 1; key < base::PATH_WIN_END; ++key) {
113 bool valid = true; 114 bool valid = true;
114 switch(key) { 115 switch(key) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 208 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
208 EXPECT_TRUE(PathService::Override(base::DIR_TEMP, temp_dir.path())); 209 EXPECT_TRUE(PathService::Override(base::DIR_TEMP, temp_dir.path()));
209 base::FilePath new_user_data_dir; 210 base::FilePath new_user_data_dir;
210 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); 211 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir));
211 EXPECT_NE(original_user_data_dir, new_user_data_dir); 212 EXPECT_NE(original_user_data_dir, new_user_data_dir);
212 213
213 EXPECT_TRUE(PathService::RemoveOverride(base::DIR_TEMP)); 214 EXPECT_TRUE(PathService::RemoveOverride(base::DIR_TEMP));
214 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir)); 215 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &new_user_data_dir));
215 EXPECT_EQ(original_user_data_dir, new_user_data_dir); 216 EXPECT_EQ(original_user_data_dir, new_user_data_dir);
216 } 217 }
OLDNEW
« no previous file with comments | « base/file_util_win.cc ('k') | chrome/browser/extensions/api/file_system/file_system_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698