| 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/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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |