Commit 57606d76 authored by Guillaume Jenkins's avatar Guillaume Jenkins Committed by Commit Bot

[iOS CBCM] Add experimental settings for CBCM testing

Adds two new experimental settings to help manual testing of CBCM on
iOS:

1) EnableChromeBrowserCloudManagement to force enable CBCM infra
2) CloudManagementEnrollmentToken to provide an enrollment token

This change also creates a new "Enterprise Settings" section in the
experimental settings, since there are now three Enterprise-related
experimental settings.

Bug: 1066495
Change-Id: I8b88c408c5866cb130373712af6201269be39c36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2353394
Commit-Queue: Guillaume Jenkins <gujen@google.com>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797731}
parent 5c6722dc
...@@ -708,6 +708,9 @@ void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { ...@@ -708,6 +708,9 @@ void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) {
web::BuildMobileUserAgent(product)); web::BuildMobileUserAgent(product));
} }
// Shared policy dictionary for all enterprise experimental flags.
NSMutableDictionary* testing_policies = [[NSMutableDictionary alloc] init];
// Set some sample policy values for testing if EnableSamplePolicies is // Set some sample policy values for testing if EnableSamplePolicies is
// enabled. // enabled.
if ([defaults boolForKey:@"EnableSamplePolicies"]) { if ([defaults boolForKey:@"EnableSamplePolicies"]) {
...@@ -726,7 +729,7 @@ void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { ...@@ -726,7 +729,7 @@ void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) {
]; ];
// Define sample policies to enable. // Define sample policies to enable.
NSDictionary* testing_policies = @{ [testing_policies addEntriesFromDictionary:@{
base::SysUTF8ToNSString(policy::key::kEnableExperimentalPolicies) : base::SysUTF8ToNSString(policy::key::kEnableExperimentalPolicies) :
experimental_policies, experimental_policies,
...@@ -751,7 +754,22 @@ void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) { ...@@ -751,7 +754,22 @@ void AppendSwitchesFromExperimentalSettings(base::CommandLine* command_line) {
base::SysUTF8ToNSString(policy::key::kPasswordManagerEnabled) : @NO, base::SysUTF8ToNSString(policy::key::kPasswordManagerEnabled) : @NO,
base::SysUTF8ToNSString(policy::key::kTranslateEnabled) : @NO, base::SysUTF8ToNSString(policy::key::kTranslateEnabled) : @NO,
}; }];
}
// If a CBCM enrollment token is provided, force Chrome Browser Cloud
// Management to enabled and add the token to the list of policies.
NSString* token_key =
base::SysUTF8ToNSString(policy::key::kCloudManagementEnrollmentToken);
NSString* token = [defaults stringForKey:token_key];
if ([token length] > 0) {
command_line->AppendSwitch(switches::kEnableChromeBrowserCloudManagement);
[testing_policies setValue:token forKey:token_key];
}
// If some policies were set, commit them to the app's registration defaults.
if ([testing_policies count] > 0) {
NSDictionary* registration_defaults = NSDictionary* registration_defaults =
@{kPolicyLoaderIOSConfigurationKey : testing_policies}; @{kPolicyLoaderIOSConfigurationKey : testing_policies};
[defaults registerDefaults:registration_defaults]; [defaults registerDefaults:registration_defaults];
......
...@@ -130,6 +130,12 @@ ...@@ -130,6 +130,12 @@
<key>DefaultValue</key> <key>DefaultValue</key>
<false/> <false/>
</dict> </dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Enterprise Settings</string>
</dict>
<dict> <dict>
<key>Type</key> <key>Type</key>
<string>PSToggleSwitchSpecifier</string> <string>PSToggleSwitchSpecifier</string>
...@@ -140,6 +146,18 @@ ...@@ -140,6 +146,18 @@
<key>DefaultValue</key> <key>DefaultValue</key>
<false/> <false/>
</dict> </dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>CBCM Enrollment Token</string>
<key>Key</key>
<string>CloudManagementEnrollmentToken</string>
<key>DefaultValue</key>
<string></string>
<key>AutocorrectionType</key>
<string>No</string>
</dict>
<dict> <dict>
<key>Type</key> <key>Type</key>
<string>PSGroupSpecifier</string> <string>PSGroupSpecifier</string>
......
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