| 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 "chrome/browser/policy/cloud_policy_core.h" | 5 #include "chrome/browser/policy/cloud_policy_core.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/policy/cloud_policy_refresh_scheduler.h" | 9 #include "chrome/browser/policy/cloud_policy_refresh_scheduler.h" |
| 10 #include "chrome/browser/policy/mock_cloud_policy_client.h" | 10 #include "chrome/browser/policy/mock_cloud_policy_client.h" |
| 11 #include "chrome/browser/policy/mock_cloud_policy_store.h" | 11 #include "chrome/browser/policy/mock_cloud_policy_store.h" |
| 12 #include "chrome/browser/prefs/browser_prefs.h" | 12 #include "chrome/browser/prefs/browser_prefs.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/test/base/testing_pref_service.h" | 14 #include "chrome/test/base/testing_pref_service.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 namespace policy { | 17 namespace policy { |
| 18 | 18 |
| 19 class CloudPolicyCoreTest : public testing::Test { | 19 class CloudPolicyCoreTest : public testing::Test { |
| 20 protected: | 20 protected: |
| 21 CloudPolicyCoreTest() | 21 CloudPolicyCoreTest() |
| 22 : core_(&store_) { | 22 : core_(&store_) { |
| 23 chrome::RegisterLocalState(&prefs_); | 23 chrome::RegisterLocalState(&prefs_); |
| 24 } | 24 } |
| 25 | 25 |
| 26 MessageLoop loop_; | 26 MessageLoop loop_; |
| 27 | 27 |
| 28 TestingPrefService prefs_; | 28 TestingPrefServiceSimple prefs_; |
| 29 MockCloudPolicyStore store_; | 29 MockCloudPolicyStore store_; |
| 30 CloudPolicyCore core_; | 30 CloudPolicyCore core_; |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 DISALLOW_COPY_AND_ASSIGN(CloudPolicyCoreTest); | 33 DISALLOW_COPY_AND_ASSIGN(CloudPolicyCoreTest); |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 TEST_F(CloudPolicyCoreTest, ConnectAndDisconnect) { | 36 TEST_F(CloudPolicyCoreTest, ConnectAndDisconnect) { |
| 37 EXPECT_TRUE(core_.store()); | 37 EXPECT_TRUE(core_.store()); |
| 38 EXPECT_FALSE(core_.client()); | 38 EXPECT_FALSE(core_.client()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 69 const int kRefreshRate = 1000 * 60 * 60; | 69 const int kRefreshRate = 1000 * 60 * 60; |
| 70 prefs_.SetInteger(prefs::kUserPolicyRefreshRate, kRefreshRate); | 70 prefs_.SetInteger(prefs::kUserPolicyRefreshRate, kRefreshRate); |
| 71 core_.TrackRefreshDelayPref(&prefs_, prefs::kUserPolicyRefreshRate); | 71 core_.TrackRefreshDelayPref(&prefs_, prefs::kUserPolicyRefreshRate); |
| 72 EXPECT_EQ(kRefreshRate, core_.refresh_scheduler()->refresh_delay()); | 72 EXPECT_EQ(kRefreshRate, core_.refresh_scheduler()->refresh_delay()); |
| 73 | 73 |
| 74 prefs_.ClearPref(prefs::kUserPolicyRefreshRate); | 74 prefs_.ClearPref(prefs::kUserPolicyRefreshRate); |
| 75 EXPECT_EQ(default_refresh_delay, core_.refresh_scheduler()->refresh_delay()); | 75 EXPECT_EQ(default_refresh_delay, core_.refresh_scheduler()->refresh_delay()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace policy | 78 } // namespace policy |
| OLD | NEW |