fake_product_state.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#ifndef CHROME_INSTALLER_UTIL_FAKE_PRODUCT_STATE_H_ 6#define CHROME_INSTALLER_UTIL_FAKE_PRODUCT_STATE_H_ 7 8#include <string> 9#include "chrome/installer/util/installation_state.h" 10 11namespace installer { 12 13// A ProductState helper for use by unit tests. 14class FakeProductState : public ProductState { 15 public: 16 // Takes ownership of |version|. 17 void set_version(Version* version) { version_.reset(version); } 18 void set_multi_install(bool multi) { multi_install_ = multi; } 19 void set_brand(const std::wstring& brand) { brand_ = brand; } 20 void set_usagestats(DWORD usagestats) { 21 has_usagestats_ = true; 22 usagestats_ = usagestats; 23 } 24 void clear_usagestats() { has_usagestats_ = false; } 25 void SetUninstallProgram(const base::FilePath& setup_exe) { 26 uninstall_command_ = CommandLine(setup_exe); 27 } 28 void AddUninstallSwitch(const std::string& option) { 29 uninstall_command_.AppendSwitch(option); 30 } 31}; 32 33} // namespace installer 34 35#endif // CHROME_INSTALLER_UTIL_FAKE_PRODUCT_STATE_H_ 36