Alex Deymo | 4243291 | 2013-07-12 20:21:15 -0700 | [diff] [blame^] | 1 | // Copyright (c) 2013 The Chromium OS 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_FAKE_HARDWARE_H__ |
| 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_FAKE_HARDWARE_H__ |
| 7 | |
| 8 | #include "update_engine/hardware_interface.h" |
| 9 | |
| 10 | #include "base/basictypes.h" |
| 11 | |
| 12 | #include <map> |
| 13 | |
| 14 | namespace chromeos_update_engine { |
| 15 | |
| 16 | // Implements a fake hardware interface used for testing. |
| 17 | class FakeHardware : public HardwareInterface { |
| 18 | public: |
| 19 | FakeHardware() {} |
| 20 | |
| 21 | // HardwareInterface methods. |
| 22 | virtual const std::string BootDevice() { return boot_device_; } |
| 23 | virtual const std::string KernelDeviceOfBootDevice( |
| 24 | const std::string& boot_device); |
| 25 | |
| 26 | // Setters |
| 27 | void SetBootDevice(const std::string boot_device) { |
| 28 | boot_device_ = boot_device; |
| 29 | } |
| 30 | void SetKernelDeviceOfBootDevice(const std::string& boot_device, |
| 31 | const std::string& kernel_device); |
| 32 | |
| 33 | private: |
| 34 | std::string boot_device_; |
| 35 | typedef std::map<std::string, std::string> KernelDevicesMap; |
| 36 | KernelDevicesMap kernel_devices_; |
| 37 | |
| 38 | DISALLOW_COPY_AND_ASSIGN(FakeHardware); |
| 39 | }; |
| 40 | |
| 41 | } // namespace chromeos_update_engine |
| 42 | |
| 43 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_FAKE_HARDWARE_H__ |