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/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } // namespace | 70 } // namespace |
71 | 71 |
72 class PolicyStatisticsCollectorTest : public testing::Test { | 72 class PolicyStatisticsCollectorTest : public testing::Test { |
73 protected: | 73 protected: |
74 PolicyStatisticsCollectorTest() | 74 PolicyStatisticsCollectorTest() |
75 : update_delay_(base::TimeDelta::FromMilliseconds( | 75 : update_delay_(base::TimeDelta::FromMilliseconds( |
76 PolicyStatisticsCollector::kStatisticsUpdateRate)), | 76 PolicyStatisticsCollector::kStatisticsUpdateRate)), |
77 task_runner_(new base::TestSimpleTaskRunner()) { | 77 task_runner_(new base::TestSimpleTaskRunner()) { |
78 } | 78 } |
79 | 79 |
80 virtual void SetUp() override { | 80 void SetUp() override { |
81 std::string error; | 81 std::string error; |
82 chrome_schema_ = Schema::Parse(kTestChromeSchema, &error); | 82 chrome_schema_ = Schema::Parse(kTestChromeSchema, &error); |
83 ASSERT_TRUE(chrome_schema_.valid()) << error; | 83 ASSERT_TRUE(chrome_schema_.valid()) << error; |
84 | 84 |
85 policy_details_.SetDetails(kTestPolicy1, &kTestPolicyDetails[0]); | 85 policy_details_.SetDetails(kTestPolicy1, &kTestPolicyDetails[0]); |
86 policy_details_.SetDetails(kTestPolicy2, &kTestPolicyDetails[1]); | 86 policy_details_.SetDetails(kTestPolicy2, &kTestPolicyDetails[1]); |
87 | 87 |
88 prefs_.registry()->RegisterInt64Pref( | 88 prefs_.registry()->RegisterInt64Pref( |
89 policy_prefs::kLastPolicyStatisticsUpdate, 0); | 89 policy_prefs::kLastPolicyStatisticsUpdate, 0); |
90 | 90 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 EXPECT_CALL(*policy_statistics_collector_.get(), | 185 EXPECT_CALL(*policy_statistics_collector_.get(), |
186 RecordPolicyUse(kTestPolicy1Id)); | 186 RecordPolicyUse(kTestPolicy1Id)); |
187 EXPECT_CALL(*policy_statistics_collector_.get(), | 187 EXPECT_CALL(*policy_statistics_collector_.get(), |
188 RecordPolicyUse(kTestPolicy2Id)); | 188 RecordPolicyUse(kTestPolicy2Id)); |
189 | 189 |
190 policy_statistics_collector_->Initialize(); | 190 policy_statistics_collector_->Initialize(); |
191 EXPECT_EQ(1u, task_runner_->GetPendingTasks().size()); | 191 EXPECT_EQ(1u, task_runner_->GetPendingTasks().size()); |
192 } | 192 } |
193 | 193 |
194 } // namespace policy | 194 } // namespace policy |
OLD | NEW |