Commit cf0ee603 authored by Brian Malcolm's avatar Brian Malcolm Committed by Commit Bot

Added BrowserPolicyConnectorChromeOS::GetEnterpriseDomainManager

This is the UI name of the entity that manages device's domain, which
caneither be a domain name (foo.com), or the admin's email address
(user@foo.com)

BUG=chromium:1081272

Change-Id: I5d1adcf4182bf3beb3dfc05980106efbc88af53b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2431457Reviewed-by: default avatarSergey Poromov <poromov@chromium.org>
Commit-Queue: Brian Malcolm <bmalcolm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810849}
parent 03929561
......@@ -371,6 +371,13 @@ std::string BrowserPolicyConnectorChromeOS::GetEnterpriseDisplayDomain() const {
return GetEnterpriseEnrollmentDomain();
}
std::string BrowserPolicyConnectorChromeOS::GetEnterpriseDomainManager() const {
const em::PolicyData* policy = GetDevicePolicy();
if (policy && policy->has_managed_by())
return policy->managed_by();
return GetEnterpriseDisplayDomain();
}
std::string BrowserPolicyConnectorChromeOS::GetRealm() const {
return chromeos::InstallAttributes::Get()->GetRealm();
}
......
......@@ -100,6 +100,10 @@ class BrowserPolicyConnectorChromeOS
// before the custom display domain can be used.
std::string GetEnterpriseDisplayDomain() const;
// Returns the manager of the domain for use in UI if specified, otherwise the
// enterprise display domain.
std::string GetEnterpriseDomainManager() const;
// Returns the Kerberos realm (aka Windows Domain) if the device is managed by
// Active Directory.
std::string GetRealm() const;
......
......@@ -22,6 +22,7 @@ namespace policy {
const char kCustomDisplayDomain[] = "acme.corp";
const char kMachineName[] = "machine_name";
const char kCustomManager[] = "user@acme.corp";
void WaitUntilPolicyLoaded() {
BrowserPolicyConnectorChromeOS* connector =
......@@ -59,12 +60,18 @@ IN_PROC_BROWSER_TEST_F(BrowserPolicyConnectorChromeOSTest, EnterpriseDomains) {
// display domain defaults to enrollment domain.
EXPECT_EQ(PolicyBuilder::kFakeDomain,
connector->GetEnterpriseDisplayDomain());
// If no manager set, EnterpriseDomainManager is equal to
// EnterpriseDisplayDomain
EXPECT_EQ(connector->GetEnterpriseDisplayDomain(),
connector->GetEnterpriseDomainManager());
device_policy()->policy_data().set_display_domain(kCustomDisplayDomain);
device_policy()->policy_data().set_managed_by(kCustomManager);
RefreshDevicePolicy();
WaitUntilPolicyLoaded();
// At this point custom display domain is set and policy is loaded so expect
// to see the custom display domain.
EXPECT_EQ(kCustomDisplayDomain, connector->GetEnterpriseDisplayDomain());
EXPECT_EQ(kCustomManager, connector->GetEnterpriseDomainManager());
// Make sure that enrollment domain stays the same.
EXPECT_EQ(PolicyBuilder::kFakeDomain,
connector->GetEnterpriseEnrollmentDomain());
......
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