From 59e0a98906a82e494e77963a132f4cbdbbb4ecb8 Mon Sep 17 00:00:00 2001 From: peletskyi Date: Mon, 27 Jul 2015 08:41:18 -0700 Subject: [PATCH] Removed affiliation from chrome and tests. This was agreed with server team as well. BUG=513299 Review URL: https://codereview.chromium.org/1248363002 Cr-Commit-Position: refs/heads/master@{#340469} --- .../policy/auto_enrollment_client_unittest.cc | 10 +-- .../policy/device_cloud_policy_initializer.cc | 1 - ...evice_cloud_policy_manager_chromeos_unittest.cc | 30 ++++---- .../policy/device_local_account_policy_service.cc | 1 - ...device_local_account_policy_service_unittest.cc | 20 +++--- .../policy/user_cloud_policy_manager_chromeos.cc | 10 ++- .../policy/user_cloud_policy_manager_chromeos.h | 3 +- .../user_cloud_policy_manager_chromeos_unittest.cc | 9 ++- .../user_cloud_policy_manager_factory_chromeos.cc | 6 +- .../cloud/device_management_service_browsertest.cc | 1 - .../cloud/user_policy_signin_service_unittest.cc | 14 ++-- .../core/common/cloud/cloud_policy_client.cc | 3 - .../policy/core/common/cloud/cloud_policy_client.h | 2 - .../common/cloud/cloud_policy_client_unittest.cc | 79 +++++++++++----------- .../core/common/cloud/cloud_policy_constants.cc | 3 - .../core/common/cloud/cloud_policy_constants.h | 5 +- .../core/common/cloud/device_management_service.cc | 17 ----- .../core/common/cloud/device_management_service.h | 1 - .../core/common/cloud/mock_cloud_policy_client.cc | 1 - .../common/cloud/mock_device_management_service.cc | 1 - .../common/cloud/mock_device_management_service.h | 3 +- .../core/common/cloud/user_cloud_policy_manager.cc | 1 - .../remote_commands_service_unittest.cc | 1 - 23 files changed, 89 insertions(+), 133 deletions(-) diff --git a/chrome/browser/chromeos/policy/auto_enrollment_client_unittest.cc b/chrome/browser/chromeos/policy/auto_enrollment_client_unittest.cc index 30372d5f508a..1813430cf00b 100644 --- a/chrome/browser/chromeos/policy/auto_enrollment_client_unittest.cc +++ b/chrome/browser/chromeos/policy/auto_enrollment_client_unittest.cc @@ -68,8 +68,8 @@ class AutoEnrollmentClientTest : public testing::Test { int power_limit) { state_ = AUTO_ENROLLMENT_STATE_PENDING; service_.reset(new MockDeviceManagementService()); - EXPECT_CALL(*service_, StartJob(_, _, _, _, _, _, _)) - .WillRepeatedly(SaveArg<6>(&last_request_)); + EXPECT_CALL(*service_, StartJob(_, _, _, _, _, _)) + .WillRepeatedly(SaveArg<5>(&last_request_)); client_.reset(new AutoEnrollmentClient( base::Bind(&AutoEnrollmentClientTest::ProgressCallback, base::Unretained(this)), @@ -598,16 +598,16 @@ TEST_F(AutoEnrollmentClientTest, NetworkFailureThenRequireUpdatedModulus) { InSequence sequence; // The default client uploads 4 bits. Make the server ask for 5. ServerWillReply(1 << 5, false, false); - EXPECT_CALL(*service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(*service_, StartJob(_, _, _, _, _, _)); // Then reply with a valid response and include the hash. ServerWillReply(-1, true, true); - EXPECT_CALL(*service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(*service_, StartJob(_, _, _, _, _, _)); // State download triggers. ServerWillSendState( "example.com", em::DeviceStateRetrievalResponse::RESTORE_MODE_REENROLLMENT_ENFORCED, kDisabledMessage); - EXPECT_CALL(*service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(*service_, StartJob(_, _, _, _, _, _)); // Trigger a network change event. client_->OnNetworkChanged(net::NetworkChangeNotifier::CONNECTION_ETHERNET); diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc b/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc index 124a7163cbc3..f5af5d2a2c6d 100644 --- a/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc +++ b/chrome/browser/chromeos/policy/device_cloud_policy_initializer.cc @@ -232,7 +232,6 @@ scoped_ptr DeviceCloudPolicyInitializer::CreateClient( new CloudPolicyClient(DeviceCloudPolicyManagerChromeOS::GetMachineID(), DeviceCloudPolicyManagerChromeOS::GetMachineModel(), kPolicyVerificationKeyHash, - USER_AFFILIATION_NONE, device_management_service, request_context)); } diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc index b3f626eb4d76..7072f2da6c32 100644 --- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc @@ -197,9 +197,10 @@ class DeviceCloudPolicyManagerChromeOSTest .Times(AnyNumber()) .WillRepeatedly(device_management_service_.FailJob( DM_STATUS_TEMPORARY_UNAVAILABLE)); - EXPECT_CALL(device_management_service_, - StartJob(dm_protocol::kValueRequestRemoteCommands, _, _, _, _, - _, _)).Times(AnyNumber()); + EXPECT_CALL( + device_management_service_, + StartJob(dm_protocol::kValueRequestRemoteCommands, _, _, _, _, _)) + .Times(AnyNumber()); } MOCK_METHOD0(OnDeviceCloudPolicyManagerConnected, void()); @@ -255,7 +256,7 @@ TEST_F(DeviceCloudPolicyManagerChromeOSTest, EnrolledDevice) { .Times(AtMost(1)) .WillOnce(device_management_service_.CreateAsyncJob(&policy_fetch_job)); EXPECT_CALL(device_management_service_, - StartJob(dm_protocol::kValueRequestPolicy, _, _, _, _, _, _)) + StartJob(dm_protocol::kValueRequestPolicy, _, _, _, _, _)) .Times(AtMost(1)); ConnectManager(); base::RunLoop().RunUntilIdle(); @@ -293,7 +294,7 @@ TEST_F(DeviceCloudPolicyManagerChromeOSTest, UnmanagedDevice) { .Times(AtMost(1)) .WillOnce(device_management_service_.CreateAsyncJob(&policy_fetch_job)); EXPECT_CALL(device_management_service_, - StartJob(dm_protocol::kValueRequestPolicy, _, _, _, _, _, _)) + StartJob(dm_protocol::kValueRequestPolicy, _, _, _, _, _)) .Times(AtMost(1)); ConnectManager(); base::RunLoop().RunUntilIdle(); @@ -346,7 +347,7 @@ TEST_F(DeviceCloudPolicyManagerChromeOSTest, ConnectAndDisconnect) { CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, _)) .WillOnce(device_management_service_.CreateAsyncJob(&policy_fetch_job)); EXPECT_CALL(device_management_service_, - StartJob(dm_protocol::kValueRequestPolicy, _, _, _, _, _, _)); + StartJob(dm_protocol::kValueRequestPolicy, _, _, _, _, _)); EXPECT_CALL(*this, OnDeviceCloudPolicyManagerConnected()); ConnectManager(); base::RunLoop().RunUntilIdle(); @@ -437,10 +438,10 @@ class DeviceCloudPolicyManagerChromeOSEnrollmentTest .Times(AtMost(1)) .WillOnce(device_management_service_.CreateAsyncJob(®ister_job)); EXPECT_CALL(device_management_service_, - StartJob(dm_protocol::kValueRequestRegister, _, _, _, _, _, _)) + StartJob(dm_protocol::kValueRequestRegister, _, _, _, _, _)) .Times(AtMost(1)) .WillOnce( - DoAll(SaveArg<5>(&client_id_), SaveArg<6>(®ister_request_))); + DoAll(SaveArg<4>(&client_id_), SaveArg<5>(®ister_request_))); DeviceCloudPolicyInitializer::AllowedDeviceModes modes; modes[DEVICE_MODE_ENTERPRISE] = true; @@ -471,7 +472,7 @@ class DeviceCloudPolicyManagerChromeOSEnrollmentTest .Times(AtMost(1)) .WillOnce(device_management_service_.CreateAsyncJob(&policy_fetch_job)); EXPECT_CALL(device_management_service_, - StartJob(dm_protocol::kValueRequestPolicy, _, _, _, _, _, _)) + StartJob(dm_protocol::kValueRequestPolicy, _, _, _, _, _)) .Times(AtMost(1)); register_job->SendResponse(register_status_, register_response_); Mock::VerifyAndClearExpectations(&device_management_service_); @@ -495,9 +496,10 @@ class DeviceCloudPolicyManagerChromeOSEnrollmentTest .Times(AtMost(1)) .WillOnce(device_management_service_.CreateAsyncJob( &robot_auth_fetch_job)); - EXPECT_CALL(device_management_service_, - StartJob(dm_protocol::kValueRequestApiAuthorization, _, _, _, _, - _, _)).Times(AtMost(1)); + EXPECT_CALL( + device_management_service_, + StartJob(dm_protocol::kValueRequestApiAuthorization, _, _, _, _, _)) + .Times(AtMost(1)); base::RunLoop().RunUntilIdle(); Mock::VerifyAndClearExpectations(&device_management_service_); AllowUninterestingRemoteCommandFetches(); @@ -701,7 +703,7 @@ TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, UnregisterSucceeds) { EXPECT_CALL(device_management_service_, CreateJob(DeviceManagementRequestJob::TYPE_UNREGISTRATION, _)) .WillOnce(device_management_service_.SucceedJob(response)); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)); EXPECT_CALL(*this, OnUnregistered(true)); // Start unregistering. @@ -719,7 +721,7 @@ TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, UnregisterFails) { EXPECT_CALL(device_management_service_, CreateJob(DeviceManagementRequestJob::TYPE_UNREGISTRATION, _)) .WillOnce(device_management_service_.FailJob(DM_STATUS_REQUEST_FAILED)); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)); EXPECT_CALL(*this, OnUnregistered(false)); // Start unregistering. diff --git a/chrome/browser/chromeos/policy/device_local_account_policy_service.cc b/chrome/browser/chromeos/policy/device_local_account_policy_service.cc index 944061f9ac7e..d51399801959 100644 --- a/chrome/browser/chromeos/policy/device_local_account_policy_service.cc +++ b/chrome/browser/chromeos/policy/device_local_account_policy_service.cc @@ -71,7 +71,6 @@ scoped_ptr CreateClient( scoped_ptr client( new CloudPolicyClient(std::string(), std::string(), kPolicyVerificationKeyHash, - USER_AFFILIATION_MANAGED, device_management_service, request_context)); client->SetupRegistration(policy_data->request_token(), policy_data->device_id()); diff --git a/chrome/browser/chromeos/policy/device_local_account_policy_service_unittest.cc b/chrome/browser/chromeos/policy/device_local_account_policy_service_unittest.cc index 9bde02b0dd0e..53649bf65acb 100644 --- a/chrome/browser/chromeos/policy/device_local_account_policy_service_unittest.cc +++ b/chrome/browser/chromeos/policy/device_local_account_policy_service_unittest.cc @@ -407,14 +407,12 @@ TEST_F(DeviceLocalAccountPolicyServiceTest, FetchPolicy) { EXPECT_CALL(mock_device_management_service_, CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, _)) .WillOnce(mock_device_management_service_.SucceedJob(response)); - EXPECT_CALL(mock_device_management_service_, - StartJob(dm_protocol::kValueRequestPolicy, - std::string(), std::string(), - device_policy_.policy_data().request_token(), - dm_protocol::kValueUserAffiliationManaged, - device_policy_.policy_data().device_id(), - _)) - .WillOnce(SaveArg<6>(&request)); + EXPECT_CALL( + mock_device_management_service_, + StartJob(dm_protocol::kValueRequestPolicy, std::string(), std::string(), + device_policy_.policy_data().request_token(), + device_policy_.policy_data().device_id(), _)) + .WillOnce(SaveArg<5>(&request)); // This will be called twice, because the ComponentCloudPolicyService will // also become ready after flushing all the pending tasks. EXPECT_CALL(service_observer_, OnPolicyUpdated(account_1_user_id_)).Times(2); @@ -474,7 +472,7 @@ TEST_F(DeviceLocalAccountPolicyServiceTest, RefreshPolicy) { device_local_account_policy_.policy()); EXPECT_CALL(mock_device_management_service_, CreateJob(_, _)) .WillOnce(mock_device_management_service_.SucceedJob(response)); - EXPECT_CALL(mock_device_management_service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(mock_device_management_service_, StartJob(_, _, _, _, _, _)); EXPECT_CALL(*this, OnRefreshDone(true)).Times(1); // This will be called twice, because the ComponentCloudPolicyService will // also become ready after flushing all the pending tasks. @@ -949,7 +947,7 @@ TEST_F(DeviceLocalAccountPolicyProviderTest, RefreshPolicies) { EXPECT_CALL(mock_device_management_service_, CreateJob(_, _)) .WillRepeatedly( mock_device_management_service_.FailJob(DM_STATUS_REQUEST_FAILED)); - EXPECT_CALL(mock_device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(mock_device_management_service_, StartJob(_, _, _, _, _, _)) .Times(AnyNumber()); service_->Connect(&mock_device_management_service_); FlushDeviceSettings(); @@ -960,7 +958,7 @@ TEST_F(DeviceLocalAccountPolicyProviderTest, RefreshPolicies) { MockDeviceManagementJob* request_job; EXPECT_CALL(mock_device_management_service_, CreateJob(_, _)) .WillOnce(mock_device_management_service_.CreateAsyncJob(&request_job)); - EXPECT_CALL(mock_device_management_service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(mock_device_management_service_, StartJob(_, _, _, _, _, _)); provider_->RefreshPolicies(); ReloadDeviceSettings(); Mock::VerifyAndClearExpectations(&provider_observer_); diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc index 91f65eeec870..ff817c71a819 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc @@ -107,8 +107,7 @@ UserCloudPolicyManagerChromeOS::~UserCloudPolicyManagerChromeOS() {} void UserCloudPolicyManagerChromeOS::Connect( PrefService* local_state, DeviceManagementService* device_management_service, - scoped_refptr system_request_context, - UserAffiliation user_affiliation) { + scoped_refptr system_request_context) { DCHECK(device_management_service); DCHECK(local_state); local_state_ = local_state; @@ -123,10 +122,9 @@ void UserCloudPolicyManagerChromeOS::Connect( request_context = new SystemPolicyRequestContext( system_request_context, GetUserAgent()); } - scoped_ptr cloud_policy_client( - new CloudPolicyClient(std::string(), std::string(), - kPolicyVerificationKeyHash, user_affiliation, - device_management_service, request_context)); + scoped_ptr cloud_policy_client(new CloudPolicyClient( + std::string(), std::string(), kPolicyVerificationKeyHash, + device_management_service, request_context)); CreateComponentCloudPolicyService(component_policy_cache_path_, request_context, cloud_policy_client.get()); core()->Connect(cloud_policy_client.Pass()); diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h index a7df866b14e2..8fcefc381f20 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h @@ -68,8 +68,7 @@ class UserCloudPolicyManagerChromeOS : public CloudPolicyManager, void Connect( PrefService* local_state, DeviceManagementService* device_management_service, - scoped_refptr system_request_context, - UserAffiliation user_affiliation); + scoped_refptr system_request_context); // This class is one of the policy providers, and must be ready for the // creation of the Profile's PrefService; all the other diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc index 6e3b68cd129f..8790d09f7bfa 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc @@ -149,7 +149,7 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test { ASSERT_TRUE(policy_data_.SerializeToString( policy_response->mutable_policy_data())); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)) .Times(AnyNumber()); } @@ -181,8 +181,7 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test { task_runner_)); manager_->Init(&schema_registry_); manager_->AddObserver(&observer_); - manager_->Connect(&prefs_, &device_management_service_, NULL, - USER_AFFILIATION_NONE); + manager_->Connect(&prefs_, &device_management_service_, NULL); Mock::VerifyAndClearExpectations(store_); EXPECT_FALSE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); EXPECT_FALSE(manager_->core()->service()->IsInitializationComplete()); @@ -280,7 +279,7 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test { EXPECT_FALSE(manager_->core()->client()->is_registered()); Mock::VerifyAndClearExpectations(&device_management_service_); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)) .Times(AnyNumber()); return register_request; @@ -300,7 +299,7 @@ class UserCloudPolicyManagerChromeOSTest : public testing::Test { EXPECT_TRUE(manager_->core()->client()->is_registered()); Mock::VerifyAndClearExpectations(&device_management_service_); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)) .Times(AnyNumber()); // Send the initial policy back. This completes the initialization flow. diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc index eb7c5613452b..65da55cd4913 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.cc @@ -217,10 +217,8 @@ scoped_ptr manager->Init( SchemaRegistryServiceFactory::GetForContext(profile)->registry()); - manager->Connect(g_browser_process->local_state(), - device_management_service, - g_browser_process->system_request_context(), - affiliation); + manager->Connect(g_browser_process->local_state(), device_management_service, + g_browser_process->system_request_context()); DCHECK(managers_.find(profile) == managers_.end()); managers_[profile] = manager.get(); diff --git a/chrome/browser/policy/cloud/device_management_service_browsertest.cc b/chrome/browser/policy/cloud/device_management_service_browsertest.cc index d8ab7a97aedc..76d13eda4c5c 100644 --- a/chrome/browser/policy/cloud/device_management_service_browsertest.cc +++ b/chrome/browser/policy/cloud/device_management_service_browsertest.cc @@ -217,7 +217,6 @@ IN_PROC_BROWSER_TEST_P(DeviceManagementServiceIntegrationTest, PolicyFetch) { service_->CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, g_browser_process->system_request_context())); job->SetDMToken(token_); - job->SetUserAffiliation(USER_AFFILIATION_NONE); job->SetClientID("testid"); em::DevicePolicyRequest* request = job->GetRequest()->mutable_policy_request(); diff --git a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc index d093c3beb034..a1cfd8c40606 100644 --- a/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc +++ b/chrome/browser/policy/cloud/user_policy_signin_service_unittest.cc @@ -268,7 +268,7 @@ class UserPolicySigninServiceTest : public testing::Test { CreateJob(DeviceManagementRequestJob::TYPE_REGISTRATION, _)) .WillOnce(device_management_service_.CreateAsyncJob( ®ister_request)); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)) .Times(1); // Now mimic the user being a hosted domain - this should cause a Register() @@ -300,7 +300,7 @@ class UserPolicySigninServiceTest : public testing::Test { EXPECT_CALL(device_management_service_, CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, _)) .WillOnce(device_management_service_.CreateAsyncJob(&fetch_request)); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)) .Times(1); signin_service->FetchPolicyForSignedInUser( @@ -658,7 +658,7 @@ TEST_F(UserPolicySigninServiceTest, RegisterPolicyClientFailedRegistration) { EXPECT_CALL(device_management_service_, CreateJob(DeviceManagementRequestJob::TYPE_REGISTRATION, _)) .WillOnce(device_management_service_.CreateAsyncJob(®ister_request)); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)) .Times(1); // Now mimic the user being a hosted domain - this should cause a Register() @@ -692,7 +692,7 @@ TEST_F(UserPolicySigninServiceTest, RegisterPolicyClientSucceeded) { EXPECT_CALL(device_management_service_, CreateJob(DeviceManagementRequestJob::TYPE_REGISTRATION, _)) .WillOnce(device_management_service_.CreateAsyncJob(®ister_request)); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)) .Times(1); // Now mimic the user being a hosted domain - this should cause a Register() @@ -725,7 +725,7 @@ TEST_F(UserPolicySigninServiceTest, FetchPolicyFailed) { EXPECT_CALL(device_management_service_, CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, _)) .WillOnce(device_management_service_.CreateAsyncJob(&fetch_request)); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)) .Times(1); UserPolicySigninService* signin_service = UserPolicySigninServiceFactory::GetForProfile(profile_.get()); @@ -773,7 +773,7 @@ TEST_F(UserPolicySigninServiceTest, PolicyFetchFailureTemporary) { EXPECT_CALL(device_management_service_, CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, _)) .WillOnce(device_management_service_.CreateAsyncJob(&fetch_request)); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)) .Times(1); manager_->RefreshPolicies(); Mock::VerifyAndClearExpectations(this); @@ -799,7 +799,7 @@ TEST_F(UserPolicySigninServiceTest, PolicyFetchFailureDisableManagement) { EXPECT_CALL(device_management_service_, CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, _)) .WillOnce(device_management_service_.CreateAsyncJob(&fetch_request)); - EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) + EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _)) .Times(1); manager_->RefreshPolicies(); Mock::VerifyAndClearExpectations(this); diff --git a/components/policy/core/common/cloud/cloud_policy_client.cc b/components/policy/core/common/cloud/cloud_policy_client.cc index 83b315a74fb4..e2060fa0a678 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.cc +++ b/components/policy/core/common/cloud/cloud_policy_client.cc @@ -50,13 +50,11 @@ CloudPolicyClient::CloudPolicyClient( const std::string& machine_id, const std::string& machine_model, const std::string& verification_key_hash, - UserAffiliation user_affiliation, DeviceManagementService* service, scoped_refptr request_context) : machine_id_(machine_id), machine_model_(machine_model), verification_key_hash_(verification_key_hash), - user_affiliation_(user_affiliation), device_mode_(DEVICE_MODE_NOT_SET), submit_machine_id_(false), public_key_version_(-1), @@ -151,7 +149,6 @@ void CloudPolicyClient::FetchPolicy() { GetRequestContext())); policy_fetch_request_job_->SetDMToken(dm_token_); policy_fetch_request_job_->SetClientID(client_id_); - policy_fetch_request_job_->SetUserAffiliation(user_affiliation_); em::DeviceManagementRequest* request = policy_fetch_request_job_->GetRequest(); diff --git a/components/policy/core/common/cloud/cloud_policy_client.h b/components/policy/core/common/cloud/cloud_policy_client.h index 2015b936aa2a..41e87f7341b3 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.h +++ b/components/policy/core/common/cloud/cloud_policy_client.h @@ -85,7 +85,6 @@ class POLICY_EXPORT CloudPolicyClient { const std::string& machine_id, const std::string& machine_model, const std::string& verification_key_hash, - UserAffiliation user_affiliation, DeviceManagementService* service, scoped_refptr request_context); virtual ~CloudPolicyClient(); @@ -339,7 +338,6 @@ class POLICY_EXPORT CloudPolicyClient { const std::string machine_id_; const std::string machine_model_; const std::string verification_key_hash_; - const UserAffiliation user_affiliation_; PolicyTypeSet types_to_fetch_; std::vector state_keys_to_upload_; diff --git a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc index 226f1feac036..f61e28583416 100644 --- a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc @@ -145,7 +145,7 @@ class CloudPolicyClientTest : public testing::Test { } void SetUp() override { - CreateClient(USER_AFFILIATION_NONE); + CreateClient(); } void TearDown() override { @@ -157,7 +157,7 @@ class CloudPolicyClientTest : public testing::Test { client_->SetupRegistration(kDMToken, client_id_); } - void CreateClient(UserAffiliation user_affiliation) { + void CreateClient() { if (client_.get()) client_->RemoveObserver(&observer_); @@ -165,7 +165,6 @@ class CloudPolicyClientTest : public testing::Test { new net::TestURLRequestContextGetter(loop_.task_runner()); client_.reset(new CloudPolicyClient(kMachineID, kMachineModel, kPolicyVerificationKeyHash, - user_affiliation, &service_, request_context_)); client_->AddPolicyTypeToFetch(policy_type_, std::string()); @@ -179,20 +178,19 @@ class CloudPolicyClientTest : public testing::Test { .WillOnce(service_.SucceedJob(registration_response_)); EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestRegister, std::string(), - oauth_token, std::string(), std::string(), _, + oauth_token, std::string(), _, MatchProto(registration_request_))) - .WillOnce(SaveArg<5>(&client_id_)); + .WillOnce(SaveArg<4>(&client_id_)); } - void ExpectPolicyFetch(const std::string& dm_token, - const std::string& user_affiliation) { + void ExpectPolicyFetch(const std::string& dm_token) { EXPECT_CALL(service_, CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, request_context_)) .WillOnce(service_.SucceedJob(policy_response_)); EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestPolicy, std::string(), - std::string(), dm_token, user_affiliation, client_id_, + std::string(), dm_token, client_id_, MatchProto(policy_request_))); } @@ -203,7 +201,7 @@ class CloudPolicyClientTest : public testing::Test { .WillOnce(service_.SucceedJob(unregistration_response_)); EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestUnregister, std::string(), - std::string(), dm_token, std::string(), client_id_, + std::string(), dm_token, client_id_, MatchProto(unregistration_request_))); } @@ -214,8 +212,8 @@ class CloudPolicyClientTest : public testing::Test { .WillOnce(service_.SucceedJob(upload_certificate_response_)); EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestUploadCertificate, - std::string(), std::string(), kDMToken, std::string(), - client_id_, MatchProto(upload_certificate_request_))); + std::string(), std::string(), kDMToken, client_id_, + MatchProto(upload_certificate_request_))); } void ExpectUploadStatus() { @@ -225,7 +223,7 @@ class CloudPolicyClientTest : public testing::Test { .WillOnce(service_.SucceedJob(upload_status_response_)); EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestUploadStatus, - std::string(), std::string(), kDMToken, std::string(), + std::string(), std::string(), kDMToken, client_id_, MatchProto(upload_status_request_))); } @@ -236,7 +234,7 @@ class CloudPolicyClientTest : public testing::Test { .WillOnce(service_.SucceedJob(remote_command_response_)); EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestRemoteCommands, - std::string(), std::string(), kDMToken, std::string(), + std::string(), std::string(), kDMToken, client_id_, MatchProto(remote_command_request_))); } @@ -249,7 +247,7 @@ class CloudPolicyClientTest : public testing::Test { EXPECT_CALL(service_, StartJob( dm_protocol::kValueRequestDeviceAttributeUpdatePermission, - std::string(), oauth_token, std::string(), std::string(), + std::string(), oauth_token, std::string(), client_id_, MatchProto(attribute_update_permission_request_))); } @@ -262,8 +260,7 @@ class CloudPolicyClientTest : public testing::Test { EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestDeviceAttributeUpdate, std::string(), oauth_token, std::string(), - std::string(), client_id_, - MatchProto(attribute_update_request_))); + client_id_, MatchProto(attribute_update_request_))); } void CheckPolicyResponse() { @@ -324,7 +321,7 @@ TEST_F(CloudPolicyClientTest, SetupRegistrationAndPolicyFetch) { EXPECT_TRUE(client_->is_registered()); EXPECT_FALSE(client_->GetPolicyFor(policy_type_, std::string())); - ExpectPolicyFetch(kDMToken, dm_protocol::kValueUserAffiliationNone); + ExpectPolicyFetch(kDMToken); EXPECT_CALL(observer_, OnPolicyFetched(_)); client_->FetchPolicy(); EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); @@ -341,7 +338,7 @@ TEST_F(CloudPolicyClientTest, RegistrationAndPolicyFetch) { EXPECT_FALSE(client_->GetPolicyFor(policy_type_, std::string())); EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); - ExpectPolicyFetch(kDMToken, dm_protocol::kValueUserAffiliationNone); + ExpectPolicyFetch(kDMToken); EXPECT_CALL(observer_, OnPolicyFetched(_)); client_->FetchPolicy(); EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); @@ -382,7 +379,7 @@ TEST_F(CloudPolicyClientTest, RegistrationFailure) { CreateJob(DeviceManagementRequestJob::TYPE_REGISTRATION, request_context_)) .WillOnce(service_.FailJob(DM_STATUS_REQUEST_FAILED)); - EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(service_, StartJob(_, _, _, _, _, _)); EXPECT_CALL(observer_, OnClientError(_)); client_->Register(em::DeviceRegisterRequest::USER, em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, @@ -403,7 +400,7 @@ TEST_F(CloudPolicyClientTest, RetryRegistration) { .WillOnce(service_.CreateAsyncJob(®ister_job)); EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestRegister, std::string(), - kOAuthToken, std::string(), std::string(), _, + kOAuthToken, std::string(), _, MatchProto(registration_request_))); client_->Register(em::DeviceRegisterRequest::USER, em::DeviceRegisterRequest::FLAVOR_USER_REGISTRATION, @@ -415,7 +412,7 @@ TEST_F(CloudPolicyClientTest, RetryRegistration) { registration_request_.mutable_register_request()->set_reregister(true); EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestRegister, std::string(), - kOAuthToken, std::string(), std::string(), _, + kOAuthToken, std::string(), _, MatchProto(registration_request_))); register_job->RetryJob(); Mock::VerifyAndClearExpectations(&service_); @@ -423,7 +420,7 @@ TEST_F(CloudPolicyClientTest, RetryRegistration) { // Subsequent retries keep the flag set. EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestRegister, std::string(), - kOAuthToken, std::string(), std::string(), _, + kOAuthToken, std::string(), _, MatchProto(registration_request_))); register_job->RetryJob(); Mock::VerifyAndClearExpectations(&service_); @@ -432,7 +429,7 @@ TEST_F(CloudPolicyClientTest, RetryRegistration) { TEST_F(CloudPolicyClientTest, PolicyUpdate) { Register(); - ExpectPolicyFetch(kDMToken, dm_protocol::kValueUserAffiliationNone); + ExpectPolicyFetch(kDMToken); EXPECT_CALL(observer_, OnPolicyFetched(_)); client_->FetchPolicy(); CheckPolicyResponse(); @@ -440,7 +437,7 @@ TEST_F(CloudPolicyClientTest, PolicyUpdate) { policy_response_.mutable_policy_response()->clear_response(); policy_response_.mutable_policy_response()->add_response()->set_policy_data( CreatePolicyData("updated-fake-policy-data")); - ExpectPolicyFetch(kDMToken, dm_protocol::kValueUserAffiliationNone); + ExpectPolicyFetch(kDMToken); EXPECT_CALL(observer_, OnPolicyFetched(_)); client_->FetchPolicy(); EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); @@ -462,7 +459,7 @@ TEST_F(CloudPolicyClientTest, PolicyFetchWithMetaData) { (timestamp - base::Time::UnixEpoch()).InMilliseconds()); policy_fetch_request->set_public_key_version(42); - ExpectPolicyFetch(kDMToken, dm_protocol::kValueUserAffiliationNone); + ExpectPolicyFetch(kDMToken); EXPECT_CALL(observer_, OnPolicyFetched(_)); client_->FetchPolicy(); CheckPolicyResponse(); @@ -479,7 +476,7 @@ TEST_F(CloudPolicyClientTest, PolicyFetchWithInvalidation) { policy_fetch_request->set_invalidation_version(12345); policy_fetch_request->set_invalidation_payload("12345"); - ExpectPolicyFetch(kDMToken, dm_protocol::kValueUserAffiliationNone); + ExpectPolicyFetch(kDMToken); EXPECT_CALL(observer_, OnPolicyFetched(_)); client_->FetchPolicy(); CheckPolicyResponse(); @@ -493,7 +490,7 @@ TEST_F(CloudPolicyClientTest, PolicyFetchWithInvalidationNoPayload) { client_->SetInvalidationInfo(-12345, std::string()); EXPECT_EQ(previous_version, client_->fetched_invalidation_version()); - ExpectPolicyFetch(kDMToken, dm_protocol::kValueUserAffiliationNone); + ExpectPolicyFetch(kDMToken); EXPECT_CALL(observer_, OnPolicyFetched(_)); client_->FetchPolicy(); CheckPolicyResponse(); @@ -504,7 +501,7 @@ TEST_F(CloudPolicyClientTest, BadPolicyResponse) { Register(); policy_response_.clear_policy_response(); - ExpectPolicyFetch(kDMToken, dm_protocol::kValueUserAffiliationNone); + ExpectPolicyFetch(kDMToken); EXPECT_CALL(observer_, OnClientError(_)); client_->FetchPolicy(); EXPECT_FALSE(client_->GetPolicyFor(policy_type_, std::string())); @@ -514,7 +511,7 @@ TEST_F(CloudPolicyClientTest, BadPolicyResponse) { CreatePolicyData("fake-policy-data")); policy_response_.mutable_policy_response()->add_response()->set_policy_data( CreatePolicyData("excess-fake-policy-data")); - ExpectPolicyFetch(kDMToken, dm_protocol::kValueUserAffiliationNone); + ExpectPolicyFetch(kDMToken); EXPECT_CALL(observer_, OnPolicyFetched(_)); client_->FetchPolicy(); EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); @@ -528,7 +525,7 @@ TEST_F(CloudPolicyClientTest, PolicyRequestFailure) { CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, request_context_)) .WillOnce(service_.FailJob(DM_STATUS_REQUEST_FAILED)); - EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(service_, StartJob(_, _, _, _, _, _)); EXPECT_CALL(observer_, OnClientError(_)); client_->FetchPolicy(); EXPECT_EQ(DM_STATUS_REQUEST_FAILED, client_->status()); @@ -553,7 +550,7 @@ TEST_F(CloudPolicyClientTest, UnregisterEmpty) { CreateJob(DeviceManagementRequestJob::TYPE_UNREGISTRATION, request_context_)) .WillOnce(service_.SucceedJob(unregistration_response_)); - EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(service_, StartJob(_, _, _, _, _, _)); EXPECT_CALL(observer_, OnRegistrationStateChanged(_)); client_->Unregister(); EXPECT_FALSE(client_->is_registered()); @@ -567,7 +564,7 @@ TEST_F(CloudPolicyClientTest, UnregisterFailure) { CreateJob(DeviceManagementRequestJob::TYPE_UNREGISTRATION, request_context_)) .WillOnce(service_.FailJob(DM_STATUS_REQUEST_FAILED)); - EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(service_, StartJob(_, _, _, _, _, _)); EXPECT_CALL(observer_, OnClientError(_)); client_->Unregister(); EXPECT_TRUE(client_->is_registered()); @@ -613,8 +610,8 @@ TEST_F(CloudPolicyClientTest, PolicyFetchWithExtensionPolicy) { EXPECT_CALL( service_, StartJob(dm_protocol::kValueRequestPolicy, std::string(), std::string(), - kDMToken, dm_protocol::kValueUserAffiliationNone, client_id_, _)) - .WillOnce(SaveArg<6>(&policy_request_)); + kDMToken, client_id_, _)) + .WillOnce(SaveArg<5>(&policy_request_)); EXPECT_CALL(observer_, OnPolicyFetched(_)); client_->AddPolicyTypeToFetch(dm_protocol::kChromeExtensionPolicyType, std::string()); @@ -678,7 +675,7 @@ TEST_F(CloudPolicyClientTest, UploadCertificateFailure) { CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_CERTIFICATE, request_context_)) .WillOnce(service_.FailJob(DM_STATUS_REQUEST_FAILED)); - EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(service_, StartJob(_, _, _, _, _, _)); EXPECT_CALL(observer_, OnClientError(_)); CloudPolicyClient::StatusCallback callback = base::Bind( &MockStatusCallbackObserver::OnCallbackComplete, @@ -708,7 +705,7 @@ TEST_F(CloudPolicyClientTest, UploadStatusWhilePolicyFetchActive) { CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_STATUS, request_context_)) .WillOnce(service_.CreateAsyncJob(&upload_status_job)); - EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(service_, StartJob(_, _, _, _, _, _)); EXPECT_CALL(callback_observer_, OnCallbackComplete(true)).Times(1); CloudPolicyClient::StatusCallback callback = base::Bind( &MockStatusCallbackObserver::OnCallbackComplete, @@ -718,7 +715,7 @@ TEST_F(CloudPolicyClientTest, UploadStatusWhilePolicyFetchActive) { client_->UploadDeviceStatus(&device_status, &session_status, callback); // Now initiate a policy fetch - this should not cancel the upload job. - ExpectPolicyFetch(kDMToken, dm_protocol::kValueUserAffiliationNone); + ExpectPolicyFetch(kDMToken); EXPECT_CALL(observer_, OnPolicyFetched(_)); client_->FetchPolicy(); CheckPolicyResponse(); @@ -736,7 +733,7 @@ TEST_F(CloudPolicyClientTest, MultipleActiveRequests) { CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_STATUS, request_context_)) .WillOnce(service_.CreateAsyncJob(&upload_status_job)); - EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(service_, StartJob(_, _, _, _, _, _)); CloudPolicyClient::StatusCallback callback = base::Bind( &MockStatusCallbackObserver::OnCallbackComplete, base::Unretained(&callback_observer_)); @@ -750,7 +747,7 @@ TEST_F(CloudPolicyClientTest, MultipleActiveRequests) { CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_CERTIFICATE, request_context_)) .WillOnce(service_.CreateAsyncJob(&upload_certificate_job)); - EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(service_, StartJob(_, _, _, _, _, _)); // Expect two calls on our upload observer, one for the status upload and // one for the certificate upload. @@ -779,7 +776,7 @@ TEST_F(CloudPolicyClientTest, UploadStatusFailure) { CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_STATUS, request_context_)) .WillOnce(service_.FailJob(DM_STATUS_REQUEST_FAILED)); - EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(service_, StartJob(_, _, _, _, _, _)); EXPECT_CALL(observer_, OnClientError(_)); CloudPolicyClient::StatusCallback callback = base::Bind( &MockStatusCallbackObserver::OnCallbackComplete, @@ -800,7 +797,7 @@ TEST_F(CloudPolicyClientTest, RequestCancelOnUnregister) { CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_STATUS, request_context_)) .WillOnce(service_.CreateAsyncJob(&upload_status_job)); - EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)); + EXPECT_CALL(service_, StartJob(_, _, _, _, _, _)); CloudPolicyClient::StatusCallback callback = base::Bind( &MockStatusCallbackObserver::OnCallbackComplete, base::Unretained(&callback_observer_)); diff --git a/components/policy/core/common/cloud/cloud_policy_constants.cc b/components/policy/core/common/cloud/cloud_policy_constants.cc index 28a08f686607..12ef2d18b753 100644 --- a/components/policy/core/common/cloud/cloud_policy_constants.cc +++ b/components/policy/core/common/cloud/cloud_policy_constants.cc @@ -25,7 +25,6 @@ const char kParamDeviceType[] = "devicetype"; const char kParamOAuthToken[] = "oauth_token"; const char kParamPlatform[] = "platform"; const char kParamRequest[] = "request"; -const char kParamUserAffiliation[] = "user_affiliation"; // String constants for the device and app type we report to the server. const char kValueAppType[] = "Chrome"; @@ -39,8 +38,6 @@ const char kValueRequestUploadCertificate[] = "cert_upload"; const char kValueRequestDeviceStateRetrieval[] = "device_state_retrieval"; const char kValueRequestUploadStatus[] = "status_upload"; const char kValueRequestRemoteCommands[] = "remote_commands"; -const char kValueUserAffiliationManaged[] = "managed"; -const char kValueUserAffiliationNone[] = "none"; const char kValueRequestDeviceAttributeUpdatePermission[] = "device_attribute_update_permission"; const char kValueRequestDeviceAttributeUpdate[] = "device_attribute_update"; diff --git a/components/policy/core/common/cloud/cloud_policy_constants.h b/components/policy/core/common/cloud/cloud_policy_constants.h index 487a2e0e82ad..ae76583ceee6 100644 --- a/components/policy/core/common/cloud/cloud_policy_constants.h +++ b/components/policy/core/common/cloud/cloud_policy_constants.h @@ -26,7 +26,6 @@ POLICY_EXPORT extern const char kParamDeviceType[]; POLICY_EXPORT extern const char kParamOAuthToken[]; POLICY_EXPORT extern const char kParamPlatform[]; POLICY_EXPORT extern const char kParamRequest[]; -POLICY_EXPORT extern const char kParamUserAffiliation[]; // String extern constants for the device and app type we report to the server. POLICY_EXPORT extern const char kValueAppType[]; @@ -40,8 +39,6 @@ POLICY_EXPORT extern const char kValueRequestUploadCertificate[]; POLICY_EXPORT extern const char kValueRequestDeviceStateRetrieval[]; POLICY_EXPORT extern const char kValueRequestUploadStatus[]; POLICY_EXPORT extern const char kValueRequestRemoteCommands[]; -POLICY_EXPORT extern const char kValueUserAffiliationManaged[]; -POLICY_EXPORT extern const char kValueUserAffiliationNone[]; POLICY_EXPORT extern const char kValueRequestDeviceAttributeUpdatePermission[]; POLICY_EXPORT extern const char kValueRequestDeviceAttributeUpdate[]; @@ -67,6 +64,8 @@ POLICY_EXPORT extern const char kChromePolicyHeader[]; POLICY_EXPORT std::string GetPolicyVerificationKey(); POLICY_EXPORT extern const char kPolicyVerificationKeyHash[]; +// TODO(peletskyi): Remove this enum after affiliation code is moved +// to components/user_manager. // Describes the affiliation of a user w.r.t. the device owner. enum UserAffiliation { // User is on the same domain the device was registered with. diff --git a/components/policy/core/common/cloud/device_management_service.cc b/components/policy/core/common/cloud/device_management_service.cc index 3a53d98bdae4..e1ff30d5b30d 100644 --- a/components/policy/core/common/cloud/device_management_service.cc +++ b/components/policy/core/common/cloud/device_management_service.cc @@ -99,17 +99,6 @@ bool FailedWithProxy(const net::URLFetcher* fetcher) { return false; } -const char* UserAffiliationToString(UserAffiliation affiliation) { - switch (affiliation) { - case USER_AFFILIATION_MANAGED: - return dm_protocol::kValueUserAffiliationManaged; - case USER_AFFILIATION_NONE: - return dm_protocol::kValueUserAffiliationNone; - } - NOTREACHED() << "Invalid user affiliation " << affiliation; - return dm_protocol::kValueUserAffiliationNone; -} - const char* JobTypeToRequestType(DeviceManagementRequestJob::JobType type) { switch (type) { case DeviceManagementRequestJob::TYPE_AUTO_ENROLLMENT: @@ -371,12 +360,6 @@ void DeviceManagementRequestJob::SetOAuthToken(const std::string& oauth_token) { AddParameter(dm_protocol::kParamOAuthToken, oauth_token); } -void DeviceManagementRequestJob::SetUserAffiliation( - UserAffiliation user_affiliation) { - AddParameter(dm_protocol::kParamUserAffiliation, - UserAffiliationToString(user_affiliation)); -} - void DeviceManagementRequestJob::SetDMToken(const std::string& dm_token) { dm_token_ = dm_token; } diff --git a/components/policy/core/common/cloud/device_management_service.h b/components/policy/core/common/cloud/device_management_service.h index 6cf4e440d37f..62223e5ece38 100644 --- a/components/policy/core/common/cloud/device_management_service.h +++ b/components/policy/core/common/cloud/device_management_service.h @@ -63,7 +63,6 @@ class POLICY_EXPORT DeviceManagementRequestJob { // Start()ing the job, but never afterwards. void SetGaiaToken(const std::string& gaia_token); void SetOAuthToken(const std::string& oauth_token); - void SetUserAffiliation(UserAffiliation user_affiliation); void SetDMToken(const std::string& dm_token); void SetClientID(const std::string& client_id); enterprise_management::DeviceManagementRequest* GetRequest(); diff --git a/components/policy/core/common/cloud/mock_cloud_policy_client.cc b/components/policy/core/common/cloud/mock_cloud_policy_client.cc index df3a2c1829c8..47b09c30001b 100644 --- a/components/policy/core/common/cloud/mock_cloud_policy_client.cc +++ b/components/policy/core/common/cloud/mock_cloud_policy_client.cc @@ -16,7 +16,6 @@ MockCloudPolicyClient::MockCloudPolicyClient() : CloudPolicyClient(std::string(), std::string(), std::string(), - USER_AFFILIATION_NONE, nullptr, nullptr) {} diff --git a/components/policy/core/common/cloud/mock_device_management_service.cc b/components/policy/core/common/cloud/mock_device_management_service.cc index 970dd01bf7c4..35a06490f25d 100644 --- a/components/policy/core/common/cloud/mock_device_management_service.cc +++ b/components/policy/core/common/cloud/mock_device_management_service.cc @@ -34,7 +34,6 @@ class MockRequestJobBase : public DeviceManagementRequestJob { gaia_token_, ExtractParameter(dm_protocol::kParamOAuthToken), dm_token_, - ExtractParameter(dm_protocol::kParamUserAffiliation), ExtractParameter(dm_protocol::kParamDeviceID), request_); } diff --git a/components/policy/core/common/cloud/mock_device_management_service.h b/components/policy/core/common/cloud/mock_device_management_service.h index 7cc64491a599..63906fe23f56 100644 --- a/components/policy/core/common/cloud/mock_device_management_service.h +++ b/components/policy/core/common/cloud/mock_device_management_service.h @@ -51,13 +51,12 @@ class MockDeviceManagementService : public DeviceManagementService { const scoped_refptr&); MOCK_METHOD2(CreateJob, CreateJobFunction); - MOCK_METHOD7( + MOCK_METHOD6( StartJob, void(const std::string& request_type, const std::string& gaia_token, const std::string& oauth_token, const std::string& dm_token, - const std::string& user_affiliation, const std::string& client_id, const enterprise_management::DeviceManagementRequest& request)); diff --git a/components/policy/core/common/cloud/user_cloud_policy_manager.cc b/components/policy/core/common/cloud/user_cloud_policy_manager.cc index 1bfee864d7b5..416d9b21e52f 100644 --- a/components/policy/core/common/cloud/user_cloud_policy_manager.cc +++ b/components/policy/core/common/cloud/user_cloud_policy_manager.cc @@ -73,7 +73,6 @@ UserCloudPolicyManager::CreateCloudPolicyClient( std::string(), std::string(), kPolicyVerificationKeyHash, - USER_AFFILIATION_NONE, device_management_service, request_context)).Pass(); } diff --git a/components/policy/core/common/remote_commands/remote_commands_service_unittest.cc b/components/policy/core/common/remote_commands/remote_commands_service_unittest.cc index 2fa5dea7dfd3..517aa65ecec8 100644 --- a/components/policy/core/common/remote_commands/remote_commands_service_unittest.cc +++ b/components/policy/core/common/remote_commands/remote_commands_service_unittest.cc @@ -80,7 +80,6 @@ class TestingCloudPolicyClientForRemoteCommands : public CloudPolicyClient { : CloudPolicyClient(std::string(), /* machine_id */ std::string(), /* machine_model */ std::string(), /* verification_key_hash */ - USER_AFFILIATION_NONE, nullptr, nullptr), server_(server) { -- 2.11.4.GIT