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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // the |expected_value|. | 118 // the |expected_value|. |
119 void VerifyPolicyMap(const char* expected_value) { | 119 void VerifyPolicyMap(const char* expected_value) { |
120 EXPECT_EQ(1U, store_->policy_map().size()); | 120 EXPECT_EQ(1U, store_->policy_map().size()); |
121 const PolicyMap::Entry* entry = | 121 const PolicyMap::Entry* entry = |
122 store_->policy_map().Get(key::kHomepageLocation); | 122 store_->policy_map().Get(key::kHomepageLocation); |
123 ASSERT_TRUE(entry); | 123 ASSERT_TRUE(entry); |
124 EXPECT_TRUE(base::StringValue(expected_value).Equals(entry->value)); | 124 EXPECT_TRUE(base::StringValue(expected_value).Equals(entry->value)); |
125 } | 125 } |
126 | 126 |
127 void StoreUserPolicyKey(const std::vector<uint8>& public_key) { | 127 void StoreUserPolicyKey(const std::vector<uint8>& public_key) { |
128 ASSERT_TRUE(file_util::CreateDirectory(user_policy_key_file().DirName())); | 128 ASSERT_TRUE(base::CreateDirectory(user_policy_key_file().DirName())); |
129 ASSERT_TRUE( | 129 ASSERT_TRUE( |
130 file_util::WriteFile(user_policy_key_file(), | 130 file_util::WriteFile(user_policy_key_file(), |
131 reinterpret_cast<const char*>(public_key.data()), | 131 reinterpret_cast<const char*>(public_key.data()), |
132 public_key.size())); | 132 public_key.size())); |
133 } | 133 } |
134 | 134 |
135 // Stores the current |policy_| and verifies that it is published. | 135 // Stores the current |policy_| and verifies that it is published. |
136 // If |new_public_key| is set then it will be persisted after storing but | 136 // If |new_public_key| is set then it will be persisted after storing but |
137 // before loading the policy, so that the signature validation can succeed. | 137 // before loading the policy, so that the signature validation can succeed. |
138 // If |previous_value| is set then a previously existing policy with that | 138 // If |previous_value| is set then a previously existing policy with that |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 Mock::VerifyAndClearExpectations(&cryptohome_client_); | 609 Mock::VerifyAndClearExpectations(&cryptohome_client_); |
610 | 610 |
611 EXPECT_FALSE(store_->policy()); | 611 EXPECT_FALSE(store_->policy()); |
612 EXPECT_TRUE(store_->policy_map().empty()); | 612 EXPECT_TRUE(store_->policy_map().empty()); |
613 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status()); | 613 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status()); |
614 } | 614 } |
615 | 615 |
616 } // namespace | 616 } // namespace |
617 | 617 |
618 } // namespace policy | 618 } // namespace policy |
OLD | NEW |