alternate_version_generator.h revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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.
4//
5// This file exposes the public interface to the mini_installer re-versioner.
6
7#ifndef CHROME_INSTALLER_TEST_ALTERNATE_VERSION_GENERATOR_H_
8#define CHROME_INSTALLER_TEST_ALTERNATE_VERSION_GENERATOR_H_
9
10#include <string>
11
12class Version;
13
14namespace base {
15class FilePath;
16}
17
18namespace upgrade_test {
19
20enum Direction {
21  PREVIOUS_VERSION,
22  NEXT_VERSION
23};
24
25// Generates an alternate mini_installer.exe using the one indicated by
26// |original_installer_path|, giving the new one a lower or higher version than
27// the original and placing it in |target_path|.  Any previous file at
28// |target_path| is clobbered.  Returns true on success.  |original_version| and
29// |new_version|, when non-NULL, are given the original and new version numbers
30// on success.
31bool GenerateAlternateVersion(const base::FilePath& original_installer_path,
32                              const base::FilePath& target_path,
33                              Direction direction,
34                              std::wstring* original_version,
35                              std::wstring* new_version);
36
37// Given a path to a PEImage in |original_file|, copy that file to
38// |target_file|, modifying the version of the copy according to |direction|.
39// Any previous file at |target_file| is clobbered. Returns true on success.
40// Note that |target_file| may still be mutated on failure.
41bool GenerateAlternatePEFileVersion(const base::FilePath& original_file,
42                                    const base::FilePath& target_file,
43                                    Direction direction);
44
45// Given a path to a PEImage in |original_file|, copy that file to
46// |target_file|, modifying the version of the copy according to |version|.
47// Any previous file at |target_file| is clobbered. Returns true on success.
48// Note that |target_file| may still be mutated on failure.
49bool GenerateSpecificPEFileVersion(const base::FilePath& original_file,
50                                   const base::FilePath& target_file,
51                                   const Version& version);
52
53}  // namespace upgrade_test
54
55#endif  // CHROME_INSTALLER_TEST_ALTERNATE_VERSION_GENERATOR_H_
56