OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "components/policy/core/common/policy_statistics_collector.h" | 5 #include "components/policy/core/common/policy_statistics_collector.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 policy_map_.Clear(); | 100 policy_map_.Clear(); |
101 policy_statistics_collector_.reset(new TestPolicyStatisticsCollector( | 101 policy_statistics_collector_.reset(new TestPolicyStatisticsCollector( |
102 policy_details_.GetCallback(), | 102 policy_details_.GetCallback(), |
103 chrome_schema_, | 103 chrome_schema_, |
104 &policy_service_, | 104 &policy_service_, |
105 &prefs_, | 105 &prefs_, |
106 task_runner_)); | 106 task_runner_)); |
107 } | 107 } |
108 | 108 |
109 void SetPolicy(const std::string& name) { | 109 void SetPolicy(const std::string& name) { |
110 policy_map_.Set(name, | 110 policy_map_.Set( |
111 POLICY_LEVEL_MANDATORY, | 111 name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
112 POLICY_SCOPE_USER, | 112 base::WrapUnique(new base::FundamentalValue(true)), nullptr); |
113 POLICY_SOURCE_CLOUD, | |
114 new base::FundamentalValue(true), | |
115 NULL); | |
116 } | 113 } |
117 | 114 |
118 base::TimeDelta GetFirstDelay() const { | 115 base::TimeDelta GetFirstDelay() const { |
119 if (task_runner_->GetPendingTasks().empty()) { | 116 if (task_runner_->GetPendingTasks().empty()) { |
120 ADD_FAILURE(); | 117 ADD_FAILURE(); |
121 return base::TimeDelta(); | 118 return base::TimeDelta(); |
122 } | 119 } |
123 return task_runner_->GetPendingTasks().front().delay; | 120 return task_runner_->GetPendingTasks().front().delay; |
124 } | 121 } |
125 | 122 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 EXPECT_CALL(*policy_statistics_collector_.get(), | 184 EXPECT_CALL(*policy_statistics_collector_.get(), |
188 RecordPolicyUse(kTestPolicy1Id)); | 185 RecordPolicyUse(kTestPolicy1Id)); |
189 EXPECT_CALL(*policy_statistics_collector_.get(), | 186 EXPECT_CALL(*policy_statistics_collector_.get(), |
190 RecordPolicyUse(kTestPolicy2Id)); | 187 RecordPolicyUse(kTestPolicy2Id)); |
191 | 188 |
192 policy_statistics_collector_->Initialize(); | 189 policy_statistics_collector_->Initialize(); |
193 EXPECT_EQ(1u, task_runner_->GetPendingTasks().size()); | 190 EXPECT_EQ(1u, task_runner_->GetPendingTasks().size()); |
194 } | 191 } |
195 | 192 |
196 } // namespace policy | 193 } // namespace policy |
OLD | NEW |