cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chromeos / system / fake_statistics_provider.cc
blob0f264c47f3367b1f6c44196dddeba3d8d3b36a05
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
3 // found in the LICENSE file.
5 #include "chromeos/system/fake_statistics_provider.h"
7 namespace chromeos {
8 namespace system {
10 FakeStatisticsProvider::FakeStatisticsProvider() {
13 FakeStatisticsProvider::~FakeStatisticsProvider() {
16 void FakeStatisticsProvider::StartLoadingMachineStatistics(
17 const scoped_refptr<base::TaskRunner>& file_task_runner,
18 bool load_oem_manifest) {
21 bool FakeStatisticsProvider::GetMachineStatistic(const std::string& name,
22 std::string* result) {
23 std::map<std::string, std::string>::const_iterator match =
24 machine_statistics_.find(name);
25 if (match != machine_statistics_.end() && result)
26 *result = match->second;
27 return match != machine_statistics_.end();
30 bool FakeStatisticsProvider::HasMachineStatistic(const std::string& name) {
31 return machine_statistics_.find(name) != machine_statistics_.end();
34 bool FakeStatisticsProvider::GetMachineFlag(const std::string& name,
35 bool* result) {
36 std::map<std::string, bool>::const_iterator match = machine_flags_.find(name);
37 if (match != machine_flags_.end() && result)
38 *result = match->second;
39 return match != machine_flags_.end();
42 bool FakeStatisticsProvider::HasMachineFlag(const std::string& name) {
43 return machine_flags_.find(name) != machine_flags_.end();
46 void FakeStatisticsProvider::Shutdown() {
49 void FakeStatisticsProvider::SetMachineStatistic(const std::string& key,
50 const std::string& value) {
51 machine_statistics_[key] = value;
54 void FakeStatisticsProvider::ClearMachineStatistic(const std::string& key) {
55 machine_statistics_.erase(key);
58 void FakeStatisticsProvider::SetMachineFlag(const std::string& key,
59 bool value) {
60 machine_flags_[key] = value;
63 void FakeStatisticsProvider::ClearMachineFlag(const std::string& key) {
64 machine_flags_.erase(key);
67 ScopedFakeStatisticsProvider::ScopedFakeStatisticsProvider() {
68 StatisticsProvider::SetTestProvider(this);
71 ScopedFakeStatisticsProvider::~ScopedFakeStatisticsProvider() {
72 StatisticsProvider::SetTestProvider(NULL);
75 } // namespace system
76 } // namespace chromeos