| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 policy_map_.Clear(); | 99 policy_map_.Clear(); |
| 100 policy_statistics_collector_.reset(new TestPolicyStatisticsCollector( | 100 policy_statistics_collector_.reset(new TestPolicyStatisticsCollector( |
| 101 policy_details_.GetCallback(), | 101 policy_details_.GetCallback(), |
| 102 chrome_schema_, | 102 chrome_schema_, |
| 103 &policy_service_, | 103 &policy_service_, |
| 104 &prefs_, | 104 &prefs_, |
| 105 task_runner_)); | 105 task_runner_)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void SetPolicy(const std::string& name) { | 108 void SetPolicy(const std::string& name) { |
| 109 policy_map_.Set(name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 109 policy_map_.Set(name, |
| 110 base::Value::CreateBooleanValue(true), NULL); | 110 POLICY_LEVEL_MANDATORY, |
| 111 POLICY_SCOPE_USER, |
| 112 new base::FundamentalValue(true), |
| 113 NULL); |
| 111 } | 114 } |
| 112 | 115 |
| 113 base::TimeDelta GetFirstDelay() const { | 116 base::TimeDelta GetFirstDelay() const { |
| 114 if (task_runner_->GetPendingTasks().empty()) { | 117 if (task_runner_->GetPendingTasks().empty()) { |
| 115 ADD_FAILURE(); | 118 ADD_FAILURE(); |
| 116 return base::TimeDelta(); | 119 return base::TimeDelta(); |
| 117 } | 120 } |
| 118 return task_runner_->GetPendingTasks().front().delay; | 121 return task_runner_->GetPendingTasks().front().delay; |
| 119 } | 122 } |
| 120 | 123 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 EXPECT_CALL(*policy_statistics_collector_.get(), | 185 EXPECT_CALL(*policy_statistics_collector_.get(), |
| 183 RecordPolicyUse(kTestPolicy1Id)); | 186 RecordPolicyUse(kTestPolicy1Id)); |
| 184 EXPECT_CALL(*policy_statistics_collector_.get(), | 187 EXPECT_CALL(*policy_statistics_collector_.get(), |
| 185 RecordPolicyUse(kTestPolicy2Id)); | 188 RecordPolicyUse(kTestPolicy2Id)); |
| 186 | 189 |
| 187 policy_statistics_collector_->Initialize(); | 190 policy_statistics_collector_->Initialize(); |
| 188 EXPECT_EQ(1u, task_runner_->GetPendingTasks().size()); | 191 EXPECT_EQ(1u, task_runner_->GetPendingTasks().size()); |
| 189 } | 192 } |
| 190 | 193 |
| 191 } // namespace policy | 194 } // namespace policy |
| OLD | NEW |