5b155db99c889b2da77f06b5066cdcfc7e3250f7 |
|
12-Oct-2017 |
Katherine Threlkeld <kathrelkeld@chromium.org> |
[Autotest] Support device policies in policy test blob. This CL makes the following structural changes: * Support device policies in the JSON blob. When this code was written, all policies were assumed to be user policies. Device policies are placed in a separate part of the blob. Modify all functions which handled policy dicts to handle all cases. * Remove the concept of a single policy under test. Rather than bending over backwards to add flags whether the policy under test is a device policy or not, expect that base class users will add their policy under test to the correct dict. * Add code to verify all policies expected, not just the one under test (since that's not a thing anymore). This involved moving around some verification code. * Add code to verify the types of policies expected, since we have that information in the setup_case context. Leave the functions which just check value, since there are some contexts where that's all you want to check. Ensure that code is shared between them. This CL also addresses these smaller issues: * When creating JSON blob, avoid editing the passed in policy dicts. * Tweak the last remaining instance of passing in JSON instead of what the JSON represents (in policy_ManagedBookmarks). Leaving it as-is breaks the new verify-all-policies paradigm. * Fix a typo that got copied around: EditBookmarksEnabled vs. EditBookmarkEnabled. On the plus side, verifying all policies like this CL adds will prevent such mistakes in the future. * run_once doesn't need to be defined in the base class, since at this point it's just calling run_test_case and nothing else. Delete it and update all tests which were using it. * Add docstrings to initialize() functions and others, as required by current upload script. TEST=Ran all of suite:policy and saw no /new/ failures BUG=chromium:773868 Change-Id: I93f260f4b4a57a811f1589bb38f69d82f5127139 Reviewed-on: https://chromium-review.googlesource.com/716862 Commit-Ready: Katherine Threlkeld <kathrelkeld@chromium.org> Tested-by: Katherine Threlkeld <kathrelkeld@chromium.org> Reviewed-by: Katherine Threlkeld <kathrelkeld@chromium.org>
/external/autotest/client/site_tests/policy_PowerManagementIdleSettings/policy_PowerManagementIdleSettings.py
|