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

Unified Diff: components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc

Issue 2488573003: Expose signing key from cloud policy stores (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/policy/core/common/cloud/user_cloud_policy_store_base.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc
diff --git a/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc b/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc
index 7a136086447138201cc68955c6a068d67d8e4f58..0382e3cc84b27db387cb562d9f93d1a5f4249191 100644
--- a/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc
+++ b/components/policy/core/common/cloud/user_cloud_policy_store_unittest.cc
@@ -62,6 +62,7 @@ class UserCloudPolicyStoreTest : public testing::Test {
external_data_manager_.reset(new MockCloudExternalDataManager);
external_data_manager_->SetPolicyStore(store_.get());
store_->SetSigninUsername(PolicyBuilder::kFakeUsername);
+ EXPECT_EQ(PolicyBuilder::kFakeUsername, store_->signin_username());
store_->AddObserver(&observer_);
// Install an initial public key, so that by default the validation of
@@ -229,7 +230,8 @@ TEST_F(UserCloudPolicyStoreTest, ShouldFailToLoadUnsignedPolicy) {
// Now mimic a new policy coming down - this should result in a new key
// being installed.
StorePolicyAndEnsureLoaded(policy_.policy());
- EXPECT_EQ(policy_.policy().new_public_key(), store_->policy_key());
+ EXPECT_EQ(policy_.policy().new_public_key(),
+ store_->policy_signature_public_key());
EXPECT_TRUE(store_->policy()->has_public_key_version());
EXPECT_TRUE(base::PathExists(key_file()));
}
@@ -285,7 +287,7 @@ TEST_F(UserCloudPolicyStoreTest, StoreRotatedKey) {
StorePolicyAndEnsureLoaded(policy_.policy());
EXPECT_FALSE(policy_.policy().has_new_public_key_signature());
std::string original_policy_key = policy_.policy().new_public_key();
- EXPECT_EQ(original_policy_key, store_->policy_key());
+ EXPECT_EQ(original_policy_key, store_->policy_signature_public_key());
// Now do key rotation.
policy_.SetDefaultSigningKey();
@@ -294,7 +296,8 @@ TEST_F(UserCloudPolicyStoreTest, StoreRotatedKey) {
EXPECT_TRUE(policy_.policy().has_new_public_key_signature());
EXPECT_NE(original_policy_key, policy_.policy().new_public_key());
StorePolicyAndEnsureLoaded(policy_.policy());
- EXPECT_EQ(policy_.policy().new_public_key(), store_->policy_key());
+ EXPECT_EQ(policy_.policy().new_public_key(),
+ store_->policy_signature_public_key());
}
TEST_F(UserCloudPolicyStoreTest, ProvisionKeyTwice) {
@@ -348,7 +351,7 @@ TEST_F(UserCloudPolicyStoreTest, StoreThenLoad) {
// Store a simple policy and make sure it can be read back in.
// policy.
StorePolicyAndEnsureLoaded(policy_.policy());
- EXPECT_FALSE(store_->policy_key().empty());
+ EXPECT_FALSE(store_->policy_signature_public_key().empty());
// Now, make sure the policy can be read back in from a second store.
std::unique_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
@@ -367,7 +370,8 @@ TEST_F(UserCloudPolicyStoreTest, StoreThenLoad) {
EXPECT_EQ(CloudPolicyStore::STATUS_OK, store2->status());
store2->RemoveObserver(&observer_);
// Make sure that we properly resurrected the keys.
- EXPECT_EQ(store2->policy_key(), store_->policy_key());
+ EXPECT_EQ(store2->policy_signature_public_key(),
+ store_->policy_signature_public_key());
}
TEST_F(UserCloudPolicyStoreTest, StoreThenLoadImmediately) {
« no previous file with comments | « components/policy/core/common/cloud/user_cloud_policy_store_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698