summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profiles
diff options
context:
space:
mode:
authordgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 02:46:08 +0000
committerdgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 02:46:08 +0000
commitcfc84156401287b783f439024f61c8a477087362 (patch)
treec1c075451c8de0c843888c6b0726026a225eda61 /chrome/browser/profiles
parent0e8e65cecc6a817e42203a99e3719e69a02a4a57 (diff)
downloadchromium_src-cfc84156401287b783f439024f61c8a477087362.zip
chromium_src-cfc84156401287b783f439024f61c8a477087362.tar.gz
chromium_src-cfc84156401287b783f439024f61c8a477087362.tar.bz2
installer_util_unittests has failed on XP Tests (dbg)(1) since this landed
Revert 155869 - Refactoring and tests for the highly undertested file_util::CreateOrUpdateShortcutLink() method. Simplify file_util::CreateOrUpdateShortcutLink()'s interface (use a struct to set parameters passed which allows callers to specify exactly what they want without having to pass in a bunch of NULLs for the unused parameters). The same concept will be used for ShellUtil's shortcut functions in an upcoming CL. Moved ShellUtil::VerifyChromeShortcut() to file_util::VerifyShortcut() and augmented it for every shortcut properties. This will also allow other shortcut creators (web apps, profiles, etc.) to have a broader test coverage on the shortcut they create (i.e. more testable properties available). I will leave it up to the owners of these various projects to augment their tests, this CL keeps the previously tested behavior, not more, not less. This is the 1st CL of a massive refactoring effort for shortcuts (http://goo.gl/Az889) in which ShellUtil's shortcut methods have to be refactored (http://codereview.chromium.org/10836247/ : soon to incorporate interface changes from this CL) which led me even lower to first refactor file_util's shortcut methods. BUG=132825 TEST=base_unittests --gtest_filter=FileUtilShortcutTest* installer_util_unitests --gtest_filter=ShellUtilTestWithDirAndDist* unit_tests --gtest_filter=ProfileShortcutManagerTest* Review URL: https://chromiumcodereview.appspot.com/10914109 TBR=gab@chromium.org Review URL: https://chromiumcodereview.appspot.com/10910183 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profiles')
-rw-r--r--chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc56
1 files changed, 25 insertions, 31 deletions
diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
index 826bb6d..f1ddaed 100644
--- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
+++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
@@ -7,8 +7,6 @@
#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
#include "base/utf_string_conversions.h"
-#include "base/test/test_shortcut_win.h"
-#include "base/win/shortcut.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_shortcut_manager.h"
@@ -27,10 +25,10 @@ using content::BrowserThread;
namespace {
-base::win::VerifyShortcutStatus VerifyProfileShortcut(
+ShellUtil::VerifyShortcutStatus VerifyProfileShortcut(
const string16& profile_name) {
FilePath exe_path;
- EXPECT_TRUE(PathService::Get(base::FILE_EXE, &exe_path));
+ CHECK(PathService::Get(base::FILE_EXE, &exe_path));
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
@@ -43,13 +41,9 @@ base::win::VerifyShortcutStatus VerifyProfileShortcut(
&shortcut_name);
shortcut_path = shortcut_path.Append(shortcut_name);
- // TODO(hallielaine): With this new struct method for VerifyShortcut you can
- // now test more properties like: arguments, icon, icon_index, and app_id.
- base::win::ShortcutProperties expected_properties;
- expected_properties.set_target(exe_path);
- expected_properties.set_description(dist->GetAppDescription());
- expected_properties.set_dual_mode(false);
- return base::win::VerifyShortcut(shortcut_path, expected_properties);
+ return ShellUtil::VerifyChromeShortcut(
+ exe_path.value(), shortcut_path.value(), dist->GetAppDescription(),
+ 0);
}
} // namespace
@@ -100,7 +94,7 @@ class ProfileShortcutManagerTest : public testing::Test {
profile_path);
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
MessageLoop::current()->Run();
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED,
VerifyProfileShortcut(profile_name));
ASSERT_FALSE(file_util::PathExists(profile_path.Append(
FILE_PATH_LITERAL("Google Profile.ico"))));
@@ -108,7 +102,7 @@ class ProfileShortcutManagerTest : public testing::Test {
}
void SetupDefaultProfileShortcut() {
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED,
VerifyProfileShortcut(profile_name_));
profile_manager_->profile_info_cache()->AddProfileToCache(
@@ -119,15 +113,15 @@ class ProfileShortcutManagerTest : public testing::Test {
MessageLoop::current()->Run();
// We now have 1 profile, so we expect a new shortcut with no profile
// information.
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
VerifyProfileShortcut(string16()));
}
void SetupAndCreateTwoShortcuts() {
ASSERT_EQ(0, profile_manager_->profile_info_cache()->GetNumberOfProfiles());
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED,
VerifyProfileShortcut(profile_name_));
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED,
VerifyProfileShortcut(second_profile_name_));
profile_manager_->profile_info_cache()->AddProfileToCache(
@@ -140,9 +134,9 @@ class ProfileShortcutManagerTest : public testing::Test {
CreateProfileShortcut(second_dest_path_);
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
MessageLoop::current()->Run();
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
VerifyProfileShortcut(profile_name_));
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
VerifyProfileShortcut(second_profile_name_));
}
@@ -170,7 +164,7 @@ TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreate) {
// We now have 2 profiles, so we expect a new shortcut with profile
// information for this 2nd profile.
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
VerifyProfileShortcut(second_profile_name_));
ASSERT_TRUE(file_util::PathExists(second_dest_path_.Append(
FILE_PATH_LITERAL("Google Profile.ico"))));
@@ -181,7 +175,7 @@ TEST_F(ProfileShortcutManagerTest, DesktopShortcutsUpdate) {
return;
ProfileShortcutManagerTest::SetupDefaultProfileShortcut();
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED,
VerifyProfileShortcut(second_profile_name_));
profile_manager_->profile_info_cache()->AddProfileToCache(
@@ -190,7 +184,7 @@ TEST_F(ProfileShortcutManagerTest, DesktopShortcutsUpdate) {
CreateProfileShortcut(second_dest_path_);
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
MessageLoop::current()->Run();
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
VerifyProfileShortcut(second_profile_name_));
// Cause an update in ProfileShortcutManager by modifying the profile info
@@ -202,9 +196,9 @@ TEST_F(ProfileShortcutManagerTest, DesktopShortcutsUpdate) {
new_profile_name);
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
MessageLoop::current()->Run();
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED,
VerifyProfileShortcut(second_profile_name_));
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
VerifyProfileShortcut(new_profile_name));
}
@@ -218,15 +212,15 @@ TEST_F(ProfileShortcutManagerTest, DesktopShortcutsDeleteSecondToLast) {
second_dest_path_);
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
MessageLoop::current()->Run();
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED,
VerifyProfileShortcut(second_profile_name_));
// Verify that the profile name has been removed from the remaining shortcut
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
VerifyProfileShortcut(string16()));
// Verify that an additional shortcut, with the default profile's name does
// not exist
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED,
VerifyProfileShortcut(profile_name_));
}
@@ -242,11 +236,11 @@ TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreateSecond) {
MessageLoop::current()->Run();
// Verify that a default shortcut exists (no profile name/avatar)
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
VerifyProfileShortcut(string16()));
// Verify that an additional shortcut, with the default profile's name does
// not exist
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED,
VerifyProfileShortcut(profile_name_));
// Create a second profile and shortcut
@@ -256,14 +250,14 @@ TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreateSecond) {
CreateProfileShortcut(second_dest_path_);
MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
MessageLoop::current()->Run();
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
VerifyProfileShortcut(second_profile_name_));
// Verify that the original shortcut received the profile's name
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
VerifyProfileShortcut(profile_name_));
// Verify that a default shortcut no longer exists
- EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND,
+ EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED,
VerifyProfileShortcut(string16()));
}