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 3ebd5f393421449263b0faa3ac6bdc10b10f7069..b3b0daa13987313a404ab8ff18c4f8cb33ebbaaf 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 |
@@ -35,6 +35,9 @@ |
namespace em = enterprise_management; |
+using RetrievePolicyResponseType = |
+ chromeos::SessionManagerClient::RetrievePolicyResponseType; |
+ |
using testing::AllOf; |
using testing::AnyNumber; |
using testing::Eq; |
@@ -42,6 +45,7 @@ using testing::Mock; |
using testing::Property; |
using testing::Return; |
using testing::SaveArg; |
+using testing::SetArgPointee; |
using testing::_; |
namespace policy { |
@@ -111,7 +115,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(); |
} |
@@ -184,7 +188,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(), |
@@ -493,8 +498,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)); |
@@ -520,8 +526,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(); |
@@ -537,8 +544,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(); |
@@ -554,8 +562,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("")); |
@@ -574,8 +583,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")); |