Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_core_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/cloud_policy_core.h" 5 #include "chrome/browser/policy/cloud/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 "base/prefs/testing_pref_service.h" 9 #include "base/prefs/testing_pref_service.h"
10 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 10 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
11 #include "chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h" 11 #include "chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h"
12 #include "chrome/browser/policy/cloud/mock_cloud_policy_client.h" 12 #include "chrome/browser/policy/cloud/mock_cloud_policy_client.h"
13 #include "chrome/browser/policy/cloud/mock_cloud_policy_store.h" 13 #include "chrome/browser/policy/cloud/mock_cloud_policy_store.h"
14 #include "chrome/browser/prefs/browser_prefs.h" 14 #include "chrome/browser/prefs/browser_prefs.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace policy { 18 namespace policy {
19 19
20 class CloudPolicyCoreTest : public testing::Test { 20 class CloudPolicyCoreTest : public testing::Test {
21 protected: 21 protected:
22 CloudPolicyCoreTest() 22 CloudPolicyCoreTest()
23 : core_(PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, 23 : core_(PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType,
24 std::string()), 24 std::string()),
25 &store_) { 25 &store_) {
26 chrome::RegisterLocalState(prefs_.registry()); 26 chrome::RegisterLocalState(prefs_.registry());
27 } 27 }
28 28
29 MessageLoop loop_; 29 base::MessageLoop loop_;
30 30
31 TestingPrefServiceSimple prefs_; 31 TestingPrefServiceSimple prefs_;
32 MockCloudPolicyStore store_; 32 MockCloudPolicyStore store_;
33 CloudPolicyCore core_; 33 CloudPolicyCore core_;
34 34
35 private: 35 private:
36 DISALLOW_COPY_AND_ASSIGN(CloudPolicyCoreTest); 36 DISALLOW_COPY_AND_ASSIGN(CloudPolicyCoreTest);
37 }; 37 };
38 38
39 TEST_F(CloudPolicyCoreTest, ConnectAndDisconnect) { 39 TEST_F(CloudPolicyCoreTest, ConnectAndDisconnect) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const int kRefreshRate = 1000 * 60 * 60; 72 const int kRefreshRate = 1000 * 60 * 60;
73 prefs_.SetInteger(prefs::kUserPolicyRefreshRate, kRefreshRate); 73 prefs_.SetInteger(prefs::kUserPolicyRefreshRate, kRefreshRate);
74 core_.TrackRefreshDelayPref(&prefs_, prefs::kUserPolicyRefreshRate); 74 core_.TrackRefreshDelayPref(&prefs_, prefs::kUserPolicyRefreshRate);
75 EXPECT_EQ(kRefreshRate, core_.refresh_scheduler()->refresh_delay()); 75 EXPECT_EQ(kRefreshRate, core_.refresh_scheduler()->refresh_delay());
76 76
77 prefs_.ClearPref(prefs::kUserPolicyRefreshRate); 77 prefs_.ClearPref(prefs::kUserPolicyRefreshRate);
78 EXPECT_EQ(default_refresh_delay, core_.refresh_scheduler()->refresh_delay()); 78 EXPECT_EQ(default_refresh_delay, core_.refresh_scheduler()->refresh_delay());
79 } 79 }
80 80
81 } // namespace policy 81 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_core.cc ('k') | chrome/browser/policy/cloud/cloud_policy_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698