blob: 8514f514d6f4dff8fc439b6e27c68c53e5774f75 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2011 The Chromium Authors
[email protected]c744d292010-11-23 15:01:222// 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]57999812013-02-24 05:40:528#include "base/files/file_path.h"
thestigd19a1692e2014-08-23 22:18:539#include "base/files/file_util.h"
[email protected]c744d292010-11-23 15:01:2210#include "base/path_service.h"
11#include "chrome/installer/test/alternate_version_generator.h"
12#include "testing/gtest/include/gtest/gtest.h"
13
14namespace {
Brian Manthosb1d716f2020-06-08 03:40:4915const wchar_t kMiniInstallerExe[] = L"mini_installer.exe";
[email protected]c744d292010-11-23 15:01:2216} // namespace
17
18// Boilerplate for a future upgrade scenario test.
19class UpgradeTest : public testing::Test {
20 public:
21 // Generate a newer version of mini_installer.exe.
22 static void SetUpTestCase() {
[email protected]152ea302013-02-11 04:08:4023 base::FilePath dir_exe;
Avi Drissman7d43b4b2018-05-01 16:14:0624 ASSERT_TRUE(base::PathService::Get(base::DIR_EXE, &dir_exe));
[email protected]03d9afc02013-12-03 17:55:5225 ASSERT_TRUE(base::CreateTemporaryFile(&next_mini_installer_path_));
Brian Manthosd7f09f62020-05-29 22:19:2726 ASSERT_TRUE(upgrade_test::GenerateAlternateVersion(
27 dir_exe.Append(&kMiniInstallerExe[0]), next_mini_installer_path_,
28 upgrade_test::NEXT_VERSION, nullptr, nullptr));
[email protected]c744d292010-11-23 15:01:2229 }
30
31 // Clean up by deleting the created newer version of mini_installer.exe.
32 static void TearDownTestCase() {
Lei Zhang2504450e2020-07-10 22:10:5033 EXPECT_TRUE(base::DeleteFile(next_mini_installer_path_));
[email protected]c744d292010-11-23 15:01:2234 }
Brian Manthosb1d716f2020-06-08 03:40:4935
[email protected]c744d292010-11-23 15:01:2236 private:
[email protected]152ea302013-02-11 04:08:4037 static base::FilePath next_mini_installer_path_;
[email protected]c744d292010-11-23 15:01:2238}; // class UpgradeTest
39
[email protected]5257bcf2013-02-19 05:47:1040base::FilePath UpgradeTest::next_mini_installer_path_;
[email protected]c744d292010-11-23 15:01:2241
Brian Manthosb1d716f2020-06-08 03:40:4942TEST_F(UpgradeTest, DoNothing) {}