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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 EXPECT_CALL(cryptohome_client_, | 61 EXPECT_CALL(cryptohome_client_, |
62 GetSanitizedUsername(PolicyBuilder::kFakeUsername, _)) | 62 GetSanitizedUsername(PolicyBuilder::kFakeUsername, _)) |
63 .Times(AnyNumber()) | 63 .Times(AnyNumber()) |
64 .WillRepeatedly( | 64 .WillRepeatedly( |
65 SendSanitizedUsername(chromeos::DBUS_METHOD_CALL_SUCCESS, | 65 SendSanitizedUsername(chromeos::DBUS_METHOD_CALL_SUCCESS, |
66 kSanitizedUsername)); | 66 kSanitizedUsername)); |
67 | 67 |
68 ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir()); | 68 ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir()); |
69 store_.reset(new UserCloudPolicyStoreChromeOS( | 69 store_.reset(new UserCloudPolicyStoreChromeOS( |
70 &cryptohome_client_, &session_manager_client_, loop_.task_runner(), | 70 &cryptohome_client_, &session_manager_client_, loop_.task_runner(), |
71 PolicyBuilder::kFakeUsername, user_policy_dir(), token_file(), | 71 AccountId::FromUserEmail(PolicyBuilder::kFakeUsername), |
72 policy_file())); | 72 user_policy_dir(), token_file(), policy_file())); |
73 store_->AddObserver(&observer_); | 73 store_->AddObserver(&observer_); |
74 | 74 |
75 // Install the initial public key, so that by default the validation of | 75 // Install the initial public key, so that by default the validation of |
76 // the stored/loaded policy blob succeeds. | 76 // the stored/loaded policy blob succeeds. |
77 std::vector<uint8_t> public_key; | 77 std::vector<uint8_t> public_key; |
78 ASSERT_TRUE(policy_.GetSigningKey()->ExportPublicKey(&public_key)); | 78 ASSERT_TRUE(policy_.GetSigningKey()->ExportPublicKey(&public_key)); |
79 StoreUserPolicyKey(public_key); | 79 StoreUserPolicyKey(public_key); |
80 | 80 |
81 policy_.payload().mutable_homepagelocation()->set_value(kDefaultHomepage); | 81 policy_.payload().mutable_homepagelocation()->set_value(kDefaultHomepage); |
82 policy_.Build(); | 82 policy_.Build(); |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 Mock::VerifyAndClearExpectations(&cryptohome_client_); | 671 Mock::VerifyAndClearExpectations(&cryptohome_client_); |
672 | 672 |
673 EXPECT_FALSE(store_->policy()); | 673 EXPECT_FALSE(store_->policy()); |
674 EXPECT_TRUE(store_->policy_map().empty()); | 674 EXPECT_TRUE(store_->policy_map().empty()); |
675 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status()); | 675 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status()); |
676 } | 676 } |
677 | 677 |
678 } // namespace | 678 } // namespace |
679 | 679 |
680 } // namespace policy | 680 } // namespace policy |
OLD | NEW |