Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2011 The Chromium Authors |
[email protected] | c744d29 | 2010-11-23 15:01:22 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | // Boilerplate for an upgrade scenario test. The mini_installer.exe residing in | ||||
6 | // the same directory as the host executable is re-versioned. | ||||
7 | |||||
[email protected] | 5799981 | 2013-02-24 05:40:52 | [diff] [blame] | 8 | #include "base/files/file_path.h" |
thestig | d19a1692e | 2014-08-23 22:18:53 | [diff] [blame] | 9 | #include "base/files/file_util.h" |
[email protected] | c744d29 | 2010-11-23 15:01:22 | [diff] [blame] | 10 | #include "base/path_service.h" |
11 | #include "chrome/installer/test/alternate_version_generator.h" | ||||
12 | #include "testing/gtest/include/gtest/gtest.h" | ||||
13 | |||||
14 | namespace { | ||||
Brian Manthos | b1d716f | 2020-06-08 03:40:49 | [diff] [blame] | 15 | const wchar_t kMiniInstallerExe[] = L"mini_installer.exe"; |
[email protected] | c744d29 | 2010-11-23 15:01:22 | [diff] [blame] | 16 | } // namespace |
17 | |||||
18 | // Boilerplate for a future upgrade scenario test. | ||||
19 | class UpgradeTest : public testing::Test { | ||||
20 | public: | ||||
21 | // Generate a newer version of mini_installer.exe. | ||||
22 | static void SetUpTestCase() { | ||||
[email protected] | 152ea30 | 2013-02-11 04:08:40 | [diff] [blame] | 23 | base::FilePath dir_exe; |
Avi Drissman | 7d43b4b | 2018-05-01 16:14:06 | [diff] [blame] | 24 | ASSERT_TRUE(base::PathService::Get(base::DIR_EXE, &dir_exe)); |
[email protected] | 03d9afc0 | 2013-12-03 17:55:52 | [diff] [blame] | 25 | ASSERT_TRUE(base::CreateTemporaryFile(&next_mini_installer_path_)); |
Brian Manthos | d7f09f6 | 2020-05-29 22:19:27 | [diff] [blame] | 26 | ASSERT_TRUE(upgrade_test::GenerateAlternateVersion( |
27 | dir_exe.Append(&kMiniInstallerExe[0]), next_mini_installer_path_, | ||||
28 | upgrade_test::NEXT_VERSION, nullptr, nullptr)); | ||||
[email protected] | c744d29 | 2010-11-23 15:01:22 | [diff] [blame] | 29 | } |
30 | |||||
31 | // Clean up by deleting the created newer version of mini_installer.exe. | ||||
32 | static void TearDownTestCase() { | ||||
Lei Zhang | 2504450e | 2020-07-10 22:10:50 | [diff] [blame] | 33 | EXPECT_TRUE(base::DeleteFile(next_mini_installer_path_)); |
[email protected] | c744d29 | 2010-11-23 15:01:22 | [diff] [blame] | 34 | } |
Brian Manthos | b1d716f | 2020-06-08 03:40:49 | [diff] [blame] | 35 | |
[email protected] | c744d29 | 2010-11-23 15:01:22 | [diff] [blame] | 36 | private: |
[email protected] | 152ea30 | 2013-02-11 04:08:40 | [diff] [blame] | 37 | static base::FilePath next_mini_installer_path_; |
[email protected] | c744d29 | 2010-11-23 15:01:22 | [diff] [blame] | 38 | }; // class UpgradeTest |
39 | |||||
[email protected] | 5257bcf | 2013-02-19 05:47:10 | [diff] [blame] | 40 | base::FilePath UpgradeTest::next_mini_installer_path_; |
[email protected] | c744d29 | 2010-11-23 15:01:22 | [diff] [blame] | 41 | |
Brian Manthos | b1d716f | 2020-06-08 03:40:49 | [diff] [blame] | 42 | TEST_F(UpgradeTest, DoNothing) {} |