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/cloud/cloud_policy_core.h" | 5 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 core_connected_callback_count_(0), | 28 core_connected_callback_count_(0), |
29 refresh_scheduler_started_callback_count_(0), | 29 refresh_scheduler_started_callback_count_(0), |
30 core_disconnecting_callback_count_(0), | 30 core_disconnecting_callback_count_(0), |
31 bad_callback_count_(0) { | 31 bad_callback_count_(0) { |
32 prefs_.registry()->RegisterIntegerPref( | 32 prefs_.registry()->RegisterIntegerPref( |
33 policy_prefs::kUserPolicyRefreshRate, | 33 policy_prefs::kUserPolicyRefreshRate, |
34 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); | 34 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); |
35 core_.AddObserver(this); | 35 core_.AddObserver(this); |
36 } | 36 } |
37 | 37 |
38 virtual ~CloudPolicyCoreTest() { | 38 ~CloudPolicyCoreTest() override { core_.RemoveObserver(this); } |
39 core_.RemoveObserver(this); | |
40 } | |
41 | 39 |
42 void OnCoreConnected(CloudPolicyCore* core) override { | 40 void OnCoreConnected(CloudPolicyCore* core) override { |
43 // Make sure core is connected at callback time. | 41 // Make sure core is connected at callback time. |
44 if (core_.client()) | 42 if (core_.client()) |
45 core_connected_callback_count_++; | 43 core_connected_callback_count_++; |
46 else | 44 else |
47 bad_callback_count_++; | 45 bad_callback_count_++; |
48 } | 46 } |
49 | 47 |
50 void OnRefreshSchedulerStarted(CloudPolicyCore* core) override { | 48 void OnRefreshSchedulerStarted(CloudPolicyCore* core) override { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 prefs_.ClearPref(policy_prefs::kUserPolicyRefreshRate); | 127 prefs_.ClearPref(policy_prefs::kUserPolicyRefreshRate); |
130 EXPECT_EQ(default_refresh_delay, core_.refresh_scheduler()->refresh_delay()); | 128 EXPECT_EQ(default_refresh_delay, core_.refresh_scheduler()->refresh_delay()); |
131 | 129 |
132 EXPECT_EQ(1, core_connected_callback_count_); | 130 EXPECT_EQ(1, core_connected_callback_count_); |
133 EXPECT_EQ(1, refresh_scheduler_started_callback_count_); | 131 EXPECT_EQ(1, refresh_scheduler_started_callback_count_); |
134 EXPECT_EQ(0, core_disconnecting_callback_count_); | 132 EXPECT_EQ(0, core_disconnecting_callback_count_); |
135 EXPECT_EQ(0, bad_callback_count_); | 133 EXPECT_EQ(0, bad_callback_count_); |
136 } | 134 } |
137 | 135 |
138 } // namespace policy | 136 } // namespace policy |
OLD | NEW |