diff options
author | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-20 01:59:36 +0000 |
---|---|---|
committer | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-20 01:59:36 +0000 |
commit | 1f4ae1659132f11a99e4425efdc517838e21b7ae (patch) | |
tree | d5839b4906f43c1dff10e96f6eaa453d4334f0ae /base/path_service_unittest.cc | |
parent | 5e63aededfd66dd694e68619051153439f0016b1 (diff) | |
download | chromium_src-1f4ae1659132f11a99e4425efdc517838e21b7ae.zip chromium_src-1f4ae1659132f11a99e4425efdc517838e21b7ae.tar.gz chromium_src-1f4ae1659132f11a99e4425efdc517838e21b7ae.tar.bz2 |
Revert 157667 - Add new PathService paths for Windows' All Users Desktop and Quick Launch folders.
The previous patch failed PathServiceTest.Get.
This allows usage of PathService to cache the paths and more importantly to mock them in shortcut tests!
Also move chrome::DIR_USER_DESKTOP to base::DIR_USER_DESKTOP; this is really where it belongs. In fact it is only in chrome_paths.h because it used to be called DIR_DEFAULT_DOWNLOAD and cpu@ renamed it to DIR_USER_DESKTOP in http://crrev.com/1753 (early days!) after that it started to be used all over the place as the Desktop path. Finally bringing it to base_paths.h, beside DIR_START_MENU and friends, is the right thing to do imo.
BUG=148539
TEST=Quick Launch shortcut installed in the right place on XP (both Default and current user)
Desktop shortcuts installed in the right place (both All Users and per-user installs).
installer_util_unittests.exe --gtest_filter=ShellUtilShortcutTest*
unit_tests.exe --gtest_filter=ProfileShortcutManagerTest*
base_unittests --gtest_filter=PathServiceTest*
Review URL: https://chromiumcodereview.appspot.com/10910209
TBR=gab@chromium.org
Review URL: https://codereview.chromium.org/10958009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/path_service_unittest.cc')
-rw-r--r-- | base/path_service_unittest.cc | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc index 84564d0..81d1fef 100644 --- a/base/path_service_unittest.cc +++ b/base/path_service_unittest.cc @@ -8,14 +8,12 @@ #include "base/file_util.h" #include "base/file_path.h" #include "base/scoped_temp_dir.h" -#include "build/build_config.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "testing/gtest/include/gtest/gtest-spi.h" -#include "testing/platform_test.h" - #if defined(OS_WIN) #include "base/win/windows_version.h" #endif +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/gtest/include/gtest/gtest-spi.h" +#include "testing/platform_test.h" namespace { @@ -28,15 +26,9 @@ bool ReturnsValidPath(int dir_type) { // If chromium has never been started on this account, the cache path may not // exist. if (dir_type == base::DIR_CACHE) - return result && !path.empty(); + return result && !path.value().empty(); #endif -#if defined(OS_LINUX) - // On the linux try-bots: a path is returned (e.g. /home/chrome-bot/Desktop), - // but it doesn't exist. - if (dir_type == base::DIR_USER_DESKTOP) - return result && !path.empty(); -#endif - return result && !path.empty() && file_util::PathExists(path); + return result && !path.value().empty() && file_util::PathExists(path); } #if defined(OS_WIN) @@ -61,10 +53,10 @@ typedef PlatformTest PathServiceTest; // later changes to Get broke the semantics of the function and yielded the // correct value while returning false.) TEST_F(PathServiceTest, Get) { - for (int key = base::PATH_START + 1; key < base::PATH_END; ++key) { + for (int key = base::DIR_CURRENT; key < base::PATH_END; ++key) { #if defined(OS_ANDROID) - if (key == base::FILE_MODULE || key == base::DIR_USER_DESKTOP) - continue; // Android doesn't implement FILE_MODULE and DIR_USER_DESKTOP; + if (key == base::FILE_MODULE) + continue; // Android doesn't implement FILE_MODULE; #endif EXPECT_PRED1(ReturnsValidPath, key); } @@ -91,17 +83,7 @@ TEST_F(PathServiceTest, Get) { } #elif defined(OS_MACOSX) for (int key = base::PATH_MAC_START + 1; key < base::PATH_MAC_END; ++key) { - EXPECT_PRED1(ReturnsValidPath, key); - } -#elif defined(OS_ANDROID) - for (int key = base::PATH_ANDROID_START + 1; key < base::PATH_ANDROID_END; - ++key) { - EXPECT_PRED1(ReturnsValidPath, key); - } -#elif defined(OS_POSIX) - for (int key = base::PATH_POSIX_START + 1; key < base::PATH_POSIX_END; - ++key) { - EXPECT_PRED1(ReturnsValidPath, key); + EXPECT_PRED1(ReturnsValidPath, key); } #endif } |