New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 773868 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

Add a device policy Autotest

Project Member Reported by kathrelk...@chromium.org, Oct 11 2017

Issue description

Support a test which modifies and tests device policies, now that  issue 651249  has been fixed.

Open problems:
- a device that is already enrolled (due to test failure) or has already been owned by a fake user.  Maybe we need clear-tpm requests with reboot post-test or maybe we need to wrap tests in a generic clearTPM server test, which also reboots
- device policy names in fake dms do not match their policy name as listed in chrome://policy, which breaks how we verify policies right now

Changes needed:
- pass device policies into the fake-dms policy blob, similarly to how users policies are passed now.  See chrome_device_settings.proto
- remove concept "policy under test" (so that we don't have to have a million additional flags to determine if the policy is device/user or mandatory/suggested).  With this gone, fix verification to check all policies
- add an actual test which sets a device policy
- test this new test under these conditions: device already managed (real account), device already managed (fake user), device owned (real user), device owned (fake user)
 
Project Member

Comment 1 by bugdroid1@chromium.org, Nov 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/autotest/+/5b155db99c889b2da77f06b5066cdcfc7e3250f7

commit 5b155db99c889b2da77f06b5066cdcfc7e3250f7
Author: Katherine Threlkeld <kathrelkeld@chromium.org>
Date: Wed Nov 01 02:50:44 2017

[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>

[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_CookiesAllowedForUrls/policy_CookiesAllowedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_URLBlacklist/policy_URLBlacklist.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_DisableScreenshots/policy_DisableScreenshots.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_NotificationsAllowedForUrls/policy_NotificationsAllowedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_NotificationsBlockedForUrls/policy_NotificationsBlockedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_RestoreOnStartupURLs/policy_RestoreOnStartupURLs.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/cros/enterprise/enterprise_policy_base.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_PluginsAllowedForUrls/policy_PluginsAllowedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_PluginsBlockedForUrls/policy_PluginsBlockedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_ManagedBookmarks/policy_ManagedBookmarks.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_ForceYouTubeSafetyMode/policy_ForceYouTubeSafetyMode.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_ImagesAllowedForUrls/policy_ImagesAllowedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_PowerManagementIdleSettings/policy_PowerManagementIdleSettings.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_ImagesBlockedForUrls/policy_ImagesBlockedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_JavaScriptAllowedForUrls/policy_JavaScriptAllowedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_ProxySettings/policy_ProxySettings.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_ForceGoogleSafeSearch/policy_ForceGoogleSafeSearch.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_URLWhitelist/policy_URLWhitelist.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_PopupsAllowedForUrls/policy_PopupsAllowedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_ChromeOsLockOnIdleSuspend/policy_ChromeOsLockOnIdleSuspend.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_CookiesSessionOnlyForUrls/policy_CookiesSessionOnlyForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_JavaScriptBlockedForUrls/policy_JavaScriptBlockedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_CookiesBlockedForUrls/policy_CookiesBlockedForUrls.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_EditBookmarksEnabled/policy_EditBookmarksEnabled.py
[modify] https://crrev.com/5b155db99c889b2da77f06b5066cdcfc7e3250f7/client/site_tests/policy_PopupsBlockedForUrls/policy_PopupsBlockedForUrls.py

Comment 2 by ovanieva@google.com, Jan 19 2018

Labels: Build-Toolchain
Labels: -Build-Toolchain

Comment 4 by osh...@chromium.org, Jan 26 2018

Components: Enterprise
Components: -Enterprise Tests
Labels: ent-automation
Labels: -ent-autotest

Sign in to add a comment