Commit bcf1a250 authored by Yann Dago's avatar Yann Dago Committed by Commit Bot

Management WebUi: Do not show account domain if account is not managed

Bug: 1012920
Change-Id: Ifccd4d4eab21ba21d0e7984add2b26757e5cbec8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929450Reviewed-by: default avatarHector Carmona <hcarmona@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Yann Dago <ydago@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721201}
parent b51efd6e
...@@ -58,6 +58,7 @@ IN_PROC_BROWSER_TEST_F(ManagedUiTest, GetManagedUiMenuItemLabel) { ...@@ -58,6 +58,7 @@ IN_PROC_BROWSER_TEST_F(ManagedUiTest, GetManagedUiMenuItemLabel) {
TestingProfile::Builder builder_with_domain; TestingProfile::Builder builder_with_domain;
builder_with_domain.SetProfileName("foobar@example.com"); builder_with_domain.SetProfileName("foobar@example.com");
builder_with_domain.OverridePolicyConnectorIsManagedForTesting(true);
auto profile_with_domain = builder_with_domain.Build(); auto profile_with_domain = builder_with_domain.Build();
EXPECT_EQ(base::ASCIIToUTF16("Managed by your organization"), EXPECT_EQ(base::ASCIIToUTF16("Managed by your organization"),
...@@ -72,6 +73,7 @@ IN_PROC_BROWSER_TEST_F(ManagedUiTest, GetManagedUiWebUILabel) { ...@@ -72,6 +73,7 @@ IN_PROC_BROWSER_TEST_F(ManagedUiTest, GetManagedUiWebUILabel) {
TestingProfile::Builder builder_with_domain; TestingProfile::Builder builder_with_domain;
builder_with_domain.SetProfileName("foobar@example.com"); builder_with_domain.SetProfileName("foobar@example.com");
builder_with_domain.OverridePolicyConnectorIsManagedForTesting(true);
auto profile_with_domain = builder_with_domain.Build(); auto profile_with_domain = builder_with_domain.Build();
EXPECT_EQ( EXPECT_EQ(
......
...@@ -325,6 +325,8 @@ const char* GetReportingTypeValue(ReportingType reportingType) { ...@@ -325,6 +325,8 @@ const char* GetReportingTypeValue(ReportingType reportingType) {
// TODO(raleksandov) Move to util class or smth similar. // TODO(raleksandov) Move to util class or smth similar.
// static // static
std::string ManagementUIHandler::GetAccountDomain(Profile* profile) { std::string ManagementUIHandler::GetAccountDomain(Profile* profile) {
if (!IsProfileManaged(profile))
return std::string();
auto username = profile->GetProfileUserName(); auto username = profile->GetProfileUserName();
size_t email_separator_pos = username.find('@'); size_t email_separator_pos = username.find('@');
bool is_email = email_separator_pos != std::string::npos && bool is_email = email_separator_pos != std::string::npos &&
......
...@@ -207,6 +207,7 @@ TEST_F(ManagementUIHandlerTests, ...@@ -207,6 +207,7 @@ TEST_F(ManagementUIHandlerTests,
ManagementContextualSourceUpdateManagedConsumerDomain) { ManagementContextualSourceUpdateManagedConsumerDomain) {
TestingProfile::Builder builder; TestingProfile::Builder builder;
builder.SetProfileName("managed@gmail.com"); builder.SetProfileName("managed@gmail.com");
builder.OverridePolicyConnectorIsManagedForTesting(true);
auto profile = builder.Build(); auto profile = builder.Build();
base::string16 extensions_installed; base::string16 extensions_installed;
...@@ -238,6 +239,7 @@ TEST_F(ManagementUIHandlerTests, ...@@ -238,6 +239,7 @@ TEST_F(ManagementUIHandlerTests,
ManagementContextualSourceUpdateUnmanagedKnownDomain) { ManagementContextualSourceUpdateUnmanagedKnownDomain) {
TestingProfile::Builder builder; TestingProfile::Builder builder;
builder.SetProfileName("managed@manager.com"); builder.SetProfileName("managed@manager.com");
builder.OverridePolicyConnectorIsManagedForTesting(true);
auto profile = builder.Build(); auto profile = builder.Build();
base::string16 extension_reporting_title; base::string16 extension_reporting_title;
...@@ -305,6 +307,7 @@ TEST_F(ManagementUIHandlerTests, ...@@ -305,6 +307,7 @@ TEST_F(ManagementUIHandlerTests,
ManagementContextualSourceUpdateManagedKnownDomain) { ManagementContextualSourceUpdateManagedKnownDomain) {
TestingProfile::Builder builder; TestingProfile::Builder builder;
builder.SetProfileName("managed@gmail.com.manager.com.gmail.com"); builder.SetProfileName("managed@gmail.com.manager.com.gmail.com");
builder.OverridePolicyConnectorIsManagedForTesting(true);
auto profile = builder.Build(); auto profile = builder.Build();
base::string16 extension_reporting_title; base::string16 extension_reporting_title;
...@@ -345,6 +348,7 @@ TEST_F(ManagementUIHandlerTests, ...@@ -345,6 +348,7 @@ TEST_F(ManagementUIHandlerTests,
ManagementContextualSourceUpdateManagedAccountKnownDomain) { ManagementContextualSourceUpdateManagedAccountKnownDomain) {
TestingProfile::Builder builder; TestingProfile::Builder builder;
builder.SetProfileName("managed@manager.com"); builder.SetProfileName("managed@manager.com");
builder.OverridePolicyConnectorIsManagedForTesting(true);
auto profile = builder.Build(); auto profile = builder.Build();
const auto device_type = ui::GetChromeOSDeviceTypeResourceId(); const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
...@@ -480,6 +484,7 @@ TEST_F(ManagementUIHandlerTests, ...@@ -480,6 +484,7 @@ TEST_F(ManagementUIHandlerTests,
ManagementContextualSourceUpdateManagedDeviceAndAccountMultipleDomains) { ManagementContextualSourceUpdateManagedDeviceAndAccountMultipleDomains) {
TestingProfile::Builder builder; TestingProfile::Builder builder;
builder.SetProfileName("managed@manager.com"); builder.SetProfileName("managed@manager.com");
builder.OverridePolicyConnectorIsManagedForTesting(true);
auto profile = builder.Build(); auto profile = builder.Build();
const auto device_type = ui::GetChromeOSDeviceTypeResourceId(); const auto device_type = ui::GetChromeOSDeviceTypeResourceId();
...@@ -696,9 +701,7 @@ TEST_F(ManagementUIHandlerTests, ThreatReportingInfo) { ...@@ -696,9 +701,7 @@ TEST_F(ManagementUIHandlerTests, ThreatReportingInfo) {
info.GetAsDictionary(&threat_protection_info); info.GetAsDictionary(&threat_protection_info);
EXPECT_TRUE(threat_protection_info->FindListKey("info")->GetList().empty()); EXPECT_TRUE(threat_protection_info->FindListKey("info")->GetList().empty());
EXPECT_EQ( EXPECT_EQ(
l10n_util::GetStringFUTF16( l10n_util::GetStringUTF16(IDS_MANAGEMENT_THREAT_PROTECTION_DESCRIPTION),
IDS_MANAGEMENT_THREAT_PROTECTION_DESCRIPTION_BY,
base::UTF8ToUTF16("manager.com")),
base::UTF8ToUTF16(*threat_protection_info->FindStringKey("description"))); base::UTF8ToUTF16(*threat_protection_info->FindStringKey("description")));
// When policies are set to values that enable the feature, report it. // When policies are set to values that enable the feature, report it.
......
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