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/chromeos/policy/user_cloud_policy_store_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include <memory> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
13 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/threading/sequenced_worker_pool.h" | 17 #include "base/threading/sequenced_worker_pool.h" |
18 #include "chromeos/dbus/mock_cryptohome_client.h" | 18 #include "chromeos/dbus/mock_cryptohome_client.h" |
19 #include "chromeos/dbus/mock_session_manager_client.h" | 19 #include "chromeos/dbus/mock_session_manager_client.h" |
20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
21 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" | 21 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" |
22 #include "components/policy/core/common/cloud/policy_builder.h" | 22 #include "components/policy/core/common/cloud/policy_builder.h" |
23 #include "components/policy/core/common/policy_types.h" | 23 #include "components/policy/core/common/policy_types.h" |
24 #include "policy/policy_constants.h" | 24 #include "policy/policy_constants.h" |
25 #include "policy/proto/cloud_policy.pb.h" | 25 #include "policy/proto/cloud_policy.pb.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 base::FilePath policy_file() { | 216 base::FilePath policy_file() { |
217 return tmp_dir_.path().AppendASCII("policy"); | 217 return tmp_dir_.path().AppendASCII("policy"); |
218 } | 218 } |
219 | 219 |
220 base::MessageLoopForUI loop_; | 220 base::MessageLoopForUI loop_; |
221 chromeos::MockCryptohomeClient cryptohome_client_; | 221 chromeos::MockCryptohomeClient cryptohome_client_; |
222 chromeos::MockSessionManagerClient session_manager_client_; | 222 chromeos::MockSessionManagerClient session_manager_client_; |
223 UserPolicyBuilder policy_; | 223 UserPolicyBuilder policy_; |
224 MockCloudPolicyStoreObserver observer_; | 224 MockCloudPolicyStoreObserver observer_; |
225 scoped_ptr<UserCloudPolicyStoreChromeOS> store_; | 225 std::unique_ptr<UserCloudPolicyStoreChromeOS> store_; |
226 const AccountId account_id_ = | 226 const AccountId account_id_ = |
227 AccountId::FromUserEmail(PolicyBuilder::kFakeUsername); | 227 AccountId::FromUserEmail(PolicyBuilder::kFakeUsername); |
228 const cryptohome::Identification cryptohome_id_ = | 228 const cryptohome::Identification cryptohome_id_ = |
229 cryptohome::Identification(account_id_); | 229 cryptohome::Identification(account_id_); |
230 | 230 |
231 private: | 231 private: |
232 base::ScopedTempDir tmp_dir_; | 232 base::ScopedTempDir tmp_dir_; |
233 | 233 |
234 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOSTest); | 234 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOSTest); |
235 }; | 235 }; |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 Mock::VerifyAndClearExpectations(&cryptohome_client_); | 663 Mock::VerifyAndClearExpectations(&cryptohome_client_); |
664 | 664 |
665 EXPECT_FALSE(store_->policy()); | 665 EXPECT_FALSE(store_->policy()); |
666 EXPECT_TRUE(store_->policy_map().empty()); | 666 EXPECT_TRUE(store_->policy_map().empty()); |
667 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status()); | 667 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status()); |
668 } | 668 } |
669 | 669 |
670 } // namespace | 670 } // namespace |
671 | 671 |
672 } // namespace policy | 672 } // namespace policy |
OLD | NEW |