summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/fake_product_state.h
blob: 8b6e866fb3c0b9eda4d9b593a7afc22789e674ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_INSTALLER_UTIL_FAKE_PRODUCT_STATE_H_
#define CHROME_INSTALLER_UTIL_FAKE_PRODUCT_STATE_H_

#include <string>
#include "chrome/installer/util/installation_state.h"

namespace installer {

// A ProductState helper for use by unit tests.
class FakeProductState : public ProductState {
 public:
  // Takes ownership of |version|.
  void set_version(Version* version) { version_.reset(version); }
  void set_multi_install(bool multi) { multi_install_ = multi; }
  void set_brand(const std::wstring& brand) { brand_ = brand; }
  void set_usagestats(DWORD usagestats) {
    has_usagestats_ = true;
    usagestats_ = usagestats;
  }
  void clear_usagestats() { has_usagestats_ = false; }
  void SetUninstallProgram(const base::FilePath& setup_exe) {
    uninstall_command_ = base::CommandLine(setup_exe);
  }
  void AddUninstallSwitch(const std::string& option) {
    uninstall_command_.AppendSwitch(option);
  }
};

}  // namespace installer

#endif  // CHROME_INSTALLER_UTIL_FAKE_PRODUCT_STATE_H_