Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1547)

Unified Diff: chrome/browser/policy/cloud_policy_service_unittest.cc

Issue 11444029: Added UserPolicySigninService::FetchPolicyForSignedInUser(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review feedback Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
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();
}
« no previous file with comments | « chrome/browser/policy/cloud_policy_service.cc ('k') | chrome/browser/policy/device_local_account_policy_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698