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/installer_state.h" | 5 #include "chrome/installer/util/installer_state.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <fstream> | 10 #include <fstream> |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 new Version(chrome::kChromeVersion)); | 469 new Version(chrome::kChromeVersion)); |
470 | 470 |
471 // Now we're invoked to install multi Chrome. | 471 // Now we're invoked to install multi Chrome. |
472 base::CommandLine cmd_line( | 472 base::CommandLine cmd_line( |
473 base::CommandLine::FromString(L"setup.exe --multi-install --chrome")); | 473 base::CommandLine::FromString(L"setup.exe --multi-install --chrome")); |
474 MasterPreferences prefs(cmd_line); | 474 MasterPreferences prefs(cmd_line); |
475 InstallerState installer_state; | 475 InstallerState installer_state; |
476 installer_state.Initialize(cmd_line, prefs, machine_state); | 476 installer_state.Initialize(cmd_line, prefs, machine_state); |
477 | 477 |
478 // Is the Chrome version picked up? | 478 // Is the Chrome version picked up? |
479 scoped_ptr<Version> version(installer_state.GetCurrentVersion(machine_state)); | 479 std::unique_ptr<Version> version( |
| 480 installer_state.GetCurrentVersion(machine_state)); |
480 EXPECT_TRUE(version.get() != NULL); | 481 EXPECT_TRUE(version.get() != NULL); |
481 } | 482 } |
482 | 483 |
483 TEST_F(InstallerStateTest, IsFileInUse) { | 484 TEST_F(InstallerStateTest, IsFileInUse) { |
484 base::ScopedTempDir temp_dir; | 485 base::ScopedTempDir temp_dir; |
485 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 486 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
486 | 487 |
487 base::FilePath temp_file; | 488 base::FilePath temp_file; |
488 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &temp_file)); | 489 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &temp_file)); |
489 | 490 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 return installer_state_; | 723 return installer_state_; |
723 } | 724 } |
724 | 725 |
725 static Version* low_version_; | 726 static Version* low_version_; |
726 static Version* opv_version_; | 727 static Version* opv_version_; |
727 static Version* middle_version_; | 728 static Version* middle_version_; |
728 static Version* pv_version_; | 729 static Version* pv_version_; |
729 static Version* high_version_; | 730 static Version* high_version_; |
730 | 731 |
731 base::CommandLine cmd_line_; | 732 base::CommandLine cmd_line_; |
732 scoped_ptr<MasterPreferences> prefs_; | 733 std::unique_ptr<MasterPreferences> prefs_; |
733 InstallationState machine_state_; | 734 InstallationState machine_state_; |
734 MockInstallerState installer_state_; | 735 MockInstallerState installer_state_; |
735 }; | 736 }; |
736 | 737 |
737 Version* InstallerStateCriticalVersionTest::low_version_ = NULL; | 738 Version* InstallerStateCriticalVersionTest::low_version_ = NULL; |
738 Version* InstallerStateCriticalVersionTest::opv_version_ = NULL; | 739 Version* InstallerStateCriticalVersionTest::opv_version_ = NULL; |
739 Version* InstallerStateCriticalVersionTest::middle_version_ = NULL; | 740 Version* InstallerStateCriticalVersionTest::middle_version_ = NULL; |
740 Version* InstallerStateCriticalVersionTest::pv_version_ = NULL; | 741 Version* InstallerStateCriticalVersionTest::pv_version_ = NULL; |
741 Version* InstallerStateCriticalVersionTest::high_version_ = NULL; | 742 Version* InstallerStateCriticalVersionTest::high_version_ = NULL; |
742 | 743 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 // Critical update newer than the new version. | 826 // Critical update newer than the new version. |
826 EXPECT_FALSE( | 827 EXPECT_FALSE( |
827 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); | 828 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); |
828 EXPECT_FALSE( | 829 EXPECT_FALSE( |
829 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) | 830 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) |
830 .IsValid()); | 831 .IsValid()); |
831 EXPECT_FALSE( | 832 EXPECT_FALSE( |
832 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) | 833 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) |
833 .IsValid()); | 834 .IsValid()); |
834 } | 835 } |
OLD | NEW |