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

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

Issue 1800303006: Fix the path of shortcuts with an icon in the current install dir. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix buildbot error Created 4 years, 9 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
Index: chrome/installer/util/install_util_unittest.cc
diff --git a/chrome/installer/util/install_util_unittest.cc b/chrome/installer/util/install_util_unittest.cc
index 40467f53df7d8482fa22139c7a3ccd543d86d4cd..15b7a46fd89e677180b512d547d7723027b80e80 100644
--- a/chrome/installer/util/install_util_unittest.cc
+++ b/chrome/installer/util/install_util_unittest.cc
@@ -453,6 +453,44 @@ TEST_F(InstallUtilTest, ProgramCompare) {
L"\"" + short_expect + L"\""));
}
+TEST_F(InstallUtilTest, ProgramCompareWithDirectories) {
gab 2016/03/21 19:28:13 Should also verify that all other file tests pass
+ base::ScopedTempDir test_dir;
+ ASSERT_TRUE(test_dir.CreateUniqueTempDir());
+ const base::FilePath some_long_dir(
+ test_dir.path().Append(L"Some Long Directory Name"));
+ const base::FilePath expect(some_long_dir.Append(L"directory"));
+ const base::FilePath expect_upcase(some_long_dir.Append(L"DIRECTORY"));
+ const base::FilePath other(some_long_dir.Append(L"other_directory"));
+
+ ASSERT_TRUE(base::CreateDirectory(some_long_dir));
+ ASSERT_TRUE(base::CreateDirectory(expect));
+ ASSERT_TRUE(base::CreateDirectory(other));
+
+ InstallUtil::ProgramCompare program_compare(
+ expect, InstallUtil::ProgramCompare::ComparisonType::FILE_OR_DIRECTORY);
+
+ // Paths match exactly.
+ EXPECT_TRUE(program_compare.EvaluatePath(expect));
+ // Paths differ by case.
+ EXPECT_TRUE(program_compare.EvaluatePath(expect_upcase));
+ // Paths don't match.
+ EXPECT_FALSE(program_compare.EvaluatePath(other));
+
+ // Test where strings don't match, but the same directory is indicated.
+ std::wstring short_expect;
gab 2016/03/21 19:28:13 base::string16
+ DWORD short_len =
+ GetShortPathName(expect.value().c_str(),
+ base::WriteInto(&short_expect, MAX_PATH), MAX_PATH);
+ ASSERT_NE(static_cast<DWORD>(0), short_len);
+ ASSERT_GT(static_cast<DWORD>(MAX_PATH), short_len);
+ short_expect.resize(short_len);
+ ASSERT_FALSE(
+ base::FilePath::CompareEqualIgnoreCase(expect.value(), short_expect));
+ EXPECT_TRUE(program_compare.EvaluatePath(expect));
+ EXPECT_TRUE(program_compare.EvaluatePath(expect_upcase));
+ EXPECT_FALSE(program_compare.EvaluatePath(other));
+}
+
// Win64 Chrome is always installed in the 32-bit Program Files directory. Test
// that IsPerUserInstall returns false for an arbitrary path with
// DIR_PROGRAM_FILESX86 as a suffix but not DIR_PROGRAM_FILES when the two are
« chrome/installer/util/install_util.h ('K') | « chrome/installer/util/install_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698