| 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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 // Test that all PathService::Get calls return a value and a true result | 76 // Test that all PathService::Get calls return a value and a true result |
| 77 // in the development environment. (This test was created because a few | 77 // in the development environment. (This test was created because a few |
| 78 // later changes to Get broke the semantics of the function and yielded the | 78 // later changes to Get broke the semantics of the function and yielded the |
| 79 // correct value while returning false.) | 79 // correct value while returning false.) |
| 80 TEST_F(PathServiceTest, Get) { | 80 TEST_F(PathServiceTest, Get) { |
| 81 for (int key = base::PATH_START + 1; key < base::PATH_END; ++key) { | 81 for (int key = base::PATH_START + 1; key < base::PATH_END; ++key) { |
| 82 #if defined(OS_ANDROID) | 82 #if defined(OS_ANDROID) |
| 83 if (key == base::FILE_MODULE || key == base::DIR_USER_DESKTOP) | 83 if (key == base::FILE_MODULE || key == base::DIR_USER_DESKTOP) |
| 84 continue; // Android doesn't implement FILE_MODULE and DIR_USER_DESKTOP; | 84 continue; // Android doesn't implement FILE_MODULE and DIR_USER_DESKTOP; |
| 85 #elif defined(OS_IOS) |
| 86 if (key == base::DIR_USER_DESKTOP) |
| 87 continue; // iOS doesn't implement DIR_USER_DESKTOP; |
| 85 #endif | 88 #endif |
| 86 EXPECT_PRED1(ReturnsValidPath, key); | 89 EXPECT_PRED1(ReturnsValidPath, key); |
| 87 } | 90 } |
| 88 #if defined(OS_WIN) | 91 #if defined(OS_WIN) |
| 89 for (int key = base::PATH_WIN_START + 1; key < base::PATH_WIN_END; ++key) { | 92 for (int key = base::PATH_WIN_START + 1; key < base::PATH_WIN_END; ++key) { |
| 90 bool valid = true; | 93 bool valid = true; |
| 91 switch(key) { | 94 switch(key) { |
| 92 case base::DIR_LOCAL_APP_DATA_LOW: | 95 case base::DIR_LOCAL_APP_DATA_LOW: |
| 93 // DIR_LOCAL_APP_DATA_LOW is not supported prior Vista and is expected | 96 // DIR_LOCAL_APP_DATA_LOW is not supported prior Vista and is expected |
| 94 // to fail. | 97 // to fail. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // PathService::OverrideAndCreateIfNeeded should obey the |create| parameter. | 142 // PathService::OverrideAndCreateIfNeeded should obey the |create| parameter. |
| 140 PathService::OverrideAndCreateIfNeeded(my_special_key, | 143 PathService::OverrideAndCreateIfNeeded(my_special_key, |
| 141 fake_cache_dir2, | 144 fake_cache_dir2, |
| 142 false); | 145 false); |
| 143 EXPECT_FALSE(file_util::PathExists(fake_cache_dir2)); | 146 EXPECT_FALSE(file_util::PathExists(fake_cache_dir2)); |
| 144 EXPECT_TRUE(PathService::OverrideAndCreateIfNeeded(my_special_key, | 147 EXPECT_TRUE(PathService::OverrideAndCreateIfNeeded(my_special_key, |
| 145 fake_cache_dir2, | 148 fake_cache_dir2, |
| 146 true)); | 149 true)); |
| 147 EXPECT_TRUE(file_util::PathExists(fake_cache_dir2)); | 150 EXPECT_TRUE(file_util::PathExists(fake_cache_dir2)); |
| 148 } | 151 } |
| OLD | NEW |