| 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 f2eb5530c882645ad86dde363fcb3b275f8200b4..1c6802e64be0cbd398e222c3bf43c9062741993f 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
|
| @@ -6,8 +6,6 @@
|
|
|
| #include "base/files/file_util.h"
|
| #include "base/files/scoped_temp_dir.h"
|
| -#include "base/message_loop/message_loop.h"
|
| -#include "base/message_loop/message_loop_proxy.h"
|
| #include "base/run_loop.h"
|
| #include "components/policy/core/common/cloud/cloud_policy_constants.h"
|
| #include "components/policy/core/common/cloud/mock_cloud_external_data_manager.h"
|
| @@ -57,11 +55,9 @@ class UserCloudPolicyStoreTest : public testing::Test {
|
|
|
| void SetUp() override {
|
| ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir());
|
| - store_.reset(
|
| - new UserCloudPolicyStore(policy_file(),
|
| - key_file(),
|
| - GetPolicyVerificationKey(),
|
| - loop_.message_loop_proxy()));
|
| + store_.reset(new UserCloudPolicyStore(policy_file(), key_file(),
|
| + GetPolicyVerificationKey(),
|
| + loop_.task_runner()));
|
| external_data_manager_.reset(new MockCloudExternalDataManager);
|
| external_data_manager_->SetPolicyStore(store_.get());
|
| store_->SetSigninUsername(PolicyBuilder::kFakeUsername);
|
| @@ -354,11 +350,9 @@ TEST_F(UserCloudPolicyStoreTest, StoreThenLoad) {
|
| EXPECT_FALSE(store_->policy_key().empty());
|
|
|
| // Now, make sure the policy can be read back in from a second store.
|
| - scoped_ptr<UserCloudPolicyStore> store2(
|
| - new UserCloudPolicyStore(policy_file(),
|
| - key_file(),
|
| - GetPolicyVerificationKey(),
|
| - loop_.message_loop_proxy()));
|
| + scoped_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
|
| + policy_file(), key_file(), GetPolicyVerificationKey(),
|
| + loop_.task_runner()));
|
| store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
|
| store2->AddObserver(&observer_);
|
| EXPECT_CALL(observer_, OnStoreLoaded(store2.get()));
|
| @@ -381,11 +375,9 @@ TEST_F(UserCloudPolicyStoreTest, StoreThenLoadImmediately) {
|
| StorePolicyAndEnsureLoaded(policy_.policy());
|
|
|
| // Now, make sure the policy can be read back in from a second store.
|
| - scoped_ptr<UserCloudPolicyStore> store2(
|
| - new UserCloudPolicyStore(policy_file(),
|
| - key_file(),
|
| - GetPolicyVerificationKey(),
|
| - loop_.message_loop_proxy()));
|
| + scoped_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
|
| + policy_file(), key_file(), GetPolicyVerificationKey(),
|
| + loop_.task_runner()));
|
| store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
|
| store2->AddObserver(&observer_);
|
| EXPECT_CALL(observer_, OnStoreLoaded(store2.get()));
|
| @@ -428,11 +420,9 @@ 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).
|
| - scoped_ptr<UserCloudPolicyStore> store2(
|
| - new UserCloudPolicyStore(policy_file(),
|
| - key_file(),
|
| - GetPolicyVerificationKey(),
|
| - loop_.message_loop_proxy()));
|
| + scoped_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
|
| + policy_file(), key_file(), GetPolicyVerificationKey(),
|
| + loop_.task_runner()));
|
| store2->SetSigninUsername("foobar@foobar.com");
|
| store2->AddObserver(&observer_);
|
| ExpectError(store2.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR);
|
| @@ -444,11 +434,9 @@ TEST_F(UserCloudPolicyStoreTest, LoadValidationError) {
|
|
|
| // Sign out - we should be able to load the policy (don't check usernames
|
| // when signed out).
|
| - scoped_ptr<UserCloudPolicyStore> store3(
|
| - new UserCloudPolicyStore(policy_file(),
|
| - key_file(),
|
| - GetPolicyVerificationKey(),
|
| - loop_.message_loop_proxy()));
|
| + scoped_ptr<UserCloudPolicyStore> store3(new UserCloudPolicyStore(
|
| + policy_file(), key_file(), GetPolicyVerificationKey(),
|
| + loop_.task_runner()));
|
| store3->AddObserver(&observer_);
|
| EXPECT_CALL(observer_, OnStoreLoaded(store3.get()));
|
| store3->Load();
|
| @@ -458,11 +446,9 @@ TEST_F(UserCloudPolicyStoreTest, LoadValidationError) {
|
| store3->RemoveObserver(&observer_);
|
|
|
| // Now start a signin as a different user - this should fail validation.
|
| - scoped_ptr<UserCloudPolicyStore> store4(
|
| - new UserCloudPolicyStore(policy_file(),
|
| - key_file(),
|
| - GetPolicyVerificationKey(),
|
| - loop_.message_loop_proxy()));
|
| + scoped_ptr<UserCloudPolicyStore> store4(new UserCloudPolicyStore(
|
| + policy_file(), key_file(), GetPolicyVerificationKey(),
|
| + loop_.task_runner()));
|
| store4->SetSigninUsername("foobar@foobar.com");
|
| store4->AddObserver(&observer_);
|
| ExpectError(store4.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR);
|
| @@ -489,11 +475,9 @@ 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.
|
| - scoped_ptr<UserCloudPolicyStore> store2(
|
| - new UserCloudPolicyStore(policy_file(),
|
| - key_file(),
|
| - GetPolicyVerificationKey(),
|
| - loop_.message_loop_proxy()));
|
| + scoped_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
|
| + policy_file(), key_file(), GetPolicyVerificationKey(),
|
| + loop_.task_runner()));
|
| store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
|
| store2->AddObserver(&observer_);
|
| EXPECT_CALL(observer_, OnStoreLoaded(store2.get()));
|
| @@ -518,11 +502,9 @@ TEST_F(UserCloudPolicyStoreTest, InvalidCachedVerificationSignature) {
|
|
|
| // Now load this in a new store - this should cause a validation error because
|
| // the key won't verify.
|
| - scoped_ptr<UserCloudPolicyStore> store2(
|
| - new UserCloudPolicyStore(policy_file(),
|
| - key_file(),
|
| - GetPolicyVerificationKey(),
|
| - loop_.message_loop_proxy()));
|
| + scoped_ptr<UserCloudPolicyStore> store2(new UserCloudPolicyStore(
|
| + policy_file(), key_file(), GetPolicyVerificationKey(),
|
| + loop_.task_runner()));
|
| store2->SetSigninUsername(PolicyBuilder::kFakeUsername);
|
| store2->AddObserver(&observer_);
|
| ExpectError(store2.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR);
|
|
|