| 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 <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include <fstream> | 7 #include <fstream> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/file_enumerator.h" |
| 12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 15 #include "base/process_util.h" | 16 #include "base/process_util.h" |
| 16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 17 #include "base/test/test_reg_util_win.h" | 18 #include "base/test/test_reg_util_win.h" |
| 18 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 19 #include "base/version.h" | 20 #include "base/version.h" |
| 20 #include "base/win/registry.h" | 21 #include "base/win/registry.h" |
| 21 #include "base/win/scoped_handle.h" | 22 #include "base/win/scoped_handle.h" |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 578 |
| 578 // What we expect to have left. | 579 // What we expect to have left. |
| 579 std::set<std::string> expected_remaining_dirs; | 580 std::set<std::string> expected_remaining_dirs; |
| 580 expected_remaining_dirs.insert(kOldVersion); | 581 expected_remaining_dirs.insert(kOldVersion); |
| 581 expected_remaining_dirs.insert(kNewVersion); | 582 expected_remaining_dirs.insert(kNewVersion); |
| 582 expected_remaining_dirs.insert(kOldChromeExeVersion); | 583 expected_remaining_dirs.insert(kOldChromeExeVersion); |
| 583 expected_remaining_dirs.insert(kChromeExeVersion); | 584 expected_remaining_dirs.insert(kChromeExeVersion); |
| 584 expected_remaining_dirs.insert(kNewChromeExeVersion); | 585 expected_remaining_dirs.insert(kNewChromeExeVersion); |
| 585 | 586 |
| 586 // Enumerate dirs in target_path(), ensure only desired remain. | 587 // Enumerate dirs in target_path(), ensure only desired remain. |
| 587 file_util::FileEnumerator version_enum(installer_state.target_path(), false, | 588 base::FileEnumerator version_enum(installer_state.target_path(), false, |
| 588 file_util::FileEnumerator::DIRECTORIES); | 589 base::FileEnumerator::DIRECTORIES); |
| 589 for (base::FilePath next_version = version_enum.Next(); !next_version.empty(); | 590 for (base::FilePath next_version = version_enum.Next(); !next_version.empty(); |
| 590 next_version = version_enum.Next()) { | 591 next_version = version_enum.Next()) { |
| 591 base::FilePath dir_name(next_version.BaseName()); | 592 base::FilePath dir_name(next_version.BaseName()); |
| 592 Version version(WideToASCII(dir_name.value())); | 593 Version version(WideToASCII(dir_name.value())); |
| 593 if (version.IsValid()) { | 594 if (version.IsValid()) { |
| 594 EXPECT_TRUE(expected_remaining_dirs.erase(version.GetString())) | 595 EXPECT_TRUE(expected_remaining_dirs.erase(version.GetString())) |
| 595 << "Unexpected version dir found: " << version.GetString(); | 596 << "Unexpected version dir found: " << version.GetString(); |
| 596 } | 597 } |
| 597 } | 598 } |
| 598 | 599 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 // Critical update newer than the new version. | 749 // Critical update newer than the new version. |
| 749 EXPECT_FALSE( | 750 EXPECT_FALSE( |
| 750 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); | 751 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); |
| 751 EXPECT_FALSE( | 752 EXPECT_FALSE( |
| 752 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) | 753 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) |
| 753 .IsValid()); | 754 .IsValid()); |
| 754 EXPECT_FALSE( | 755 EXPECT_FALSE( |
| 755 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) | 756 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) |
| 756 .IsValid()); | 757 .IsValid()); |
| 757 } | 758 } |
| OLD | NEW |