Commit d269e80d authored by Owen Min's avatar Owen Min Committed by Commit Bot

Update enterprise reporting to use the new Policy conversions.

Turn off convert types and pretty print.

Use default value of no convert value, no device data and includes user
policies.

Bug: 983174
Change-Id: I8815e4f66c5b7326cf337fb610a2dfbebc4d3f63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1721078Reviewed-by: default avatarYann Dago <ydago@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681413}
parent a076c4e2
...@@ -84,12 +84,12 @@ TEST_F(PolicyInfoTest, ChromePolicy) { ...@@ -84,12 +84,12 @@ TEST_F(PolicyInfoTest, ChromePolicy) {
EXPECT_CALL(*policy_service(), GetPolicies(_)); EXPECT_CALL(*policy_service(), GetPolicies(_));
AppendChromePolicyInfoIntoProfileReport( AppendChromePolicyInfoIntoProfileReport(policy::DictionaryPolicyConversions()
policy::GetAllPolicyValuesAsDictionary( .WithBrowserContext(profile())
profile(), /* with_user_policies */ true, /* convert_values */ false, .EnableConvertTypes(false)
/* with_device_data*/ false, .EnablePrettyPrint(false)
/* is_pretty_print */ false, /* convert_types */ false), .ToValue(),
&profile_info); &profile_info);
EXPECT_EQ(2, profile_info.chrome_policies_size()); EXPECT_EQ(2, profile_info.chrome_policies_size());
auto policy1 = profile_info.chrome_policies(0); auto policy1 = profile_info.chrome_policies(0);
...@@ -131,8 +131,11 @@ TEST_F(PolicyInfoTest, ExtensionPolicy) { ...@@ -131,8 +131,11 @@ TEST_F(PolicyInfoTest, ExtensionPolicy) {
std::make_unique<base::Value>(3), nullptr); std::make_unique<base::Value>(3), nullptr);
em::ChromeUserProfileInfo profile_info; em::ChromeUserProfileInfo profile_info;
AppendExtensionPolicyInfoIntoProfileReport( AppendExtensionPolicyInfoIntoProfileReport(
policy::GetAllPolicyValuesAsDictionary(profile(), true, false, false, policy::DictionaryPolicyConversions()
false, false), .WithBrowserContext(profile())
.EnableConvertTypes(false)
.EnablePrettyPrint(false)
.ToValue(),
&profile_info); &profile_info);
// The second extension is not in the report because it has no policy. // The second extension is not in the report because it has no policy.
EXPECT_EQ(1, profile_info.extension_policies_size()); EXPECT_EQ(1, profile_info.extension_policies_size());
......
...@@ -59,10 +59,11 @@ void ProfileReportGenerator::MaybeGenerate(const base::FilePath& path, ...@@ -59,10 +59,11 @@ void ProfileReportGenerator::MaybeGenerate(const base::FilePath& path,
if (policies_enabled_) { if (policies_enabled_) {
// TODO(crbug.com/983151): Upload policy error as their IDs. // TODO(crbug.com/983151): Upload policy error as their IDs.
policies_ = policy::GetAllPolicyValuesAsDictionary( policies_ = policy::DictionaryPolicyConversions()
profile_, /* with_user_policies */ true, /* convert_values */ false, .WithBrowserContext(profile_)
/* with_device_data*/ false, .EnableConvertTypes(false)
/* is_pretty_print */ false, /* convert_types */ false); .EnablePrettyPrint(false)
.ToValue();
GetChromePolicyInfo(); GetChromePolicyInfo();
GetExtensionPolicyInfo(); GetExtensionPolicyInfo();
GetPolicyFetchTimestampInfo(); GetPolicyFetchTimestampInfo();
......
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