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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 policy_map_.Set(name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 110 policy_map_.Set(name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
111 POLICY_SOURCE_CLOUD, | 111 POLICY_SOURCE_CLOUD, |
112 base::MakeUnique<base::FundamentalValue>(true), nullptr); | 112 base::MakeUnique<base::FundamentalValue>(true), nullptr); |
113 } | 113 } |
114 | 114 |
115 base::TimeDelta GetFirstDelay() const { | 115 base::TimeDelta GetFirstDelay() const { |
116 if (!task_runner_->HasPendingTask()) { | 116 if (!task_runner_->HasPendingTask()) { |
117 ADD_FAILURE(); | 117 ADD_FAILURE(); |
118 return base::TimeDelta(); | 118 return base::TimeDelta(); |
119 } | 119 } |
120 return task_runner_->GetPendingTasks().front().delay; | 120 return task_runner_->NextPendingTaskDelay(); |
121 } | 121 } |
122 | 122 |
123 const base::TimeDelta update_delay_; | 123 const base::TimeDelta update_delay_; |
124 | 124 |
125 base::TimeDelta last_delay_; | 125 base::TimeDelta last_delay_; |
126 | 126 |
127 PolicyDetailsMap policy_details_; | 127 PolicyDetailsMap policy_details_; |
128 Schema chrome_schema_; | 128 Schema chrome_schema_; |
129 TestingPrefServiceSimple prefs_; | 129 TestingPrefServiceSimple prefs_; |
130 MockPolicyService policy_service_; | 130 MockPolicyService policy_service_; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 EXPECT_CALL(*policy_statistics_collector_.get(), | 184 EXPECT_CALL(*policy_statistics_collector_.get(), |
185 RecordPolicyUse(kTestPolicy1Id)); | 185 RecordPolicyUse(kTestPolicy1Id)); |
186 EXPECT_CALL(*policy_statistics_collector_.get(), | 186 EXPECT_CALL(*policy_statistics_collector_.get(), |
187 RecordPolicyUse(kTestPolicy2Id)); | 187 RecordPolicyUse(kTestPolicy2Id)); |
188 | 188 |
189 policy_statistics_collector_->Initialize(); | 189 policy_statistics_collector_->Initialize(); |
190 EXPECT_EQ(1u, task_runner_->NumPendingTasks()); | 190 EXPECT_EQ(1u, task_runner_->NumPendingTasks()); |
191 } | 191 } |
192 | 192 |
193 } // namespace policy | 193 } // namespace policy |
OLD | NEW |