| Index: chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
|
| diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
|
| index fc15dd1af641f4af407174bf746db20ec19074d1..5e780fb2bfd9fecfa5c59052077b82d93a678f38 100644
|
| --- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
|
| +++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
|
| @@ -34,6 +34,9 @@
|
|
|
| namespace em = enterprise_management;
|
|
|
| +using RetrievePolicyResponseType =
|
| + chromeos::SessionManagerClient::RetrievePolicyResponseType;
|
| +
|
| using testing::AllOf;
|
| using testing::AnyNumber;
|
| using testing::Eq;
|
| @@ -41,6 +44,7 @@ using testing::Mock;
|
| using testing::Property;
|
| using testing::Return;
|
| using testing::SaveArg;
|
| +using testing::SetArgPointee;
|
| using testing::_;
|
|
|
| namespace policy {
|
| @@ -110,7 +114,7 @@ class UserCloudPolicyStoreChromeOSTest : public testing::Test {
|
| ASSERT_FALSE(retrieve_callback.is_null());
|
|
|
| // Run the callback.
|
| - retrieve_callback.Run(response);
|
| + retrieve_callback.Run(response, RetrievePolicyResponseType::SUCCESS);
|
| base::RunLoop().RunUntilIdle();
|
| }
|
|
|
| @@ -183,7 +187,8 @@ class UserCloudPolicyStoreChromeOSTest : public testing::Test {
|
|
|
| // Finish the retrieve callback.
|
| EXPECT_CALL(observer_, OnStoreLoaded(store_.get()));
|
| - retrieve_callback.Run(policy_.GetBlob());
|
| + retrieve_callback.Run(policy_.GetBlob(),
|
| + RetrievePolicyResponseType::SUCCESS);
|
| base::RunLoop().RunUntilIdle();
|
| ASSERT_TRUE(store_->policy());
|
| EXPECT_EQ(policy_.policy_data().SerializeAsString(),
|
| @@ -492,8 +497,9 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, LoadInvalidSignature) {
|
| TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediately) {
|
| EXPECT_CALL(observer_, OnStoreLoaded(store_.get()));
|
| EXPECT_CALL(session_manager_client_,
|
| - BlockingRetrievePolicyForUser(cryptohome_id_))
|
| - .WillOnce(Return(policy_.GetBlob()));
|
| + BlockingRetrievePolicyForUser(cryptohome_id_, _))
|
| + .WillOnce(DoAll(SetArgPointee<1>(policy_.GetBlob()),
|
| + Return(RetrievePolicyResponseType::SUCCESS)));
|
| EXPECT_CALL(cryptohome_client_, BlockingGetSanitizedUsername(cryptohome_id_))
|
| .WillOnce(Return(kSanitizedUsername));
|
|
|
| @@ -519,8 +525,9 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediately) {
|
| TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyNoPolicy) {
|
| EXPECT_CALL(observer_, OnStoreLoaded(store_.get()));
|
| EXPECT_CALL(session_manager_client_,
|
| - BlockingRetrievePolicyForUser(cryptohome_id_))
|
| - .WillOnce(Return(""));
|
| + BlockingRetrievePolicyForUser(cryptohome_id_, _))
|
| + .WillOnce(DoAll(SetArgPointee<1>(""),
|
| + Return(RetrievePolicyResponseType::SUCCESS)));
|
|
|
| EXPECT_FALSE(store_->policy());
|
| store_->LoadImmediately();
|
| @@ -536,8 +543,9 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyNoPolicy) {
|
| TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyInvalidBlob) {
|
| EXPECT_CALL(observer_, OnStoreError(store_.get()));
|
| EXPECT_CALL(session_manager_client_,
|
| - BlockingRetrievePolicyForUser(cryptohome_id_))
|
| - .WillOnce(Return("le blob"));
|
| + BlockingRetrievePolicyForUser(cryptohome_id_, _))
|
| + .WillOnce(DoAll(SetArgPointee<1>("le blob"),
|
| + Return(RetrievePolicyResponseType::SUCCESS)));
|
|
|
| EXPECT_FALSE(store_->policy());
|
| store_->LoadImmediately();
|
| @@ -553,8 +561,9 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyInvalidBlob) {
|
| TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyDBusFailure) {
|
| EXPECT_CALL(observer_, OnStoreError(store_.get()));
|
| EXPECT_CALL(session_manager_client_,
|
| - BlockingRetrievePolicyForUser(cryptohome_id_))
|
| - .WillOnce(Return(policy_.GetBlob()));
|
| + BlockingRetrievePolicyForUser(cryptohome_id_, _))
|
| + .WillOnce(DoAll(SetArgPointee<1>(policy_.GetBlob()),
|
| + Return(RetrievePolicyResponseType::SUCCESS)));
|
| EXPECT_CALL(cryptohome_client_, BlockingGetSanitizedUsername(cryptohome_id_))
|
| .WillOnce(Return(""));
|
|
|
| @@ -573,8 +582,9 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyDBusFailure) {
|
| TEST_F(UserCloudPolicyStoreChromeOSTest, LoadImmediatelyNoUserPolicyKey) {
|
| EXPECT_CALL(observer_, OnStoreError(store_.get()));
|
| EXPECT_CALL(session_manager_client_,
|
| - BlockingRetrievePolicyForUser(cryptohome_id_))
|
| - .WillOnce(Return(policy_.GetBlob()));
|
| + BlockingRetrievePolicyForUser(cryptohome_id_, _))
|
| + .WillOnce(DoAll(SetArgPointee<1>(policy_.GetBlob()),
|
| + Return(RetrievePolicyResponseType::SUCCESS)));
|
| EXPECT_CALL(cryptohome_client_, BlockingGetSanitizedUsername(cryptohome_id_))
|
| .WillOnce(Return("wrong@example.com"));
|
|
|
|
|