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

Unified Diff: chrome/installer/setup/setup_util_unittest.cc

Issue 10446095: Move ProgramCompare from setup_util to install_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move tests Created 8 years, 7 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/setup/setup_util_unittest.cc
diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc
index 637c09bf0d331392081778ea9921eba64d43d5f7..c71158ab5306eeadedcc2d1d02f6477af933e98a 100644
--- a/chrome/installer/setup/setup_util_unittest.cc
+++ b/chrome/installer/setup/setup_util_unittest.cc
@@ -4,15 +4,13 @@
#include <windows.h>
-#include "base/base_paths.h"
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
-#include "base/string_util.h"
+#include "base/time.h"
#include "base/threading/platform_thread.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/installer/setup/setup_util.h"
-#include "chrome/installer/util/master_preferences.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -96,51 +94,6 @@ TEST_F(SetupUtilTest, GetMaxVersionFromArchiveDirTest) {
ASSERT_EQ(version->GetString(), "9.9.9.9");
}
-TEST_F(SetupUtilTest, ProgramCompare) {
- using installer::ProgramCompare;
- ScopedTempDir temp_dir;
-
- ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
-
- FilePath some_long_dir(temp_dir.path().Append(L"Some Long Directory Name"));
- FilePath expect(some_long_dir.Append(L"file.txt"));
- FilePath expect_upcase(some_long_dir.Append(L"FILE.txt"));
- FilePath other(some_long_dir.Append(L"otherfile.txt"));
-
- // Tests where the expected file doesn't exist.
-
- // Paths don't match.
- EXPECT_FALSE(ProgramCompare(expect).Evaluate(L"\"" + other.value() + L"\""));
- // Paths match exactly.
- EXPECT_TRUE(ProgramCompare(expect).Evaluate(L"\"" + expect.value() + L"\""));
- // Paths differ by case.
- EXPECT_TRUE(ProgramCompare(expect).Evaluate(
- L"\"" + expect_upcase.value() + L"\""));
-
- // Tests where the expected file exists.
- static const char data[] = "data";
- ASSERT_TRUE(file_util::CreateDirectory(some_long_dir));
- ASSERT_NE(-1, file_util::WriteFile(expect, data, arraysize(data) - 1));
- // Paths don't match.
- EXPECT_FALSE(ProgramCompare(expect).Evaluate(L"\"" + other.value() + L"\""));
- // Paths match exactly.
- EXPECT_TRUE(ProgramCompare(expect).Evaluate(L"\"" + expect.value() + L"\""));
- // Paths differ by case.
- EXPECT_TRUE(ProgramCompare(expect).Evaluate(
- L"\"" + expect_upcase.value() + L"\""));
-
- // Test where strings don't match, but the same file is indicated.
- std::wstring short_expect;
- DWORD short_len = GetShortPathName(expect.value().c_str(),
- 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(FilePath::CompareEqualIgnoreCase(expect.value(), short_expect));
- EXPECT_TRUE(ProgramCompare(expect).Evaluate(L"\"" + short_expect + L"\""));
-}
-
TEST_F(SetupUtilTest, DeleteFileFromTempProcess) {
FilePath test_file;
file_util::CreateTemporaryFileInDir(test_dir_.path(), &test_file);

Powered by Google App Engine
This is Rietveld 408576698