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