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

Side by Side Diff: chrome/browser/policy/device_local_account_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/policy/device_local_account_policy_service.h" 5 #include "chrome/browser/policy/device_local_account_policy_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" 9 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
10 #include "chrome/browser/policy/cloud_policy_client.h" 10 #include "chrome/browser/policy/cloud_policy_client.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 DeviceSettingsTestBase::TearDown(); 67 DeviceSettingsTestBase::TearDown();
68 } 68 }
69 69
70 void InstallDevicePolicy() { 70 void InstallDevicePolicy() {
71 EXPECT_CALL(service_observer_, OnDeviceLocalAccountsChanged()); 71 EXPECT_CALL(service_observer_, OnDeviceLocalAccountsChanged());
72 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); 72 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob());
73 ReloadDeviceSettings(); 73 ReloadDeviceSettings();
74 Mock::VerifyAndClearExpectations(&service_observer_); 74 Mock::VerifyAndClearExpectations(&service_observer_);
75 } 75 }
76 76
77 MOCK_METHOD0(OnRefreshDone, void(void)); 77 MOCK_METHOD1(OnRefreshDone, void(bool));
78 78
79 PolicyMap expected_policy_map_; 79 PolicyMap expected_policy_map_;
80 UserPolicyBuilder device_local_account_policy_; 80 UserPolicyBuilder device_local_account_policy_;
81 MockDeviceLocalAccountPolicyServiceObserver service_observer_; 81 MockDeviceLocalAccountPolicyServiceObserver service_observer_;
82 MockDeviceManagementService mock_device_management_service_; 82 MockDeviceManagementService mock_device_management_service_;
83 DeviceLocalAccountPolicyService service_; 83 DeviceLocalAccountPolicyService service_;
84 84
85 private: 85 private:
86 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyServiceTest); 86 DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyServiceTest);
87 }; 87 };
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 service_.Connect(&mock_device_management_service_); 284 service_.Connect(&mock_device_management_service_);
285 ASSERT_TRUE(broker->core()->service()); 285 ASSERT_TRUE(broker->core()->service());
286 286
287 em::DeviceManagementResponse response; 287 em::DeviceManagementResponse response;
288 response.mutable_policy_response()->add_response()->CopyFrom( 288 response.mutable_policy_response()->add_response()->CopyFrom(
289 device_local_account_policy_.policy()); 289 device_local_account_policy_.policy());
290 EXPECT_CALL(mock_device_management_service_, CreateJob(_)) 290 EXPECT_CALL(mock_device_management_service_, CreateJob(_))
291 .WillOnce(mock_device_management_service_.SucceedJob(response)); 291 .WillOnce(mock_device_management_service_.SucceedJob(response));
292 EXPECT_CALL(mock_device_management_service_, StartJob(_, _, _, _, _, _, _)); 292 EXPECT_CALL(mock_device_management_service_, StartJob(_, _, _, _, _, _, _));
293 EXPECT_CALL(*this, OnRefreshDone()).Times(1); 293 EXPECT_CALL(*this, OnRefreshDone(true)).Times(1);
294 EXPECT_CALL(service_observer_, OnPolicyUpdated(PolicyBuilder::kFakeUsername)); 294 EXPECT_CALL(service_observer_, OnPolicyUpdated(PolicyBuilder::kFakeUsername));
295 broker->core()->service()->RefreshPolicy( 295 broker->core()->service()->RefreshPolicy(
296 base::Bind(&DeviceLocalAccountPolicyServiceTest::OnRefreshDone, 296 base::Bind(&DeviceLocalAccountPolicyServiceTest::OnRefreshDone,
297 base::Unretained(this))); 297 base::Unretained(this)));
298 FlushDeviceSettings(); 298 FlushDeviceSettings();
299 Mock::VerifyAndClearExpectations(&service_observer_); 299 Mock::VerifyAndClearExpectations(&service_observer_);
300 Mock::VerifyAndClearExpectations(this); 300 Mock::VerifyAndClearExpectations(this);
301 Mock::VerifyAndClearExpectations(&mock_device_management_service_); 301 Mock::VerifyAndClearExpectations(&mock_device_management_service_);
302 302
303 ASSERT_TRUE(broker->core()->store()); 303 ASSERT_TRUE(broker->core()->store());
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 ASSERT_TRUE(request_job); 456 ASSERT_TRUE(request_job);
457 em::DeviceManagementResponse response; 457 em::DeviceManagementResponse response;
458 response.mutable_policy_response()->add_response()->CopyFrom( 458 response.mutable_policy_response()->add_response()->CopyFrom(
459 device_local_account_policy_.policy()); 459 device_local_account_policy_.policy());
460 request_job->SendResponse(DM_STATUS_SUCCESS, response); 460 request_job->SendResponse(DM_STATUS_SUCCESS, response);
461 FlushDeviceSettings(); 461 FlushDeviceSettings();
462 Mock::VerifyAndClearExpectations(&provider_observer_); 462 Mock::VerifyAndClearExpectations(&provider_observer_);
463 } 463 }
464 464
465 } // namespace policy 465 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/device_local_account_policy_provider.cc ('k') | chrome/browser/policy/user_cloud_policy_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698