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 <cstring> | 5 #include <cstring> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 protected: | 53 protected: |
54 PolicyStatisticsCollectorTest() | 54 PolicyStatisticsCollectorTest() |
55 : update_delay_(base::TimeDelta::FromMilliseconds( | 55 : update_delay_(base::TimeDelta::FromMilliseconds( |
56 PolicyStatisticsCollector::kStatisticsUpdateRate)), | 56 PolicyStatisticsCollector::kStatisticsUpdateRate)), |
57 test_policy_id1_(-1), | 57 test_policy_id1_(-1), |
58 test_policy_id2_(-1), | 58 test_policy_id2_(-1), |
59 task_runner_(new base::TestSimpleTaskRunner()) { | 59 task_runner_(new base::TestSimpleTaskRunner()) { |
60 } | 60 } |
61 | 61 |
62 virtual void SetUp() OVERRIDE { | 62 virtual void SetUp() OVERRIDE { |
63 chrome::RegisterLocalState(&prefs_); | 63 chrome::RegisterLocalState(prefs_.registry(), &prefs_); |
64 | 64 |
65 // Find ids for kTestPolicy1 and kTestPolicy2. | 65 // Find ids for kTestPolicy1 and kTestPolicy2. |
66 const policy::PolicyDefinitionList* policy_list = | 66 const policy::PolicyDefinitionList* policy_list = |
67 policy::GetChromePolicyDefinitionList(); | 67 policy::GetChromePolicyDefinitionList(); |
68 for (const policy::PolicyDefinitionList::Entry* policy = policy_list->begin; | 68 for (const policy::PolicyDefinitionList::Entry* policy = policy_list->begin; |
69 policy != policy_list->end; ++policy) { | 69 policy != policy_list->end; ++policy) { |
70 if (strcmp(policy->name, kTestPolicy1) == 0) | 70 if (strcmp(policy->name, kTestPolicy1) == 0) |
71 test_policy_id1_ = policy->id; | 71 test_policy_id1_ = policy->id; |
72 else if (strcmp(policy->name, kTestPolicy2) == 0) | 72 else if (strcmp(policy->name, kTestPolicy2) == 0) |
73 test_policy_id2_ = policy->id; | 73 test_policy_id2_ = policy->id; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 EXPECT_CALL(*policy_statistics_collector_.get(), | 167 EXPECT_CALL(*policy_statistics_collector_.get(), |
168 RecordPolicyUse(test_policy_id1_)); | 168 RecordPolicyUse(test_policy_id1_)); |
169 EXPECT_CALL(*policy_statistics_collector_.get(), | 169 EXPECT_CALL(*policy_statistics_collector_.get(), |
170 RecordPolicyUse(test_policy_id2_)); | 170 RecordPolicyUse(test_policy_id2_)); |
171 | 171 |
172 policy_statistics_collector_->Initialize(); | 172 policy_statistics_collector_->Initialize(); |
173 EXPECT_EQ(1u, task_runner_->GetPendingTasks().size()); | 173 EXPECT_EQ(1u, task_runner_->GetPendingTasks().size()); |
174 } | 174 } |
175 | 175 |
176 } // namespace policy | 176 } // namespace policy |
OLD | NEW |