| 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);
|
|
|