Commit cea9e0d5 authored by mnissler@chromium.org's avatar mnissler@chromium.org

Revert 98987 - Pass user_affiliation request parameter on user cloud policy requests.

BUG=chromium-os:17809
TEST=Enroll device, login as an enterprise user, check user_affiliation parameter in policy requests.

Review URL: http://codereview.chromium.org/7810025

TBR=mnissler@chromium.org
Review URL: http://codereview.chromium.org/7785032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98989 0039d316-1c4b-4281-b951-d872f2087c98
parent bd1a1a4b
...@@ -213,8 +213,6 @@ void BrowserPolicyConnector::InitializeUserPolicy(const std::string& user_name, ...@@ -213,8 +213,6 @@ void BrowserPolicyConnector::InitializeUserPolicy(const std::string& user_name,
user_policy_token_cache_->Load(); user_policy_token_cache_->Load();
user_data_store_->set_user_name(user_name); user_data_store_->set_user_name(user_name);
user_data_store_->set_user_affiliation(GetUserAffiliation(user_name));
if (token_service_ && if (token_service_ &&
token_service_->HasTokenForService( token_service_->HasTokenForService(
GaiaConstants::kDeviceManagementService)) { GaiaConstants::kDeviceManagementService)) {
...@@ -339,21 +337,6 @@ void BrowserPolicyConnector::InitializeDevicePolicySubsystem() { ...@@ -339,21 +337,6 @@ void BrowserPolicyConnector::InitializeDevicePolicySubsystem() {
#endif #endif
} }
CloudPolicyDataStore::UserAffiliation
BrowserPolicyConnector::GetUserAffiliation(const std::string& user_name) {
#if defined(OS_CHROMEOS)
if (install_attributes_.get()) {
size_t pos = user_name.find('@');
if (pos != std::string::npos &&
user_name.substr(pos + 1) == install_attributes_->GetDomain()) {
return CloudPolicyDataStore::USER_AFFILIATION_MANAGED;
}
}
#endif
return CloudPolicyDataStore::USER_AFFILIATION_NONE;
}
// static // static
BrowserPolicyConnector* BrowserPolicyConnector::CreateForTests() { BrowserPolicyConnector* BrowserPolicyConnector::CreateForTests() {
const ConfigurationPolicyProvider::PolicyDefinitionList* const ConfigurationPolicyProvider::PolicyDefinitionList*
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/task.h" #include "base/task.h"
#include "chrome/browser/policy/cloud_policy_data_store.h"
#include "chrome/browser/policy/enterprise_install_attributes.h" #include "chrome/browser/policy/enterprise_install_attributes.h"
#include "content/common/notification_observer.h" #include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h" #include "content/common/notification_registrar.h"
...@@ -135,11 +134,6 @@ class BrowserPolicyConnector : public NotificationObserver { ...@@ -135,11 +134,6 @@ class BrowserPolicyConnector : public NotificationObserver {
// be running. // be running.
void InitializeDevicePolicySubsystem(); void InitializeDevicePolicySubsystem();
// Works out the user affiliation by checking the given |user_name| against
// the installation attributes.
policy::CloudPolicyDataStore::UserAffiliation GetUserAffiliation(
const std::string& user_name);
static BrowserPolicyConnector* CreateForTests(); static BrowserPolicyConnector* CreateForTests();
static ConfigurationPolicyProvider* CreateManagedPlatformProvider(); static ConfigurationPolicyProvider* CreateManagedPlatformProvider();
static ConfigurationPolicyProvider* CreateRecommendedPlatformProvider(); static ConfigurationPolicyProvider* CreateRecommendedPlatformProvider();
......
...@@ -257,7 +257,6 @@ void CloudPolicyController::SendPolicyRequest() { ...@@ -257,7 +257,6 @@ void CloudPolicyController::SendPolicyRequest() {
backend_->ProcessPolicyRequest(data_store_->device_token(), backend_->ProcessPolicyRequest(data_store_->device_token(),
data_store_->device_id(), data_store_->device_id(),
data_store_->user_affiliation(),
policy_request, this); policy_request, this);
} }
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
namespace policy { namespace policy {
using ::testing::_;
using ::testing::AnyNumber; using ::testing::AnyNumber;
using ::testing::AtLeast; using ::testing::AtLeast;
using ::testing::InSequence; using ::testing::InSequence;
using ::testing::Mock; using ::testing::Mock;
using ::testing::Return; using ::testing::Return;
using ::testing::_;
class MockDeviceTokenFetcher : public DeviceTokenFetcher { class MockDeviceTokenFetcher : public DeviceTokenFetcher {
public: public:
...@@ -104,7 +104,7 @@ class CloudPolicyControllerTest : public testing::Test { ...@@ -104,7 +104,7 @@ class CloudPolicyControllerTest : public testing::Test {
TEST_F(CloudPolicyControllerTest, StartupWithDeviceToken) { TEST_F(CloudPolicyControllerTest, StartupWithDeviceToken) {
data_store_->SetupForTesting("fake_device_token", "device_id", "", "", data_store_->SetupForTesting("fake_device_token", "device_id", "", "",
true); true);
EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _, _)).WillOnce(DoAll( EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(DoAll(
InvokeWithoutArgs(this, &CloudPolicyControllerTest::StopMessageLoop), InvokeWithoutArgs(this, &CloudPolicyControllerTest::StopMessageLoop),
MockDeviceManagementBackendSucceedSpdyCloudPolicy())); MockDeviceManagementBackendSucceedSpdyCloudPolicy()));
CreateNewController(); CreateNewController();
...@@ -140,9 +140,9 @@ TEST_F(CloudPolicyControllerTest, RefreshAfterSuccessfulPolicy) { ...@@ -140,9 +140,9 @@ TEST_F(CloudPolicyControllerTest, RefreshAfterSuccessfulPolicy) {
"auth_token", true); "auth_token", true);
{ {
InSequence s; InSequence s;
EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _, _)).WillOnce( EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
MockDeviceManagementBackendSucceedSpdyCloudPolicy()); MockDeviceManagementBackendSucceedSpdyCloudPolicy());
EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _, _)).WillOnce(DoAll( EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(DoAll(
InvokeWithoutArgs(this, &CloudPolicyControllerTest::StopMessageLoop), InvokeWithoutArgs(this, &CloudPolicyControllerTest::StopMessageLoop),
MockDeviceManagementBackendFailPolicy( MockDeviceManagementBackendFailPolicy(
DeviceManagementBackend::kErrorRequestFailed))); DeviceManagementBackend::kErrorRequestFailed)));
...@@ -159,10 +159,10 @@ TEST_F(CloudPolicyControllerTest, RefreshAfterError) { ...@@ -159,10 +159,10 @@ TEST_F(CloudPolicyControllerTest, RefreshAfterError) {
"auth_token", true); "auth_token", true);
{ {
InSequence s; InSequence s;
EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _, _)).WillOnce( EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
MockDeviceManagementBackendFailPolicy( MockDeviceManagementBackendFailPolicy(
DeviceManagementBackend::kErrorRequestFailed)); DeviceManagementBackend::kErrorRequestFailed));
EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _, _)).WillOnce(DoAll( EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(DoAll(
InvokeWithoutArgs(this, InvokeWithoutArgs(this,
&CloudPolicyControllerTest::StopMessageLoop), &CloudPolicyControllerTest::StopMessageLoop),
MockDeviceManagementBackendSucceedSpdyCloudPolicy())); MockDeviceManagementBackendSucceedSpdyCloudPolicy()));
...@@ -177,7 +177,7 @@ TEST_F(CloudPolicyControllerTest, RefreshAfterError) { ...@@ -177,7 +177,7 @@ TEST_F(CloudPolicyControllerTest, RefreshAfterError) {
TEST_F(CloudPolicyControllerTest, InvalidToken) { TEST_F(CloudPolicyControllerTest, InvalidToken) {
data_store_->SetupForTesting("device_token", "device_id", data_store_->SetupForTesting("device_token", "device_id",
"standup@ten.am", "auth", true); "standup@ten.am", "auth", true);
EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _, _)).WillOnce( EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
MockDeviceManagementBackendFailPolicy( MockDeviceManagementBackendFailPolicy(
DeviceManagementBackend::kErrorServiceManagementTokenInvalid)); DeviceManagementBackend::kErrorServiceManagementTokenInvalid));
EXPECT_CALL(*token_fetcher_.get(), FetchToken()).Times(1); EXPECT_CALL(*token_fetcher_.get(), FetchToken()).Times(1);
...@@ -190,7 +190,7 @@ TEST_F(CloudPolicyControllerTest, InvalidToken) { ...@@ -190,7 +190,7 @@ TEST_F(CloudPolicyControllerTest, InvalidToken) {
TEST_F(CloudPolicyControllerTest, DeviceNotFound) { TEST_F(CloudPolicyControllerTest, DeviceNotFound) {
data_store_->SetupForTesting("device_token", "device_id", data_store_->SetupForTesting("device_token", "device_id",
"me@you.com", "auth", true); "me@you.com", "auth", true);
EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _, _)).WillOnce( EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
MockDeviceManagementBackendFailPolicy( MockDeviceManagementBackendFailPolicy(
DeviceManagementBackend::kErrorServiceDeviceNotFound)); DeviceManagementBackend::kErrorServiceDeviceNotFound));
EXPECT_CALL(*token_fetcher_.get(), FetchToken()).Times(1); EXPECT_CALL(*token_fetcher_.get(), FetchToken()).Times(1);
...@@ -204,7 +204,7 @@ TEST_F(CloudPolicyControllerTest, DeviceNotFound) { ...@@ -204,7 +204,7 @@ TEST_F(CloudPolicyControllerTest, DeviceNotFound) {
TEST_F(CloudPolicyControllerTest, NoLongerManaged) { TEST_F(CloudPolicyControllerTest, NoLongerManaged) {
data_store_->SetupForTesting("device_token", "device_id", data_store_->SetupForTesting("device_token", "device_id",
"who@what.com", "auth", true); "who@what.com", "auth", true);
EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _, _)).WillOnce( EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce(
MockDeviceManagementBackendFailPolicy( MockDeviceManagementBackendFailPolicy(
DeviceManagementBackend::kErrorServiceManagementNotSupported)); DeviceManagementBackend::kErrorServiceManagementNotSupported));
EXPECT_CALL(*token_fetcher_.get(), SetUnmanagedState()).Times(1); EXPECT_CALL(*token_fetcher_.get(), SetUnmanagedState()).Times(1);
......
...@@ -83,8 +83,7 @@ CloudPolicyDataStore::CloudPolicyDataStore( ...@@ -83,8 +83,7 @@ CloudPolicyDataStore::CloudPolicyDataStore(
const std::string& policy_type, const std::string& policy_type,
const std::string& machine_model, const std::string& machine_model,
const std::string& machine_id) const std::string& machine_id)
: user_affiliation_(USER_AFFILIATION_NONE), : policy_register_type_(policy_register_type),
policy_register_type_(policy_register_type),
policy_type_(policy_type), policy_type_(policy_type),
machine_model_(machine_model), machine_model_(machine_model),
machine_id_(machine_id), machine_id_(machine_id),
...@@ -149,11 +148,6 @@ void CloudPolicyDataStore::set_user_name(const std::string& user_name) { ...@@ -149,11 +148,6 @@ void CloudPolicyDataStore::set_user_name(const std::string& user_name) {
user_name_ = user_name; user_name_ = user_name;
} }
void CloudPolicyDataStore::set_user_affiliation(
UserAffiliation user_affiliation) {
user_affiliation_ = user_affiliation;
}
const std::string& CloudPolicyDataStore::device_token() const { const std::string& CloudPolicyDataStore::device_token() const {
return device_token_; return device_token_;
} }
...@@ -195,11 +189,6 @@ const std::string& CloudPolicyDataStore::user_name() const { ...@@ -195,11 +189,6 @@ const std::string& CloudPolicyDataStore::user_name() const {
return user_name_; return user_name_;
} }
const CloudPolicyDataStore::UserAffiliation
CloudPolicyDataStore::user_affiliation() const {
return user_affiliation_;
}
void CloudPolicyDataStore::AddObserver( void CloudPolicyDataStore::AddObserver(
CloudPolicyDataStore::Observer* observer) { CloudPolicyDataStore::Observer* observer) {
observer_list_.AddObserver(observer); observer_list_.AddObserver(observer);
......
...@@ -34,15 +34,6 @@ class CloudPolicyDataStore { ...@@ -34,15 +34,6 @@ class CloudPolicyDataStore {
virtual void OnCredentialsChanged() = 0; virtual void OnCredentialsChanged() = 0;
}; };
// Describes the affilitation of a user w.r.t. the managed state of the
// device.
enum UserAffiliation {
// User is on the same domain the device was registered with.
USER_AFFILIATION_MANAGED,
// No affiliation between device and user user.
USER_AFFILIATION_NONE,
};
~CloudPolicyDataStore(); ~CloudPolicyDataStore();
// Create CloudPolicyData with constants initialized for fetching user // Create CloudPolicyData with constants initialized for fetching user
...@@ -77,7 +68,6 @@ class CloudPolicyDataStore { ...@@ -77,7 +68,6 @@ class CloudPolicyDataStore {
void set_device_id(const std::string& device_id); void set_device_id(const std::string& device_id);
void set_user_name(const std::string& user_name); void set_user_name(const std::string& user_name);
void set_user_affiliation(UserAffiliation user_affiliation);
const std::string& device_id() const; const std::string& device_id() const;
const std::string& device_token() const; const std::string& device_token() const;
...@@ -90,7 +80,6 @@ class CloudPolicyDataStore { ...@@ -90,7 +80,6 @@ class CloudPolicyDataStore {
const std::string& policy_type() const; const std::string& policy_type() const;
bool token_cache_loaded() const; bool token_cache_loaded() const;
const std::string& user_name() const; const std::string& user_name() const;
const UserAffiliation user_affiliation() const;
void AddObserver(Observer* observer); void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer); void RemoveObserver(Observer* observer);
...@@ -112,7 +101,6 @@ class CloudPolicyDataStore { ...@@ -112,7 +101,6 @@ class CloudPolicyDataStore {
// Data necessary for constructing policy requests. // Data necessary for constructing policy requests.
std::string device_token_; std::string device_token_;
UserAffiliation user_affiliation_;
// Constants that won't change over the life-time of a cloud policy // Constants that won't change over the life-time of a cloud policy
// subsystem. // subsystem.
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/threading/non_thread_safe.h" #include "base/threading/non_thread_safe.h"
#include "chrome/browser/policy/cloud_policy_data_store.h"
#include "chrome/browser/policy/proto/device_management_backend.pb.h" #include "chrome/browser/policy/proto/device_management_backend.pb.h"
namespace policy { namespace policy {
...@@ -107,7 +106,6 @@ class DeviceManagementBackend : base::NonThreadSafe { ...@@ -107,7 +106,6 @@ class DeviceManagementBackend : base::NonThreadSafe {
virtual void ProcessPolicyRequest( virtual void ProcessPolicyRequest(
const std::string& device_management_token, const std::string& device_management_token,
const std::string& device_id, const std::string& device_id,
CloudPolicyDataStore::UserAffiliation user_affiliation,
const em::DevicePolicyRequest& request, const em::DevicePolicyRequest& request,
DevicePolicyResponseDelegate* delegate) = 0; DevicePolicyResponseDelegate* delegate) = 0;
......
...@@ -34,8 +34,6 @@ const char DeviceManagementBackendImpl::kParamDeviceType[] = "devicetype"; ...@@ -34,8 +34,6 @@ const char DeviceManagementBackendImpl::kParamDeviceType[] = "devicetype";
const char DeviceManagementBackendImpl::kParamOAuthToken[] = "oauth_token"; const char DeviceManagementBackendImpl::kParamOAuthToken[] = "oauth_token";
const char DeviceManagementBackendImpl::kParamPlatform[] = "platform"; const char DeviceManagementBackendImpl::kParamPlatform[] = "platform";
const char DeviceManagementBackendImpl::kParamRequest[] = "request"; const char DeviceManagementBackendImpl::kParamRequest[] = "request";
const char DeviceManagementBackendImpl::kParamUserAffiliation[] =
"user_affiliation";
// String constants for the device and app type we report to the server. // String constants for the device and app type we report to the server.
const char DeviceManagementBackendImpl::kValueAppType[] = "Chrome"; const char DeviceManagementBackendImpl::kValueAppType[] = "Chrome";
...@@ -44,9 +42,6 @@ const char DeviceManagementBackendImpl::kValueRequestPolicy[] = "policy"; ...@@ -44,9 +42,6 @@ const char DeviceManagementBackendImpl::kValueRequestPolicy[] = "policy";
const char DeviceManagementBackendImpl::kValueRequestRegister[] = "register"; const char DeviceManagementBackendImpl::kValueRequestRegister[] = "register";
const char DeviceManagementBackendImpl::kValueRequestUnregister[] = const char DeviceManagementBackendImpl::kValueRequestUnregister[] =
"unregister"; "unregister";
const char DeviceManagementBackendImpl::kValueUserAffiliationManaged[] =
"managed";
const char DeviceManagementBackendImpl::kValueUserAffiliationNone[] = "none";
namespace { namespace {
...@@ -76,6 +71,7 @@ const int kPolicyNotFound = 902; // This error is not sent as HTTP status code. ...@@ -76,6 +71,7 @@ const int kPolicyNotFound = 902; // This error is not sent as HTTP status code.
const int kPendingApprovalLegacy = 491; const int kPendingApprovalLegacy = 491;
const int kDeviceNotFoundLegacy = 901; const int kDeviceNotFoundLegacy = 901;
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// Machine info keys. // Machine info keys.
const char kMachineInfoHWClass[] = "hardware_class"; const char kMachineInfoHWClass[] = "hardware_class";
...@@ -388,7 +384,6 @@ class DeviceManagementPolicyJob : public DeviceManagementJobBase { ...@@ -388,7 +384,6 @@ class DeviceManagementPolicyJob : public DeviceManagementJobBase {
DeviceManagementBackendImpl* backend_impl, DeviceManagementBackendImpl* backend_impl,
const std::string& device_management_token, const std::string& device_management_token,
const std::string& device_id, const std::string& device_id,
const std::string& user_affiliation,
const em::DevicePolicyRequest& request, const em::DevicePolicyRequest& request,
DeviceManagementBackend::DevicePolicyResponseDelegate* delegate) DeviceManagementBackend::DevicePolicyResponseDelegate* delegate)
: DeviceManagementJobBase( : DeviceManagementJobBase(
...@@ -397,8 +392,6 @@ class DeviceManagementPolicyJob : public DeviceManagementJobBase { ...@@ -397,8 +392,6 @@ class DeviceManagementPolicyJob : public DeviceManagementJobBase {
device_id), device_id),
delegate_(delegate) { delegate_(delegate) {
SetDeviceManagementToken(device_management_token); SetDeviceManagementToken(device_management_token);
SetQueryParam(DeviceManagementBackendImpl::kParamUserAffiliation,
user_affiliation);
em::DeviceManagementRequest request_wrapper; em::DeviceManagementRequest request_wrapper;
request_wrapper.mutable_policy_request()->CopyFrom(request); request_wrapper.mutable_policy_request()->CopyFrom(request);
SetPayload(request_wrapper); SetPayload(request_wrapper);
...@@ -545,27 +538,12 @@ void DeviceManagementBackendImpl::ProcessUnregisterRequest( ...@@ -545,27 +538,12 @@ void DeviceManagementBackendImpl::ProcessUnregisterRequest(
void DeviceManagementBackendImpl::ProcessPolicyRequest( void DeviceManagementBackendImpl::ProcessPolicyRequest(
const std::string& device_management_token, const std::string& device_management_token,
const std::string& device_id, const std::string& device_id,
CloudPolicyDataStore::UserAffiliation affiliation,
const em::DevicePolicyRequest& request, const em::DevicePolicyRequest& request,
DevicePolicyResponseDelegate* delegate) { DevicePolicyResponseDelegate* delegate) {
UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, kMetricPolicyFetchRequested, UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, kMetricPolicyFetchRequested,
kMetricPolicySize); kMetricPolicySize);
AddJob(new DeviceManagementPolicyJob(this, device_management_token, device_id, AddJob(new DeviceManagementPolicyJob(this, device_management_token, device_id,
UserAffiliationToString(affiliation),
request, delegate)); request, delegate));
} }
// static
const char* DeviceManagementBackendImpl::UserAffiliationToString(
CloudPolicyDataStore::UserAffiliation affiliation) {
switch (affiliation) {
case CloudPolicyDataStore::USER_AFFILIATION_MANAGED:
return kValueUserAffiliationManaged;
case CloudPolicyDataStore::USER_AFFILIATION_NONE:
return kValueUserAffiliationNone;
}
NOTREACHED();
return kValueUserAffiliationNone;
}
} // namespace policy } // namespace policy
...@@ -35,7 +35,6 @@ class DeviceManagementBackendImpl : public DeviceManagementBackend { ...@@ -35,7 +35,6 @@ class DeviceManagementBackendImpl : public DeviceManagementBackend {
static const char kParamOAuthToken[]; static const char kParamOAuthToken[];
static const char kParamPlatform[]; static const char kParamPlatform[];
static const char kParamRequest[]; static const char kParamRequest[];
static const char kParamUserAffiliation[];
// String constants for the device and app type we report to the server. // String constants for the device and app type we report to the server.
static const char kValueAppType[]; static const char kValueAppType[];
...@@ -43,8 +42,6 @@ class DeviceManagementBackendImpl : public DeviceManagementBackend { ...@@ -43,8 +42,6 @@ class DeviceManagementBackendImpl : public DeviceManagementBackend {
static const char kValueRequestPolicy[]; static const char kValueRequestPolicy[];
static const char kValueRequestRegister[]; static const char kValueRequestRegister[];
static const char kValueRequestUnregister[]; static const char kValueRequestUnregister[];
static const char kValueUserAffiliationManaged[];
static const char kValueUserAffiliationNone[];
private: private:
friend class DeviceManagementJobBase; friend class DeviceManagementJobBase;
...@@ -73,14 +70,9 @@ class DeviceManagementBackendImpl : public DeviceManagementBackend { ...@@ -73,14 +70,9 @@ class DeviceManagementBackendImpl : public DeviceManagementBackend {
virtual void ProcessPolicyRequest( virtual void ProcessPolicyRequest(
const std::string& device_management_token, const std::string& device_management_token,
const std::string& device_id, const std::string& device_id,
CloudPolicyDataStore::UserAffiliation affiliation,
const em::DevicePolicyRequest& request, const em::DevicePolicyRequest& request,
DevicePolicyResponseDelegate* response_delegate); DevicePolicyResponseDelegate* response_delegate);
// Converts a user affiliation to the appropriate query parameter value.
static const char* UserAffiliationToString(
CloudPolicyDataStore::UserAffiliation affiliation);
// Keeps track of the jobs currently in flight. // Keeps track of the jobs currently in flight.
JobSet pending_jobs_; JobSet pending_jobs_;
......
...@@ -119,9 +119,7 @@ IN_PROC_BROWSER_TEST_F(DeviceManagementServiceIntegrationTest, ...@@ -119,9 +119,7 @@ IN_PROC_BROWSER_TEST_F(DeviceManagementServiceIntegrationTest,
em::DevicePolicySettingRequest* setting_request = em::DevicePolicySettingRequest* setting_request =
request.add_setting_request(); request.add_setting_request();
setting_request->set_key(kChromeDevicePolicySettingKey); setting_request->set_key(kChromeDevicePolicySettingKey);
backend->ProcessPolicyRequest(token_, "testid", backend->ProcessPolicyRequest(token_, "testid", request, &delegate);
CloudPolicyDataStore::USER_AFFILIATION_NONE,
request, &delegate);
MessageLoop::current()->Run(); MessageLoop::current()->Run();
} }
...@@ -172,9 +170,7 @@ IN_PROC_BROWSER_TEST_F(DeviceManagementServiceIntegrationTest, ...@@ -172,9 +170,7 @@ IN_PROC_BROWSER_TEST_F(DeviceManagementServiceIntegrationTest,
em::PolicyFetchRequest* fetch_request = request.add_request(); em::PolicyFetchRequest* fetch_request = request.add_request();
fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA); fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA);
fetch_request->set_policy_type(kChromeUserPolicyType); fetch_request->set_policy_type(kChromeUserPolicyType);
backend->ProcessPolicyRequest(token_, "testid", backend->ProcessPolicyRequest(token_, "testid", request, &delegate);
CloudPolicyDataStore::USER_AFFILIATION_NONE,
request, &delegate);
MessageLoop::current()->Run(); MessageLoop::current()->Run();
} }
......
...@@ -143,9 +143,7 @@ TEST_P(DeviceManagementServiceFailedRequestTest, PolicyRequest) { ...@@ -143,9 +143,7 @@ TEST_P(DeviceManagementServiceFailedRequestTest, PolicyRequest) {
em::DevicePolicySettingRequest* setting_request = em::DevicePolicySettingRequest* setting_request =
request.add_setting_request(); request.add_setting_request();
setting_request->set_key(kChromeDevicePolicySettingKey); setting_request->set_key(kChromeDevicePolicySettingKey);
backend_->ProcessPolicyRequest(kDMToken, kDeviceId, backend_->ProcessPolicyRequest(kDMToken, kDeviceId, request, &mock);
CloudPolicyDataStore::USER_AFFILIATION_NONE,
request, &mock);
TestURLFetcher* fetcher = factory_.GetFetcherByID(0); TestURLFetcher* fetcher = factory_.GetFetcherByID(0);
ASSERT_TRUE(fetcher); ASSERT_TRUE(fetcher);
...@@ -413,9 +411,7 @@ TEST_F(DeviceManagementServiceTest, CancelPolicyRequest) { ...@@ -413,9 +411,7 @@ TEST_F(DeviceManagementServiceTest, CancelPolicyRequest) {
request.add_setting_request(); request.add_setting_request();
setting_request->set_key(kChromeDevicePolicySettingKey); setting_request->set_key(kChromeDevicePolicySettingKey);
setting_request->set_watermark("stale"); setting_request->set_watermark("stale");
backend_->ProcessPolicyRequest(kDMToken, kDeviceId, backend_->ProcessPolicyRequest(kDMToken, kDeviceId, request, &mock);
CloudPolicyDataStore::USER_AFFILIATION_NONE,
request, &mock);
TestURLFetcher* fetcher = factory_.GetFetcherByID(0); TestURLFetcher* fetcher = factory_.GetFetcherByID(0);
ASSERT_TRUE(fetcher); ASSERT_TRUE(fetcher);
...@@ -467,9 +463,7 @@ TEST_F(DeviceManagementServiceTest, CancelRequestAfterShutdown) { ...@@ -467,9 +463,7 @@ TEST_F(DeviceManagementServiceTest, CancelRequestAfterShutdown) {
request.add_setting_request(); request.add_setting_request();
setting_request->set_key(kChromeDevicePolicySettingKey); setting_request->set_key(kChromeDevicePolicySettingKey);
setting_request->set_watermark("stale"); setting_request->set_watermark("stale");
backend_->ProcessPolicyRequest(kDMToken, kDeviceId, backend_->ProcessPolicyRequest(kDMToken, kDeviceId, request, &mock);
CloudPolicyDataStore::USER_AFFILIATION_NONE,
request, &mock);
TestURLFetcher* fetcher = factory_.GetFetcherByID(0); TestURLFetcher* fetcher = factory_.GetFetcherByID(0);
ASSERT_TRUE(fetcher); ASSERT_TRUE(fetcher);
......
...@@ -76,9 +76,7 @@ class DeviceManagementBackendTestHelper { ...@@ -76,9 +76,7 @@ class DeviceManagementBackendTestHelper {
DevicePolicyResponseDelegateMock delegate; DevicePolicyResponseDelegateMock delegate;
EXPECT_CALL(delegate, OnError(_)).Times(AnyNumber()); EXPECT_CALL(delegate, OnError(_)).Times(AnyNumber());
EXPECT_CALL(delegate, HandlePolicyResponse(_)).Times(AnyNumber()); EXPECT_CALL(delegate, HandlePolicyResponse(_)).Times(AnyNumber());
backend_->ProcessPolicyRequest("token", "testid", backend_->ProcessPolicyRequest("token", "testid", request, &delegate);
CloudPolicyDataStore::USER_AFFILIATION_NONE,
request, &delegate);
} }
void UnmockCreateBackend() { void UnmockCreateBackend() {
......
...@@ -44,10 +44,9 @@ class MockDeviceManagementBackend : public DeviceManagementBackend { ...@@ -44,10 +44,9 @@ class MockDeviceManagementBackend : public DeviceManagementBackend {
const em::DeviceUnregisterRequest& request, const em::DeviceUnregisterRequest& request,
DeviceUnregisterResponseDelegate* delegate)); DeviceUnregisterResponseDelegate* delegate));
MOCK_METHOD5(ProcessPolicyRequest, void( MOCK_METHOD4(ProcessPolicyRequest, void(
const std::string& device_management_token, const std::string& device_management_token,
const std::string& device_id, const std::string& device_id,
CloudPolicyDataStore::UserAffiliation affiliation,
const em::DevicePolicyRequest& request, const em::DevicePolicyRequest& request,
DevicePolicyResponseDelegate* delegate)); DevicePolicyResponseDelegate* delegate));
...@@ -84,7 +83,7 @@ ACTION(MockDeviceManagementBackendSucceedSpdyCloudPolicy) { ...@@ -84,7 +83,7 @@ ACTION(MockDeviceManagementBackendSucceedSpdyCloudPolicy) {
// implementing support for signature verification). // implementing support for signature verification).
fetch_response->set_policy_data_signature("TODO"); fetch_response->set_policy_data_signature("TODO");
fetch_response->set_new_public_key("TODO"); fetch_response->set_new_public_key("TODO");
arg4->HandlePolicyResponse(response); arg3->HandlePolicyResponse(response);
} }
ACTION_P(MockDeviceManagementBackendFailRegister, error) { ACTION_P(MockDeviceManagementBackendFailRegister, error) {
...@@ -92,7 +91,7 @@ ACTION_P(MockDeviceManagementBackendFailRegister, error) { ...@@ -92,7 +91,7 @@ ACTION_P(MockDeviceManagementBackendFailRegister, error) {
} }
ACTION_P(MockDeviceManagementBackendFailPolicy, error) { ACTION_P(MockDeviceManagementBackendFailPolicy, error) {
arg4->OnError(error); arg3->OnError(error);
} }
} // namespace policy } // namespace policy
......
...@@ -30,15 +30,13 @@ void ProxyDeviceManagementBackend::ProcessUnregisterRequest( ...@@ -30,15 +30,13 @@ void ProxyDeviceManagementBackend::ProcessUnregisterRequest(
backend_->ProcessUnregisterRequest(device_management_token, device_id, backend_->ProcessUnregisterRequest(device_management_token, device_id,
request, delegate); request, delegate);
} }
void ProxyDeviceManagementBackend::ProcessPolicyRequest( void ProxyDeviceManagementBackend::ProcessPolicyRequest(
const std::string& device_management_token, const std::string& device_management_token,
const std::string& device_id, const std::string& device_id,
CloudPolicyDataStore::UserAffiliation affiliation,
const em::DevicePolicyRequest& request, const em::DevicePolicyRequest& request,
DevicePolicyResponseDelegate* delegate) { DevicePolicyResponseDelegate* delegate) {
backend_->ProcessPolicyRequest(device_management_token, device_id, backend_->ProcessPolicyRequest(device_management_token, device_id,
affiliation, request, delegate); request, delegate);
} }
MockDeviceManagementService::MockDeviceManagementService() MockDeviceManagementService::MockDeviceManagementService()
......
...@@ -39,7 +39,6 @@ class ProxyDeviceManagementBackend : public DeviceManagementBackend { ...@@ -39,7 +39,6 @@ class ProxyDeviceManagementBackend : public DeviceManagementBackend {
virtual void ProcessPolicyRequest( virtual void ProcessPolicyRequest(
const std::string& device_management_token, const std::string& device_management_token,
const std::string& device_id, const std::string& device_id,
CloudPolicyDataStore::UserAffiliation affiliation,
const em::DevicePolicyRequest& request, const em::DevicePolicyRequest& request,
DevicePolicyResponseDelegate* delegate) OVERRIDE; DevicePolicyResponseDelegate* delegate) OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment