OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/installer/util/install_util.h" | 5 #include "chrome/installer/util/install_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 EXPECT_FALSE(pred.Evaluate(L"Howdy")); | 317 EXPECT_FALSE(pred.Evaluate(L"Howdy")); |
318 EXPECT_FALSE(pred.Evaluate(L"howdy!")); | 318 EXPECT_FALSE(pred.Evaluate(L"howdy!")); |
319 EXPECT_FALSE(pred.Evaluate(L"!howdy")); | 319 EXPECT_FALSE(pred.Evaluate(L"!howdy")); |
320 EXPECT_TRUE(pred.Evaluate(L"howdy")); | 320 EXPECT_TRUE(pred.Evaluate(L"howdy")); |
321 } | 321 } |
322 | 322 |
323 TEST_F(InstallUtilTest, ProgramCompare) { | 323 TEST_F(InstallUtilTest, ProgramCompare) { |
324 base::ScopedTempDir test_dir; | 324 base::ScopedTempDir test_dir; |
325 ASSERT_TRUE(test_dir.CreateUniqueTempDir()); | 325 ASSERT_TRUE(test_dir.CreateUniqueTempDir()); |
326 const base::FilePath some_long_dir( | 326 const base::FilePath some_long_dir( |
327 test_dir.path().Append(L"Some Long Directory Name")); | 327 test_dir.GetPath().Append(L"Some Long Directory Name")); |
328 const base::FilePath expect(some_long_dir.Append(L"file.txt")); | 328 const base::FilePath expect(some_long_dir.Append(L"file.txt")); |
329 const base::FilePath expect_upcase(some_long_dir.Append(L"FILE.txt")); | 329 const base::FilePath expect_upcase(some_long_dir.Append(L"FILE.txt")); |
330 const base::FilePath other(some_long_dir.Append(L"otherfile.txt")); | 330 const base::FilePath other(some_long_dir.Append(L"otherfile.txt")); |
331 | 331 |
332 // Tests where the expected file doesn't exist. | 332 // Tests where the expected file doesn't exist. |
333 | 333 |
334 // Paths don't match. | 334 // Paths don't match. |
335 EXPECT_FALSE(InstallUtil::ProgramCompare(expect).Evaluate( | 335 EXPECT_FALSE(InstallUtil::ProgramCompare(expect).Evaluate( |
336 L"\"" + other.value() + L"\"")); | 336 L"\"" + other.value() + L"\"")); |
337 // Paths match exactly. | 337 // Paths match exactly. |
(...skipping 28 matching lines...) Expand all Loading... |
366 ASSERT_FALSE(base::FilePath::CompareEqualIgnoreCase(expect.value(), | 366 ASSERT_FALSE(base::FilePath::CompareEqualIgnoreCase(expect.value(), |
367 short_expect)); | 367 short_expect)); |
368 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate( | 368 EXPECT_TRUE(InstallUtil::ProgramCompare(expect).Evaluate( |
369 L"\"" + short_expect + L"\"")); | 369 L"\"" + short_expect + L"\"")); |
370 } | 370 } |
371 | 371 |
372 TEST_F(InstallUtilTest, ProgramCompareWithDirectories) { | 372 TEST_F(InstallUtilTest, ProgramCompareWithDirectories) { |
373 base::ScopedTempDir test_dir; | 373 base::ScopedTempDir test_dir; |
374 ASSERT_TRUE(test_dir.CreateUniqueTempDir()); | 374 ASSERT_TRUE(test_dir.CreateUniqueTempDir()); |
375 const base::FilePath some_long_dir( | 375 const base::FilePath some_long_dir( |
376 test_dir.path().Append(L"Some Long Directory Name")); | 376 test_dir.GetPath().Append(L"Some Long Directory Name")); |
377 const base::FilePath expect(some_long_dir.Append(L"directory")); | 377 const base::FilePath expect(some_long_dir.Append(L"directory")); |
378 const base::FilePath expect_upcase(some_long_dir.Append(L"DIRECTORY")); | 378 const base::FilePath expect_upcase(some_long_dir.Append(L"DIRECTORY")); |
379 const base::FilePath other(some_long_dir.Append(L"other_directory")); | 379 const base::FilePath other(some_long_dir.Append(L"other_directory")); |
380 | 380 |
381 ASSERT_TRUE(base::CreateDirectory(some_long_dir)); | 381 ASSERT_TRUE(base::CreateDirectory(some_long_dir)); |
382 ASSERT_TRUE(base::CreateDirectory(expect)); | 382 ASSERT_TRUE(base::CreateDirectory(expect)); |
383 ASSERT_TRUE(base::CreateDirectory(other)); | 383 ASSERT_TRUE(base::CreateDirectory(other)); |
384 | 384 |
385 InstallUtil::ProgramCompare program_compare( | 385 InstallUtil::ProgramCompare program_compare( |
386 expect, InstallUtil::ProgramCompare::ComparisonType::FILE_OR_DIRECTORY); | 386 expect, InstallUtil::ProgramCompare::ComparisonType::FILE_OR_DIRECTORY); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 ASSERT_TRUE(list->Do()); | 535 ASSERT_TRUE(list->Do()); |
536 EXPECT_EQ(current_version, | 536 EXPECT_EQ(current_version, |
537 InstallUtil::GetDowngradeVersion(system_install, &dist)); | 537 InstallUtil::GetDowngradeVersion(system_install, &dist)); |
538 list.reset(WorkItem::CreateWorkItemList()); | 538 list.reset(WorkItem::CreateWorkItemList()); |
539 InstallUtil::AddUpdateDowngradeVersionItem( | 539 InstallUtil::AddUpdateDowngradeVersionItem( |
540 system_install, nullptr, lower_new_version_1, &dist, list.get()); | 540 system_install, nullptr, lower_new_version_1, &dist, list.get()); |
541 ASSERT_TRUE(list->Do()); | 541 ASSERT_TRUE(list->Do()); |
542 ASSERT_FALSE( | 542 ASSERT_FALSE( |
543 InstallUtil::GetDowngradeVersion(system_install, &dist).IsValid()); | 543 InstallUtil::GetDowngradeVersion(system_install, &dist).IsValid()); |
544 } | 544 } |
OLD | NEW |