Chromium Code Reviews| Index: chrome/browser/policy/cloud_policy_service_unittest.cc |
| diff --git a/chrome/browser/policy/cloud_policy_service_unittest.cc b/chrome/browser/policy/cloud_policy_service_unittest.cc |
| index 9e8f54124950f5d338a2a2a3186d4c672f25323a..224c41559c9d63e4fb093c93df1c75cf7494e9f9 100644 |
| --- a/chrome/browser/policy/cloud_policy_service_unittest.cc |
| +++ b/chrome/browser/policy/cloud_policy_service_unittest.cc |
| @@ -33,7 +33,7 @@ class CloudPolicyServiceTest : public testing::Test { |
| CloudPolicyServiceTest() |
| : service_(&client_, &store_) {} |
| - MOCK_METHOD0(OnPolicyRefresh, void(void)); |
| + MOCK_METHOD1(OnPolicyRefresh, void(bool)); |
| protected: |
| MockCloudPolicyClient client_; |
| @@ -90,7 +90,7 @@ TEST_F(CloudPolicyServiceTest, PolicyUpdateClientFailure) { |
| TEST_F(CloudPolicyServiceTest, RefreshPolicySuccess) { |
| testing::InSequence seq; |
| - EXPECT_CALL(*this, OnPolicyRefresh()).Times(0); |
| + EXPECT_CALL(*this, OnPolicyRefresh(_)).Times(0); |
|
Mattias Nissler (ping if slow)
2012/12/07 15:20:45
Hm, all these violate the "don't mix expectation s
Andrew T Wilson (Slow)
2012/12/07 17:34:29
What is that rule?
Mattias Nissler (ping if slow)
2012/12/10 09:01:08
From https://code.google.com/p/googlemock/wiki/For
|
| client_.SetDMToken("fake token"); |
| // Trigger a fetch on the client. |
| @@ -109,7 +109,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicySuccess) { |
| store_.policy_.reset(new em::PolicyData()); |
| store_.policy_->set_request_token("token"); |
| store_.policy_->set_device_id("device-id"); |
| - EXPECT_CALL(*this, OnPolicyRefresh()).Times(1); |
| + EXPECT_CALL(*this, OnPolicyRefresh(true)).Times(1); |
| store_.NotifyStoreLoaded(); |
| } |
| @@ -118,7 +118,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicyNotRegistered) { |
| client_.SetDMToken(""); |
| EXPECT_CALL(client_, FetchPolicy()).Times(0); |
| - EXPECT_CALL(*this, OnPolicyRefresh()).Times(1); |
| + EXPECT_CALL(*this, OnPolicyRefresh(false)).Times(1); |
| service_.RefreshPolicy(base::Bind(&CloudPolicyServiceTest::OnPolicyRefresh, |
| base::Unretained(this))); |
| } |
| @@ -126,7 +126,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicyNotRegistered) { |
| TEST_F(CloudPolicyServiceTest, RefreshPolicyClientError) { |
| testing::InSequence seq; |
| - EXPECT_CALL(*this, OnPolicyRefresh()).Times(0); |
| + EXPECT_CALL(*this, OnPolicyRefresh(_)).Times(0); |
| client_.SetDMToken("fake token"); |
| // Trigger a fetch on the client. |
| @@ -136,14 +136,14 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicyClientError) { |
| // Client responds with an error, which should trigger the callback. |
| client_.SetStatus(DM_STATUS_REQUEST_FAILED); |
| - EXPECT_CALL(*this, OnPolicyRefresh()).Times(1); |
| + EXPECT_CALL(*this, OnPolicyRefresh(false)).Times(1); |
| client_.NotifyClientError(); |
| } |
| TEST_F(CloudPolicyServiceTest, RefreshPolicyStoreError) { |
| testing::InSequence seq; |
| - EXPECT_CALL(*this, OnPolicyRefresh()).Times(0); |
| + EXPECT_CALL(*this, OnPolicyRefresh(_)).Times(0); |
| client_.SetDMToken("fake token"); |
| // Trigger a fetch on the client. |
| @@ -159,14 +159,14 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicyStoreError) { |
| client_.NotifyPolicyFetched(); |
| // Store fails, which should trigger the callback. |
| - EXPECT_CALL(*this, OnPolicyRefresh()).Times(1); |
| + EXPECT_CALL(*this, OnPolicyRefresh(false)).Times(1); |
| store_.NotifyStoreError(); |
| } |
| TEST_F(CloudPolicyServiceTest, RefreshPolicyConcurrent) { |
| testing::InSequence seq; |
| - EXPECT_CALL(*this, OnPolicyRefresh()).Times(0); |
| + EXPECT_CALL(*this, OnPolicyRefresh(_)).Times(0); |
| client_.SetDMToken("fake token"); |
| // Trigger a fetch on the client. |
| @@ -192,7 +192,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicyConcurrent) { |
| base::Unretained(this))); |
| // The store finishing the first load should not generate callbacks. |
| - EXPECT_CALL(*this, OnPolicyRefresh()).Times(0); |
| + EXPECT_CALL(*this, OnPolicyRefresh(_)).Times(0); |
| store_.NotifyStoreLoaded(); |
| // Second policy fetch finishes. |
| @@ -200,7 +200,7 @@ TEST_F(CloudPolicyServiceTest, RefreshPolicyConcurrent) { |
| client_.NotifyPolicyFetched(); |
| // Corresponding store operation finishes, all _three_ callbacks fire. |
| - EXPECT_CALL(*this, OnPolicyRefresh()).Times(3); |
| + EXPECT_CALL(*this, OnPolicyRefresh(true)).Times(3); |
| store_.NotifyStoreLoaded(); |
| } |