Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMEOS_SYSTEM_FAKE_STATISTICS_PROVIDER_H_ | 5 #ifndef CHROMEOS_SYSTEM_FAKE_STATISTICS_PROVIDER_H_ |
| 6 #define CHROMEOS_SYSTEM_FAKE_STATISTICS_PROVIDER_H_ | 6 #define CHROMEOS_SYSTEM_FAKE_STATISTICS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 ~FakeStatisticsProvider() override; | 21 ~FakeStatisticsProvider() override; |
| 22 | 22 |
| 23 // StatisticsProvider implementation: | 23 // StatisticsProvider implementation: |
| 24 void StartLoadingMachineStatistics( | 24 void StartLoadingMachineStatistics( |
| 25 const scoped_refptr<base::TaskRunner>& file_task_runner, | 25 const scoped_refptr<base::TaskRunner>& file_task_runner, |
| 26 bool load_oem_manifest) override; | 26 bool load_oem_manifest) override; |
| 27 bool GetMachineStatistic(const std::string& name, | 27 bool GetMachineStatistic(const std::string& name, |
| 28 std::string* result) override; | 28 std::string* result) override; |
| 29 bool GetMachineFlag(const std::string& name, bool* result) override; | 29 bool GetMachineFlag(const std::string& name, bool* result) override; |
| 30 void Shutdown() override; | 30 void Shutdown() override; |
| 31 bool IsRunningOnVm() override; | |
|
achuithb
2016/08/10 18:24:58
Feels like this should be const, but I guess GetMa
norvez
2016/08/11 17:10:34
Yes, we have to const-ify all the way down :-(
| |
| 31 | 32 |
| 32 void SetMachineStatistic(const std::string& key, const std::string& value); | 33 void SetMachineStatistic(const std::string& key, const std::string& value); |
| 33 void ClearMachineStatistic(const std::string& key); | 34 void ClearMachineStatistic(const std::string& key); |
| 34 void SetMachineFlag(const std::string& key, bool value); | 35 void SetMachineFlag(const std::string& key, bool value); |
| 35 void ClearMachineFlag(const std::string& key); | 36 void ClearMachineFlag(const std::string& key); |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 std::map<std::string, std::string> machine_statistics_; | 39 std::map<std::string, std::string> machine_statistics_; |
| 39 std::map<std::string, bool> machine_flags_; | 40 std::map<std::string, bool> machine_flags_; |
| 40 | 41 |
| 41 DISALLOW_COPY_AND_ASSIGN(FakeStatisticsProvider); | 42 DISALLOW_COPY_AND_ASSIGN(FakeStatisticsProvider); |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 // A convenience subclass that automatically registers itself as the test | 45 // A convenience subclass that automatically registers itself as the test |
| 45 // StatisticsProvider during construction and cleans up at destruction. | 46 // StatisticsProvider during construction and cleans up at destruction. |
| 46 class ScopedFakeStatisticsProvider : public FakeStatisticsProvider { | 47 class ScopedFakeStatisticsProvider : public FakeStatisticsProvider { |
| 47 public: | 48 public: |
| 48 ScopedFakeStatisticsProvider(); | 49 ScopedFakeStatisticsProvider(); |
| 49 ~ScopedFakeStatisticsProvider() override; | 50 ~ScopedFakeStatisticsProvider() override; |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(ScopedFakeStatisticsProvider); | 53 DISALLOW_COPY_AND_ASSIGN(ScopedFakeStatisticsProvider); |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 } // namespace system | 56 } // namespace system |
| 56 } // namespace chromeos | 57 } // namespace chromeos |
| 57 | 58 |
| 58 #endif // CHROMEOS_SYSTEM_FAKE_STATISTICS_PROVIDER_H_ | 59 #endif // CHROMEOS_SYSTEM_FAKE_STATISTICS_PROVIDER_H_ |
| OLD | NEW |