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/user_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/policy/user_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/policy/mock_cloud_policy_store.h" | 10 #include "chrome/browser/policy/mock_cloud_policy_store.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 void CreateManagerWithPendingFetch() { | 62 void CreateManagerWithPendingFetch() { |
63 store_ = new MockCloudPolicyStore(); | 63 store_ = new MockCloudPolicyStore(); |
64 manager_.reset( | 64 manager_.reset( |
65 new UserCloudPolicyManagerChromeOS(scoped_ptr<CloudPolicyStore>(store_), | 65 new UserCloudPolicyManagerChromeOS(scoped_ptr<CloudPolicyStore>(store_), |
66 true)); | 66 true)); |
67 manager_->Init(); | 67 manager_->Init(); |
68 manager_->AddObserver(&observer_); | 68 manager_->AddObserver(&observer_); |
69 manager_->Initialize(&prefs_, &device_management_service_, | 69 manager_->Connect(&prefs_, &device_management_service_, |
70 USER_AFFILIATION_NONE); | 70 USER_AFFILIATION_NONE); |
71 EXPECT_FALSE(manager_->IsInitializationComplete()); | 71 EXPECT_FALSE(manager_->IsInitializationComplete()); |
72 | 72 |
73 // Finishing the Load() operation shouldn't set the initialized flag. | 73 // Finishing the Load() operation shouldn't set the initialized flag. |
74 EXPECT_CALL(observer_, OnUpdatePolicy(_)).Times(0); | 74 EXPECT_CALL(observer_, OnUpdatePolicy(_)).Times(0); |
75 store_->NotifyStoreLoaded(); | 75 store_->NotifyStoreLoaded(); |
76 EXPECT_FALSE(manager_->IsInitializationComplete()); | 76 EXPECT_FALSE(manager_->IsInitializationComplete()); |
77 Mock::VerifyAndClearExpectations(&observer_); | 77 Mock::VerifyAndClearExpectations(&observer_); |
78 } | 78 } |
79 | 79 |
80 // Required by the refresh scheduler that's created by the manager. | 80 // Required by the refresh scheduler that's created by the manager. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 // Cancelling the initial fetch should flip the flag. | 152 // Cancelling the initial fetch should flip the flag. |
153 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); | 153 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); |
154 manager_->CancelWaitForPolicyFetch(); | 154 manager_->CancelWaitForPolicyFetch(); |
155 EXPECT_TRUE(manager_->IsInitializationComplete()); | 155 EXPECT_TRUE(manager_->IsInitializationComplete()); |
156 Mock::VerifyAndClearExpectations(&observer_); | 156 Mock::VerifyAndClearExpectations(&observer_); |
157 } | 157 } |
158 | 158 |
159 } // namespace | 159 } // namespace |
160 } // namespace policy | 160 } // namespace policy |
OLD | NEW |