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

Unified Diff: chrome/installer/util/shell_util_unittest.cc

Issue 10958009: Revert 157667 - Add new PathService paths for Windows' All Users Desktop and Quick Launch folders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/shell_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/shell_util_unittest.cc
===================================================================
--- chrome/installer/util/shell_util_unittest.cc (revision 157679)
+++ chrome/installer/util/shell_util_unittest.cc (working copy)
@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <shlobj.h>
+
#include <fstream>
#include <vector>
#include "base/file_util.h"
-#include "base/md5.h"
#include "base/path_service.h"
+#include "base/md5.h"
#include "base/scoped_temp_dir.h"
#include "base/string16.h"
#include "base/string_util.h"
@@ -22,27 +24,17 @@
namespace {
-class ShellUtilShortcutTest : public testing::Test {
+class ShellUtilTestWithDirAndDist : public testing::Test {
protected:
- virtual void SetUp() OVERRIDE {
+ virtual void SetUp() {
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
dist_ = BrowserDistribution::GetDistribution();
ASSERT_TRUE(dist_ != NULL);
-
- ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
- ASSERT_TRUE(fake_user_desktop_.CreateUniqueTempDir());
- ASSERT_TRUE(fake_common_desktop_.CreateUniqueTempDir());
- ASSERT_TRUE(PathService::Override(base::DIR_USER_DESKTOP,
- fake_user_desktop_.path()));
- ASSERT_TRUE(PathService::Override(base::DIR_COMMON_DESKTOP,
- fake_common_desktop_.path()));
}
BrowserDistribution* dist_;
ScopedTempDir temp_dir_;
-
- ScopedTempDir fake_user_desktop_;
- ScopedTempDir fake_common_desktop_;
};
// Returns the status of a call to base::win::VerifyShorcut for the properties
@@ -66,7 +58,7 @@
}
// Test that we can open archives successfully.
-TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) {
+TEST_F(ShellUtilTestWithDirAndDist, UpdateChromeShortcutTest) {
// Create an executable in test path by copying ourself to it.
wchar_t exe_full_path_str[MAX_PATH];
EXPECT_FALSE(::GetModuleFileName(NULL, exe_full_path_str, MAX_PATH) == 0);
@@ -130,7 +122,13 @@
VerifyChromeShortcut(exe_path, shortcut_path, description2, 1));
}
-TEST_F(ShellUtilShortcutTest, CreateChromeDesktopShortcut) {
+TEST_F(ShellUtilTestWithDirAndDist, CreateChromeDesktopShortcutTest) {
+ // Run this test on Vista+ only if we are running elevated.
+ if (base::win::GetVersion() > base::win::VERSION_XP && !IsUserAnAdmin()) {
+ LOG(ERROR) << "Must be admin to run this test on Vista+";
+ return;
+ }
+
// Create an executable in test path by copying ourself to it.
wchar_t exe_full_path_str[MAX_PATH];
EXPECT_FALSE(::GetModuleFileName(NULL, exe_full_path_str, MAX_PATH) == 0);
@@ -308,18 +306,16 @@
profile_names));
}
-TEST(ShellUtilTest, BuildAppModelIdBasic) {
+TEST_F(ShellUtilTestWithDirAndDist, BuildAppModelIdBasic) {
std::vector<string16> components;
- BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- const string16 base_app_id(dist->GetBaseAppId());
+ const string16 base_app_id(dist_->GetBaseAppId());
components.push_back(base_app_id);
ASSERT_EQ(base_app_id, ShellUtil::BuildAppModelId(components));
}
-TEST(ShellUtilTest, BuildAppModelIdManySmall) {
+TEST_F(ShellUtilTestWithDirAndDist, BuildAppModelIdManySmall) {
std::vector<string16> components;
- BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- const string16 suffixed_app_id(dist->GetBaseAppId().append(L".gab"));
+ const string16 suffixed_app_id(dist_->GetBaseAppId().append(L".gab"));
components.push_back(suffixed_app_id);
components.push_back(L"Default");
components.push_back(L"Test");
@@ -327,7 +323,7 @@
ShellUtil::BuildAppModelId(components));
}
-TEST(ShellUtilTest, BuildAppModelIdLongUsernameNormalProfile) {
+TEST_F(ShellUtilTestWithDirAndDist, BuildAppModelIdLongUsernameNormalProfile) {
std::vector<string16> components;
const string16 long_appname(
L"Chrome.a_user_who_has_a_crazy_long_name_with_some_weird@symbols_in_it_"
@@ -338,7 +334,7 @@
ShellUtil::BuildAppModelId(components));
}
-TEST(ShellUtilTest, BuildAppModelIdLongEverything) {
+TEST_F(ShellUtilTestWithDirAndDist, BuildAppModelIdLongEverything) {
std::vector<string16> components;
const string16 long_appname(
L"Chrome.a_user_who_has_a_crazy_long_name_with_some_weird@symbols_in_it_"
« no previous file with comments | « chrome/installer/util/shell_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698