| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/platform_test.h" | |
| 12 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 13 #include "base/win_util.h" | 12 #include "base/win_util.h" |
| 14 #endif | 13 #endif |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "testing/gtest/include/gtest/gtest-spi.h" | 15 #include "testing/gtest/include/gtest/gtest-spi.h" |
| 16 #include "testing/platform_test.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Returns true if PathService::Get returns true and sets the path parameter | 20 // Returns true if PathService::Get returns true and sets the path parameter |
| 21 // to non-empty for the given PathService::DirType enumeration value. | 21 // to non-empty for the given PathService::DirType enumeration value. |
| 22 bool ReturnsValidPath(int dir_type) { | 22 bool ReturnsValidPath(int dir_type) { |
| 23 FilePath path; | 23 FilePath path; |
| 24 bool result = PathService::Get(dir_type, &path); | 24 bool result = PathService::Get(dir_type, &path); |
| 25 return result && !path.value().empty() && file_util::PathExists(path); | 25 return result && !path.value().empty() && file_util::PathExists(path); |
| 26 } | 26 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 55 // DIR_LOCAL_APP_DATA_LOW is not supported prior Vista and is expected to | 55 // DIR_LOCAL_APP_DATA_LOW is not supported prior Vista and is expected to |
| 56 // fail. | 56 // fail. |
| 57 EXPECT_TRUE(ReturnsInvalidPath(key)) << key; | 57 EXPECT_TRUE(ReturnsInvalidPath(key)) << key; |
| 58 } else { | 58 } else { |
| 59 EXPECT_TRUE(ReturnsValidPath(key)) << key; | 59 EXPECT_TRUE(ReturnsValidPath(key)) << key; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 #endif | 62 #endif |
| 63 } | 63 } |
| 64 | 64 |
| OLD | NEW |