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

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

Issue 2507423002: Remove unnecessary plumbing for policy verification key (Closed)
Patch Set: git cl format and 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.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 0382e3cc84b27db387cb562d9f93d1a5f4249191..524f36fab89196babffe5bb16938447304876c46 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
@@ -57,7 +57,6 @@ class UserCloudPolicyStoreTest : public testing::Test {
void SetUp() override {
ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir());
store_.reset(new UserCloudPolicyStore(policy_file(), key_file(),
- GetPolicyVerificationKey(),
loop_.task_runner()));
external_data_manager_.reset(new MockCloudExternalDataManager);
external_data_manager_->SetPolicyStore(store_.get());
@@ -354,9 +353,8 @@ TEST_F(UserCloudPolicyStoreTest, StoreThenLoad) {
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(
- policy_file(), key_file(), GetPolicyVerificationKey(),
- loop_.task_runner()));
+ std::unique_ptr<UserCloudPolicyStore> store2(
+ new UserCloudPolicyStore(policy_file(), key_file(), loop_.task_runner()));
store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
store2->AddObserver(&observer_);
EXPECT_CALL(observer_, OnStoreLoaded(store2.get()));
@@ -380,9 +378,8 @@ TEST_F(UserCloudPolicyStoreTest, StoreThenLoadImmediately) {
StorePolicyAndEnsureLoaded(policy_.policy());
// Now, make sure the policy can be read back in from a second store.
- std::unique_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
- policy_file(), key_file(), GetPolicyVerificationKey(),
- loop_.task_runner()));
+ std::unique_ptr<UserCloudPolicyStore> store2(
+ new UserCloudPolicyStore(policy_file(), key_file(), loop_.task_runner()));
store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
store2->AddObserver(&observer_);
EXPECT_CALL(observer_, OnStoreLoaded(store2.get()));
@@ -425,9 +422,8 @@ TEST_F(UserCloudPolicyStoreTest, LoadValidationError) {
// Sign out, and sign back in as a different user, and try to load the profile
// data (should fail due to mismatched username).
- std::unique_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
- policy_file(), key_file(), GetPolicyVerificationKey(),
- loop_.task_runner()));
+ std::unique_ptr<UserCloudPolicyStore> store2(
+ new UserCloudPolicyStore(policy_file(), key_file(), loop_.task_runner()));
store2->SetSigninUsername("foobar@foobar.com");
store2->AddObserver(&observer_);
ExpectError(store2.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR);
@@ -439,9 +435,8 @@ TEST_F(UserCloudPolicyStoreTest, LoadValidationError) {
// Sign out - we should be able to load the policy (don't check usernames
// when signed out).
- std::unique_ptr<UserCloudPolicyStore> store3(new UserCloudPolicyStore(
- policy_file(), key_file(), GetPolicyVerificationKey(),
- loop_.task_runner()));
+ std::unique_ptr<UserCloudPolicyStore> store3(
+ new UserCloudPolicyStore(policy_file(), key_file(), loop_.task_runner()));
store3->AddObserver(&observer_);
EXPECT_CALL(observer_, OnStoreLoaded(store3.get()));
store3->Load();
@@ -451,9 +446,8 @@ TEST_F(UserCloudPolicyStoreTest, LoadValidationError) {
store3->RemoveObserver(&observer_);
// Now start a signin as a different user - this should fail validation.
- std::unique_ptr<UserCloudPolicyStore> store4(new UserCloudPolicyStore(
- policy_file(), key_file(), GetPolicyVerificationKey(),
- loop_.task_runner()));
+ std::unique_ptr<UserCloudPolicyStore> store4(
+ new UserCloudPolicyStore(policy_file(), key_file(), loop_.task_runner()));
store4->SetSigninUsername("foobar@foobar.com");
store4->AddObserver(&observer_);
ExpectError(store4.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR);
@@ -480,9 +474,8 @@ TEST_F(UserCloudPolicyStoreTest, KeyRotation) {
// Now load this in a new store - this should trigger key rotation. The keys
// will still verify using the existing verification key.
- std::unique_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
- policy_file(), key_file(), GetPolicyVerificationKey(),
- loop_.task_runner()));
+ std::unique_ptr<UserCloudPolicyStore> store2(
+ new UserCloudPolicyStore(policy_file(), key_file(), loop_.task_runner()));
store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
store2->AddObserver(&observer_);
EXPECT_CALL(observer_, OnStoreLoaded(store2.get()));
@@ -507,9 +500,8 @@ TEST_F(UserCloudPolicyStoreTest, InvalidCachedVerificationSignature) {
// Now load this in a new store - this should cause a validation error because
// the key won't verify.
- std::unique_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
- policy_file(), key_file(), GetPolicyVerificationKey(),
- loop_.task_runner()));
+ std::unique_ptr<UserCloudPolicyStore> store2(
+ new UserCloudPolicyStore(policy_file(), key_file(), loop_.task_runner()));
store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
store2->AddObserver(&observer_);
ExpectError(store2.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR);
« no previous file with comments | « components/policy/core/common/cloud/user_cloud_policy_store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698