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

Issue 876705 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Re-evaluate and document usage of BrowserPolicyConnector::SetPolicyProviderForTesting in tests

Project Member Reported by pmarko@chromium.org, Aug 22

Issue description

Policies coming from policy::BrowserPolicyConnector::SetPolicyProviderForTesting apply globally, i.e. to all profiles, including the sign-in profile.

This causes warnings in browsertests (e.g. force-installing extensions which are not allowed in the sign-in profile) and could cause more weird behavior.
Note that the sign-in profile ("Default") always exists, even when not running with --login-manager:
https://cs.chromium.org/chromium/src/chrome/browser/chromeos/chrome_browser_main_chromeos.cc?rcl=b4a4e4e57e29d2c8404704878ad154452188fe90&l=917

In contrast, Cloud Policy does _not_ apply to the sign-in profile, this is implemented in UserPolicyManagerFactoryChromeOS:
https://cs.chromium.org/chromium/src/chrome/browser/chromeos/policy/user_policy_manager_factory_chromeos.cc?rcl=409b9c00941963df196bd1356893d2e777ae4e44&l=175
( There are however a few device policies "mapped" to user policies of the sign-in profile using LoginProfilePolicyProvider:
https://cs.chromium.org/chromium/src/chrome/browser/chromeos/policy/login_profile_policy_provider.cc?rcl=b4a4e4e57e29d2c8404704878ad154452188fe90&l=144 )

I think that most tests using BrowserPolicyConnector::SetPolicyProviderForTesting would be better off using ProfilePolicyConnectorFactory::PushProviderForTesting, which sets the testing policy provider for the next Profile which will be initialized.
If we agree that this would be better, we should re-evaluate existing tests and change them to use it if it matches better, and document on the two functions what scope they apply to.
 
Summary: Re-evaluate and document usage of BrowserPolicyConnector::SetPolicyProviderForTesting in tests (was: e-evaluate usage of BrowserPolicyConnector::SetPolicyProviderForTesting in tests)
Probably the best thing to have would be a
ProfilePolicyConnectorFactory::SetProviderForTesting(const std::string& profile_path, ConfigurationPolicyProvider* provider);

which would only apply for the passed |profile_path|.

Comment 4 by loyso@chromium.org, Today (7 hours ago)

Do we have a doc on ChromeOS SignIn profile?
Looks like that's a system profile for login screen UI:
https://cs.chromium.org/chromium/src/chrome/browser/chromeos/profiles/profile_helper.cc?gsn=IsSigninProfile&g=0&l=140

What policies does it need?
Looks like it definitely doesn't need policy-installed apps.

Sign in to add a comment