Index: chrome/installer/util/shell_util_unittest.cc |
diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc |
index a73452a643bf413f4d3e5864f677d5492431ad2c..02c6863e946dd45e56a79b88784d3bd5816bb1b4 100644 |
--- a/chrome/installer/util/shell_util_unittest.cc |
+++ b/chrome/installer/util/shell_util_unittest.cc |
@@ -13,6 +13,7 @@ |
#include "base/scoped_temp_dir.h" |
#include "base/string16.h" |
#include "base/string_util.h" |
+#include "base/test/test_file_util.h" |
#include "base/win/windows_version.h" |
#include "chrome/installer/util/browser_distribution.h" |
#include "chrome/installer/util/master_preferences.h" |
@@ -35,6 +36,24 @@ class ShellUtilTestWithDirAndDist : public testing::Test { |
ScopedTempDir temp_dir_; |
}; |
+// Returns the status of a call to file_util::VerifyShorcut for the properties |
+// passed in. |
+// TODO(gab): This is only temporary while waiting for my upcoming CL that will |
+// massively refactor the shell_util shortcut methods' interface (i.e. I didn't |
+// want to adapt every test here for this half-changed state as they will change |
+// again very soon). |
+file_util::VerifyShortcutStatus VerifyChromeShortcut( |
+ const string16& exe_path, |
+ const string16& shortcut_path, |
+ const string16& description, |
+ int icon_index) { |
+ file_util::ShortcutProperties expected_properties; |
+ expected_properties.set_target(exe_path); |
+ expected_properties.set_description(description); |
+ expected_properties.set_icon(exe_path, icon_index); |
+ return file_util::VerifyShortcut(shortcut_path, expected_properties); |
+} |
+ |
} |
// Test that we can open archives successfully. |
@@ -53,13 +72,13 @@ TEST_F(ShellUtilTestWithDirAndDist, UpdateChromeShortcutTest) { |
dist_, |
exe_path.value(), |
shortcut_path.value(), |
- L"", |
+ string16(), |
description, |
exe_path.value(), |
dist_->GetIconIndex(), |
ShellUtil::SHORTCUT_CREATE_ALWAYS)); |
- EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, |
- ShellUtil::VerifyChromeShortcut( |
+ EXPECT_EQ(file_util::VERIFY_SHORTCUT_SUCCESS, |
+ VerifyChromeShortcut( |
exe_path.value(), shortcut_path.value(), description, 0)); |
// Now specify an icon index in master prefs and make sure it works. |
@@ -80,13 +99,13 @@ TEST_F(ShellUtilTestWithDirAndDist, UpdateChromeShortcutTest) { |
dist_, |
exe_path.value(), |
shortcut_path.value(), |
- L"", |
+ string16(), |
description, |
exe_path.value(), |
dist_->GetIconIndex(), |
ShellUtil::SHORTCUT_CREATE_ALWAYS)); |
- EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, |
- ShellUtil::VerifyChromeShortcut( |
+ EXPECT_EQ(file_util::VERIFY_SHORTCUT_SUCCESS, |
+ VerifyChromeShortcut( |
exe_path.value(), shortcut_path.value(), description, 1)); |
// Now change only description to update shortcut and make sure icon index |
@@ -95,13 +114,13 @@ TEST_F(ShellUtilTestWithDirAndDist, UpdateChromeShortcutTest) { |
EXPECT_TRUE(ShellUtil::UpdateChromeShortcut(dist_, |
exe_path.value(), |
shortcut_path.value(), |
- L"", |
+ string16(), |
description2, |
exe_path.value(), |
dist_->GetIconIndex(), |
ShellUtil::SHORTCUT_NO_OPTIONS)); |
- EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, |
- ShellUtil::VerifyChromeShortcut( |
+ EXPECT_EQ(file_util::VERIFY_SHORTCUT_SUCCESS, |
+ VerifyChromeShortcut( |
exe_path.value(), shortcut_path.value(), description2, 1)); |
} |
@@ -128,7 +147,7 @@ TEST_F(ShellUtilTestWithDirAndDist, CreateChromeDesktopShortcutTest) { |
EXPECT_TRUE(ShellUtil::GetDesktopPath(true, &system_desktop_path)); |
string16 shortcut_name; |
- EXPECT_TRUE(ShellUtil::GetChromeShortcutName(dist_, false, L"", |
+ EXPECT_TRUE(ShellUtil::GetChromeShortcutName(dist_, false, string16(), |
&shortcut_name)); |
string16 default_profile_shortcut_name; |
@@ -155,14 +174,14 @@ TEST_F(ShellUtilTestWithDirAndDist, CreateChromeDesktopShortcutTest) { |
dist_, |
exe_path.value(), |
description, |
- L"", |
- L"", |
+ string16(), |
+ string16(), |
exe_path.value(), |
dist_->GetIconIndex(), |
ShellUtil::CURRENT_USER, |
ShellUtil::SHORTCUT_CREATE_ALWAYS)); |
- EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, |
- ShellUtil::VerifyChromeShortcut( |
+ EXPECT_EQ(file_util::VERIFY_SHORTCUT_SUCCESS, |
+ VerifyChromeShortcut( |
exe_path.value(), user_shortcut_path.value(), description, 0)); |
EXPECT_TRUE(ShellUtil::RemoveChromeDesktopShortcut( |
dist_, |
@@ -174,14 +193,14 @@ TEST_F(ShellUtilTestWithDirAndDist, CreateChromeDesktopShortcutTest) { |
dist_, |
exe_path.value(), |
description, |
- L"", |
- L"", |
+ string16(), |
+ string16(), |
exe_path.value(), |
dist_->GetIconIndex(), |
ShellUtil::SYSTEM_LEVEL, |
ShellUtil::SHORTCUT_CREATE_ALWAYS)); |
- EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, |
- ShellUtil::VerifyChromeShortcut( |
+ EXPECT_EQ(file_util::VERIFY_SHORTCUT_SUCCESS, |
+ VerifyChromeShortcut( |
exe_path.value(), system_shortcut_path.value(), description, |
0)); |
EXPECT_TRUE(ShellUtil::RemoveChromeDesktopShortcut( |
@@ -195,8 +214,8 @@ TEST_F(ShellUtilTestWithDirAndDist, CreateChromeDesktopShortcutTest) { |
dist_, |
exe_path.value(), |
description, |
- L"", |
- L"", |
+ string16(), |
+ string16(), |
exe_path.value(), |
dist_->GetIconIndex(), |
ShellUtil::SYSTEM_LEVEL, |
@@ -205,14 +224,14 @@ TEST_F(ShellUtilTestWithDirAndDist, CreateChromeDesktopShortcutTest) { |
dist_, |
exe_path.value(), |
description, |
- L"", |
- L"", |
+ string16(), |
+ string16(), |
exe_path.value(), |
dist_->GetIconIndex(), |
ShellUtil::CURRENT_USER, |
ShellUtil::SHORTCUT_CREATE_ALWAYS)); |
- EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, |
- ShellUtil::VerifyChromeShortcut( |
+ EXPECT_EQ(file_util::VERIFY_SHORTCUT_SUCCESS, |
+ VerifyChromeShortcut( |
exe_path.value(), system_shortcut_path.value(), description, |
0)); |
EXPECT_FALSE(file_util::PathExists(user_shortcut_path)); |
@@ -227,8 +246,8 @@ TEST_F(ShellUtilTestWithDirAndDist, CreateChromeDesktopShortcutTest) { |
dist_, |
exe_path.value(), |
description, |
- L"", |
- L"", |
+ string16(), |
+ string16(), |
exe_path.value(), |
dist_->GetIconIndex(), |
ShellUtil::CURRENT_USER, |
@@ -237,17 +256,17 @@ TEST_F(ShellUtilTestWithDirAndDist, CreateChromeDesktopShortcutTest) { |
dist_, |
exe_path.value(), |
description, |
- L"", |
- L"", |
+ string16(), |
+ string16(), |
exe_path.value(), |
dist_->GetIconIndex(), |
ShellUtil::SYSTEM_LEVEL, |
ShellUtil::SHORTCUT_CREATE_ALWAYS)); |
- EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, |
- ShellUtil::VerifyChromeShortcut( |
+ EXPECT_EQ(file_util::VERIFY_SHORTCUT_SUCCESS, |
+ VerifyChromeShortcut( |
exe_path.value(), user_shortcut_path.value(), description, 0)); |
- EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, |
- ShellUtil::VerifyChromeShortcut( |
+ EXPECT_EQ(file_util::VERIFY_SHORTCUT_SUCCESS, |
+ VerifyChromeShortcut( |
exe_path.value(), system_shortcut_path.value(), description, |
0)); |
EXPECT_TRUE(ShellUtil::RemoveChromeDesktopShortcut( |
@@ -271,8 +290,8 @@ TEST_F(ShellUtilTestWithDirAndDist, CreateChromeDesktopShortcutTest) { |
dist_->GetIconIndex(), |
ShellUtil::CURRENT_USER, |
ShellUtil::SHORTCUT_CREATE_ALWAYS)); |
- EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, |
- ShellUtil::VerifyChromeShortcut( |
+ EXPECT_EQ(file_util::VERIFY_SHORTCUT_SUCCESS, |
+ VerifyChromeShortcut( |
exe_path.value(), default_profile_shortcut_path.value(), |
description, 0)); |
EXPECT_TRUE(ShellUtil::CreateChromeDesktopShortcut( |
@@ -285,8 +304,8 @@ TEST_F(ShellUtilTestWithDirAndDist, CreateChromeDesktopShortcutTest) { |
dist_->GetIconIndex(), |
ShellUtil::CURRENT_USER, |
ShellUtil::SHORTCUT_CREATE_ALWAYS)); |
- EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, |
- ShellUtil::VerifyChromeShortcut( |
+ EXPECT_EQ(file_util::VERIFY_SHORTCUT_SUCCESS, |
+ VerifyChromeShortcut( |
exe_path.value(), second_profile_shortcut_path.value(), |
description, 0)); |
std::vector<string16> profile_names; |