Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / installer / test / upgrade_test.cc
blobb5995216129acebab90b38d3ce7f65875ee8faea
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Boilerplate for an upgrade scenario test. The mini_installer.exe residing in
6 // the same directory as the host executable is re-versioned.
8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h"
10 #include "base/path_service.h"
11 #include "chrome/installer/test/alternate_version_generator.h"
12 #include "testing/gtest/include/gtest/gtest.h"
14 namespace {
15 const wchar_t kMiniInstallerExe[] = L"mini_installer.exe";
16 } // namespace
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() {
23 base::FilePath dir_exe;
24 ASSERT_TRUE(PathService::Get(base::DIR_EXE, &dir_exe));
25 ASSERT_TRUE(base::CreateTemporaryFile(&next_mini_installer_path_));
26 ASSERT_TRUE(
27 upgrade_test::GenerateAlternateVersion(
28 dir_exe.Append(&kMiniInstallerExe[0]),
29 next_mini_installer_path_,
30 upgrade_test::NEXT_VERSION, NULL, NULL));
33 // Clean up by deleting the created newer version of mini_installer.exe.
34 static void TearDownTestCase() {
35 EXPECT_TRUE(base::DeleteFile(next_mini_installer_path_, false));
37 private:
38 static base::FilePath next_mini_installer_path_;
39 }; // class UpgradeTest
41 base::FilePath UpgradeTest::next_mini_installer_path_;
43 TEST_F(UpgradeTest, DoNothing) {