| 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" | |
| 9 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
| 10 #include "base/prefs/testing_pref_service.h" | 9 #include "base/prefs/testing_pref_service.h" |
| 11 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 10 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 12 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" | 11 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" |
| 13 #include "components/policy/core/common/cloud/mock_cloud_policy_client.h" | 12 #include "components/policy/core/common/cloud/mock_cloud_policy_client.h" |
| 14 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" | 13 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" |
| 15 #include "components/policy/core/common/policy_pref_names.h" | 14 #include "components/policy/core/common/policy_pref_names.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 16 |
| 18 namespace policy { | 17 namespace policy { |
| 19 | 18 |
| 20 class CloudPolicyCoreTest : public testing::Test, | 19 class CloudPolicyCoreTest : public testing::Test, |
| 21 public CloudPolicyCore::Observer { | 20 public CloudPolicyCore::Observer { |
| 22 protected: | 21 protected: |
| 23 CloudPolicyCoreTest() | 22 CloudPolicyCoreTest() |
| 24 : core_(dm_protocol::kChromeUserPolicyType, | 23 : core_(dm_protocol::kChromeUserPolicyType, |
| 25 std::string(), | 24 std::string(), |
| 26 &store_, | 25 &store_, |
| 27 loop_.message_loop_proxy()), | 26 loop_.task_runner()), |
| 28 core_connected_callback_count_(0), | 27 core_connected_callback_count_(0), |
| 29 refresh_scheduler_started_callback_count_(0), | 28 refresh_scheduler_started_callback_count_(0), |
| 30 core_disconnecting_callback_count_(0), | 29 core_disconnecting_callback_count_(0), |
| 31 bad_callback_count_(0) { | 30 bad_callback_count_(0) { |
| 32 prefs_.registry()->RegisterIntegerPref( | 31 prefs_.registry()->RegisterIntegerPref( |
| 33 policy_prefs::kUserPolicyRefreshRate, | 32 policy_prefs::kUserPolicyRefreshRate, |
| 34 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); | 33 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); |
| 35 core_.AddObserver(this); | 34 core_.AddObserver(this); |
| 36 } | 35 } |
| 37 | 36 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 prefs_.ClearPref(policy_prefs::kUserPolicyRefreshRate); | 126 prefs_.ClearPref(policy_prefs::kUserPolicyRefreshRate); |
| 128 EXPECT_EQ(default_refresh_delay, core_.refresh_scheduler()->refresh_delay()); | 127 EXPECT_EQ(default_refresh_delay, core_.refresh_scheduler()->refresh_delay()); |
| 129 | 128 |
| 130 EXPECT_EQ(1, core_connected_callback_count_); | 129 EXPECT_EQ(1, core_connected_callback_count_); |
| 131 EXPECT_EQ(1, refresh_scheduler_started_callback_count_); | 130 EXPECT_EQ(1, refresh_scheduler_started_callback_count_); |
| 132 EXPECT_EQ(0, core_disconnecting_callback_count_); | 131 EXPECT_EQ(0, core_disconnecting_callback_count_); |
| 133 EXPECT_EQ(0, bad_callback_count_); | 132 EXPECT_EQ(0, bad_callback_count_); |
| 134 } | 133 } |
| 135 | 134 |
| 136 } // namespace policy | 135 } // namespace policy |
| OLD | NEW |