Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Unified Diff: chrome/browser/policy/policy_browsertest.cc

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed another test. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/policy_browsertest.cc
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index 99d02d8e371fc794435cd9be39f6933590c2eceb..80f612934b6db331fdc1755aa6aad4465524b92a 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -100,6 +100,7 @@
#include "components/policy/core/common/policy_pref_names.h"
#include "components/policy/core/common/policy_service.h"
#include "components/policy/core/common/policy_service_impl.h"
+#include "components/policy/core/common/policy_types.h"
#include "components/search/search.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h"
@@ -674,6 +675,7 @@ class PolicyTest : public InProcessBrowserTest {
policies.Set(key::kDisableScreenshots,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(!enabled),
NULL);
UpdateProviderPolicy(policies);
@@ -822,6 +824,7 @@ class PolicyTest : public InProcessBrowserTest {
policies->Set(key,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
value,
nullptr);
} else {
@@ -880,6 +883,7 @@ class LocalePolicyTest : public PolicyTest {
policies.Set(key::kApplicationLocaleValue,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("fr"),
NULL);
provider_.UpdateChromePolicy(policies);
@@ -928,6 +932,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, BookmarkBarEnabled) {
policies.Set(key::kBookmarkBarEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -942,6 +947,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, BookmarkBarEnabled) {
policies.Set(key::kBookmarkBarEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -981,6 +987,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, PRE_DefaultCookiesSetting) {
policies.Set(key::kDefaultCookiesSetting,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(4),
NULL);
UpdateProviderPolicy(policies);
@@ -1029,41 +1036,48 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DefaultSearchProvider) {
policies.Set(key::kDefaultSearchProviderEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
policies.Set(key::kDefaultSearchProviderKeyword,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kKeyword),
NULL);
policies.Set(key::kDefaultSearchProviderSearchURL,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kSearchURL),
NULL);
base::ListValue* alternate_urls = new base::ListValue();
alternate_urls->AppendString(kAlternateURL0);
alternate_urls->AppendString(kAlternateURL1);
policies.Set(key::kDefaultSearchProviderAlternateURLs, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, alternate_urls, NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, alternate_urls, nullptr);
policies.Set(key::kDefaultSearchProviderSearchTermsReplacementKey,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kSearchTermsReplacementKey),
NULL);
policies.Set(key::kDefaultSearchProviderImageURL,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kImageURL),
NULL);
policies.Set(key::kDefaultSearchProviderImageURLPostParams,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kImageURLPostParams),
NULL);
policies.Set(key::kDefaultSearchProviderNewTabURL,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kNewTabURL),
NULL);
UpdateProviderPolicy(policies);
@@ -1096,6 +1110,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DefaultSearchProvider) {
policies.Set(key::kDefaultSearchProviderEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
EXPECT_TRUE(service->GetDefaultSearchProvider());
@@ -1113,6 +1128,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, PolicyPreprocessing) {
policies.Set(key::kProxyServerMode,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(3),
NULL);
UpdateProviderPolicy(policies);
@@ -1124,6 +1140,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, PolicyPreprocessing) {
expected.Set(key::kProxySettings,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
expected_value.release(),
NULL);
@@ -1216,31 +1233,37 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ReplaceSearchTerms) {
policies.Set(key::kDefaultSearchProviderEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
policies.Set(key::kDefaultSearchProviderKeyword,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kKeyword),
NULL);
policies.Set(key::kDefaultSearchProviderSearchURL,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kSearchURL),
NULL);
policies.Set(key::kDefaultSearchProviderInstantURL,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kInstantURL),
NULL);
base::ListValue* alternate_urls = new base::ListValue();
alternate_urls->AppendString(kAlternateURL0);
alternate_urls->AppendString(kAlternateURL1);
policies.Set(key::kDefaultSearchProviderAlternateURLs, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, alternate_urls, NULL);
+ POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD, alternate_urls, nullptr);
policies.Set(key::kDefaultSearchProviderSearchTermsReplacementKey,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kSearchTermsReplacementKey),
NULL);
UpdateProviderPolicy(policies);
@@ -1322,6 +1345,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, Disable3DAPIs) {
policies.Set(key::kDisable3DAPIs,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -1333,6 +1357,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, Disable3DAPIs) {
policies.Set(key::kDisable3DAPIs,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -1348,6 +1373,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DisableSpdy) {
policies.Set(key::kDisableSpdy,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -1358,6 +1384,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DisableSpdy) {
policies.Set(key::kDisableSpdy,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -1387,8 +1414,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DisabledPlugins) {
base::ListValue disabled_plugins;
disabled_plugins.Append(new base::StringValue("*Flash*"));
PolicyMap policies;
- policies.Set(key::kDisabledPlugins, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, disabled_plugins.DeepCopy(), NULL);
+ policies.Set(key::kDisabledPlugins, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD, disabled_plugins.DeepCopy(), nullptr);
UpdateProviderPolicy(policies);
EXPECT_FALSE(plugin_prefs->IsPluginEnabled(*flash));
// The user shouldn't be able to enable it.
@@ -1414,8 +1441,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DisabledPluginsExceptions) {
base::ListValue disabled_plugins;
disabled_plugins.Append(new base::StringValue("*"));
PolicyMap policies;
- policies.Set(key::kDisabledPlugins, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, disabled_plugins.DeepCopy(), NULL);
+ policies.Set(key::kDisabledPlugins, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD, disabled_plugins.DeepCopy(), nullptr);
UpdateProviderPolicy(policies);
EXPECT_FALSE(plugin_prefs->IsPluginEnabled(*flash));
// The user shouldn't be able to enable it.
@@ -1426,7 +1453,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DisabledPluginsExceptions) {
base::ListValue disabled_plugins_exceptions;
disabled_plugins_exceptions.Append(new base::StringValue("*Flash*"));
policies.Set(key::kDisabledPluginsExceptions, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, disabled_plugins_exceptions.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
+ disabled_plugins_exceptions.DeepCopy(), nullptr);
UpdateProviderPolicy(policies);
// It should revert to the user's preference automatically.
EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash));
@@ -1455,7 +1483,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, EnabledPlugins) {
plugin_list.Append(new base::StringValue(content::kFlashPluginName));
PolicyMap policies;
policies.Set(key::kEnabledPlugins, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, plugin_list.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, plugin_list.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash));
// The user can't disable it anymore.
@@ -1464,7 +1493,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, EnabledPlugins) {
// When a plugin is both enabled and disabled, the whitelist takes precedence.
policies.Set(key::kDisabledPlugins, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, plugin_list.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, plugin_list.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash));
}
@@ -1509,6 +1539,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, AlwaysAuthorizePlugins) {
policies.Set(key::kAlwaysAuthorizePlugins,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -1535,6 +1566,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DeveloperToolsDisabled) {
policies.Set(key::kDeveloperToolsDisabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
content::WindowedNotificationObserver close_observer(
@@ -1582,6 +1614,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_WebStoreIconHidden) {
policies.Set(key::kHideWebStoreIcon,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -1617,6 +1650,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DownloadDirectory) {
policies.Set(key::kDownloadDirectory,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(forced_dir.path().value()),
NULL);
UpdateProviderPolicy(policies);
@@ -1634,7 +1668,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallBlacklistSelective) {
blacklist.Append(new base::StringValue(kGoodCrxId));
PolicyMap policies;
policies.Set(key::kExtensionInstallBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
// "good.crx" is blacklisted.
@@ -1665,7 +1700,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallBlacklistWildcard) {
blacklist.Append(new base::StringValue("*"));
PolicyMap policies;
policies.Set(key::kExtensionInstallBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
// AdBlock was automatically removed.
@@ -1712,9 +1748,11 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallBlacklistSharedModules) {
base::StringPrintf("%s;%s", kImporterId, update_xml_url.spec().c_str()));
PolicyMap policies;
policies.Set(key::kExtensionInstallBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
policies.Set(key::kExtensionInstallForcelist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, forcelist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, forcelist.DeepCopy(),
+ nullptr);
extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(browser()->profile());
@@ -1761,9 +1799,11 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallWhitelist) {
whitelist.Append(new base::StringValue(kGoodCrxId));
PolicyMap policies;
policies.Set(key::kExtensionInstallBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
policies.Set(key::kExtensionInstallWhitelist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, whitelist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, whitelist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
// "adblock.crx" is blacklisted.
EXPECT_FALSE(InstallExtension(kAdBlockCrxName));
@@ -1796,7 +1836,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallForcelist) {
base::StringPrintf("%s;%s", kGoodCrxId, url.spec().c_str())));
PolicyMap policies;
policies.Set(key::kExtensionInstallForcelist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, forcelist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, forcelist.DeepCopy(),
+ nullptr);
content::WindowedNotificationObserver observer(
extensions::NOTIFICATION_EXTENSION_WILL_BE_INSTALLED_DEPRECATED,
content::NotificationService::AllSources());
@@ -1915,6 +1956,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionRecommendedInstallationMode) {
policies.Set(key::kExtensionSettings,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
dict_value.DeepCopy(),
NULL);
content::WindowedNotificationObserver observer(
@@ -1948,7 +1990,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionAllowedTypes) {
allowed_types.AppendString("hosted_app");
PolicyMap policies;
policies.Set(key::kExtensionAllowedTypes, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, allowed_types.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, allowed_types.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
// "good.crx" is blocked.
@@ -2006,7 +2049,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) {
install_sources.AppendString(referrer_url.spec());
PolicyMap policies;
policies.Set(key::kExtensionInstallSources, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, install_sources.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
+ install_sources.DeepCopy(), nullptr);
UpdateProviderPolicy(policies);
content::WindowedNotificationObserver observer(
@@ -2236,6 +2280,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, HomepageLocation) {
policies.Set(key::kHomepageLocation,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(chrome::kChromeUICreditsURL),
NULL);
UpdateProviderPolicy(policies);
@@ -2246,6 +2291,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, HomepageLocation) {
policies.Set(key::kHomepageIsNewTabPage,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -2268,6 +2314,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, IncognitoEnabled) {
policies.Set(key::kIncognitoEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -2279,6 +2326,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, IncognitoEnabled) {
policies.Set(key::kIncognitoEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -2301,6 +2349,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, Javascript) {
policies.Set(key::kJavascriptEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -2321,6 +2370,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, Javascript) {
policies.Set(key::kDefaultJavaScriptSetting,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(CONTENT_SETTING_ALLOW),
NULL);
UpdateProviderPolicy(policies);
@@ -2339,6 +2389,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, NetworkPrediction) {
policies.Set(key::kDnsPrefetchingEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -2350,6 +2401,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, NetworkPrediction) {
key::kNetworkPredictionOptions,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(chrome_browser_net::NETWORK_PREDICTION_ALWAYS),
NULL);
UpdateProviderPolicy(policies);
@@ -2363,6 +2415,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, SavingBrowserHistoryDisabled) {
policies.Set(key::kSavingBrowserHistoryDisabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -2378,6 +2431,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, SavingBrowserHistoryDisabled) {
policies.Set(key::kSavingBrowserHistoryDisabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -2413,6 +2467,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) {
policies.Set(key::kTranslateEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -2458,6 +2513,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) {
policies.Set(key::kTranslateEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -2500,7 +2556,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, URLBlacklist) {
blacklist.Append(new base::StringValue("bbb.com"));
PolicyMap policies;
policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
FlushBlacklistPolicy();
// All bbb.com URLs are blocked, and "aaa.com" is still unblocked.
@@ -2513,7 +2570,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, URLBlacklist) {
whitelist.Append(new base::StringValue("sub.bbb.com"));
whitelist.Append(new base::StringValue("bbb.com/policy"));
policies.Set(key::kURLWhitelist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, whitelist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, whitelist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
FlushBlacklistPolicy();
CheckURLIsBlocked(browser(), kURLS[1]);
@@ -2549,7 +2607,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, URLBlacklistSubresources) {
blacklist.Append(new base::StringValue(subframe_url.spec().c_str()));
PolicyMap policies;
policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
FlushBlacklistPolicy();
@@ -2595,7 +2654,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_FileURLBlacklist) {
blacklist.Append(new base::StringValue("file://*"));
PolicyMap policies;
policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
FlushBlacklistPolicy();
@@ -2605,7 +2665,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_FileURLBlacklist) {
// Replace the URLblacklist with disabling the file scheme.
blacklist.Remove(base::StringValue("file://*"), NULL);
policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
FlushBlacklistPolicy();
@@ -2617,7 +2678,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_FileURLBlacklist) {
base::ListValue disabledscheme;
disabledscheme.Append(new base::StringValue("file"));
policies.Set(key::kDisabledSchemes, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, disabledscheme.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
+ disabledscheme.DeepCopy(), nullptr);
UpdateProviderPolicy(policies);
FlushBlacklistPolicy();
@@ -2629,10 +2691,12 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_FileURLBlacklist) {
base::ListValue whitelist;
whitelist.Append(new base::StringValue(base_path));
policies.Set(key::kURLWhitelist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, whitelist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, whitelist.DeepCopy(),
+ nullptr);
blacklist.Append(new base::StringValue(folder_path));
policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
FlushBlacklistPolicy();
@@ -2681,6 +2745,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, SSLVersionFallbackMin) {
policies.Set(key::kSSLVersionFallbackMin,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(new_value),
NULL);
UpdateProviderPolicy(policies);
@@ -2695,6 +2760,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, FullscreenAllowedBrowser) {
policies.Set(key::kFullscreenAllowed,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -2712,6 +2778,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, FullscreenAllowedApp) {
policies.Set(key::kFullscreenAllowed,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -2783,6 +2850,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DisableAudioOutput) {
policies.Set(key::kAudioOutputAllowed,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -2797,6 +2865,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DisableAudioOutput) {
policies.Set(key::kAudioOutputAllowed,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -2836,6 +2905,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_SessionLengthLimit) {
policies.Set(key::kSessionLengthLimit,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(kThreeHoursInMs),
NULL);
UpdateProviderPolicy(policies);
@@ -2848,6 +2918,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_SessionLengthLimit) {
policies.Set(key::kSessionLengthLimit,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(kOneHourInMs),
NULL);
UpdateProviderPolicy(policies);
@@ -2879,6 +2950,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest,
PolicyMap policies;
policies.Set(key::kWaitForInitialUserActivity, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -2891,6 +2963,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest,
policies.Set(key::kSessionLengthLimit,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(kOneHourInMs),
NULL);
UpdateProviderPolicy(policies);
@@ -2927,11 +3000,13 @@ IN_PROC_BROWSER_TEST_F(PolicyTest,
PolicyMap policies;
policies.Set(key::kWaitForInitialUserActivity, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
policies.Set(key::kSessionLengthLimit,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(kThreeHoursInMs),
NULL);
UpdateProviderPolicy(policies);
@@ -2944,6 +3019,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest,
policies.Set(key::kSessionLengthLimit,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(kOneHourInMs),
NULL);
UpdateProviderPolicy(policies);
@@ -2966,6 +3042,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, LargeCursorEnabled) {
policies.Set(key::kLargeCursorEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -2992,6 +3069,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, SpokenFeedbackEnabled) {
policies.Set(key::kSpokenFeedbackEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -3018,6 +3096,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, HighContrastEnabled) {
policies.Set(key::kHighContrastEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -3044,6 +3123,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ScreenMagnifierTypeNone) {
policies.Set(key::kScreenMagnifierType,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(0),
NULL);
UpdateProviderPolicy(policies);
@@ -3067,6 +3147,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ScreenMagnifierTypeFull) {
policies.Set(key::kScreenMagnifierType,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(ui::MAGNIFIER_FULL),
NULL);
UpdateProviderPolicy(policies);
@@ -3093,6 +3174,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, AccessibilityVirtualKeyboardEnabled) {
policies.Set(key::kVirtualKeyboardEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -3118,6 +3200,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, VirtualKeyboardEnabled) {
policies.Set(key::kTouchVirtualKeyboardEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -3130,6 +3213,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, VirtualKeyboardEnabled) {
policies.Set(key::kTouchVirtualKeyboardEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);
@@ -3204,16 +3288,19 @@ class RestoreOnStartupPolicyTest
key::kRestoreOnStartup,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage),
NULL);
policies.Set(key::kHomepageIsNewTabPage,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
policies.Set(key::kHomepageLocation,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(kRestoredURLs[1]),
NULL);
provider_.UpdateChromePolicy(policies);
@@ -3229,11 +3316,13 @@ class RestoreOnStartupPolicyTest
key::kRestoreOnStartup,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(SessionStartupPref::kPrefValueHomePage),
NULL);
policies.Set(key::kHomepageIsNewTabPage,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
provider_.UpdateChromePolicy(policies);
@@ -3252,11 +3341,12 @@ class RestoreOnStartupPolicyTest
policies.Set(key::kRestoreOnStartup,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(SessionStartupPref::kPrefValueURLs),
NULL);
policies.Set(
key::kRestoreOnStartupURLs, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- urls.DeepCopy(), NULL);
+ POLICY_SOURCE_CLOUD, urls.DeepCopy(), nullptr);
provider_.UpdateChromePolicy(policies);
}
@@ -3267,6 +3357,7 @@ class RestoreOnStartupPolicyTest
key::kRestoreOnStartup,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(SessionStartupPref::kPrefValueNewTab),
NULL);
provider_.UpdateChromePolicy(policies);
@@ -3279,6 +3370,7 @@ class RestoreOnStartupPolicyTest
policies.Set(key::kRestoreOnStartup,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(SessionStartupPref::kPrefValueLast),
NULL);
provider_.UpdateChromePolicy(policies);
@@ -3343,16 +3435,19 @@ class PolicyStatisticsCollectorTest : public PolicyTest {
policies.Set(key::kShowHomeButton,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
policies.Set(key::kBookmarkBarEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
policies.Set(key::kHomepageLocation,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("http://chromium.org"),
NULL);
provider_.UpdateChromePolicy(policies);
@@ -3420,6 +3515,7 @@ class MediaStreamDevicesControllerBrowserTest
policies->Set(policy_name,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(policy_value_),
NULL);
@@ -3437,8 +3533,8 @@ class MediaStreamDevicesControllerBrowserTest
// is that the request has not been allowed via the whitelist.
request_url_allowed_via_whitelist_ = false;
}
- policies->Set(whitelist_policy, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, list, NULL);
+ policies->Set(whitelist_policy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD, list, nullptr);
}
}
@@ -3633,8 +3729,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, SafeBrowsingExtendedReportingOptInAllowed) {
prefs->GetBoolean(prefs::kSafeBrowsingExtendedReportingOptInAllowed));
PolicyMap policies;
policies.Set(key::kSafeBrowsingExtendedReportingOptInAllowed,
- POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- new base::FundamentalValue(false), NULL);
+ POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
+ new base::FundamentalValue(false), nullptr);
UpdateProviderPolicy(policies);
EXPECT_FALSE(
prefs->GetBoolean(prefs::kSafeBrowsingExtendedReportingOptInAllowed));
@@ -3717,7 +3813,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, SSLErrorOverridingDisallowed) {
// Disallowing the proceed link by setting the policy to |false|.
PolicyMap policies;
policies.Set(key::kSSLErrorOverrideAllowed, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, new base::FundamentalValue(false), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
+ new base::FundamentalValue(false), nullptr);
UpdateProviderPolicy(policies);
// Policy should not allow overriding anymore.
@@ -3766,6 +3863,7 @@ class PolicyVariationsServiceTest : public PolicyTest {
policies.Set(key::kVariationsRestrictParameter,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::StringValue("restricted"),
NULL);
provider_.UpdateChromePolicy(policies);
@@ -3797,7 +3895,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingBlacklistSelective) {
blacklist.Append(new base::StringValue("host.name"));
PolicyMap policies;
policies.Set(key::kNativeMessagingBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
PrefService* prefs = browser()->profile()->GetPrefs();
@@ -3812,7 +3911,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingBlacklistWildcard) {
blacklist.Append(new base::StringValue("*"));
PolicyMap policies;
policies.Set(key::kNativeMessagingBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
PrefService* prefs = browser()->profile()->GetPrefs();
@@ -3829,9 +3929,11 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, NativeMessagingWhitelist) {
whitelist.Append(new base::StringValue("host.name"));
PolicyMap policies;
policies.Set(key::kNativeMessagingBlacklist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, blacklist.DeepCopy(),
+ nullptr);
policies.Set(key::kNativeMessagingWhitelist, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, whitelist.DeepCopy(), NULL);
+ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, whitelist.DeepCopy(),
+ nullptr);
UpdateProviderPolicy(policies);
PrefService* prefs = browser()->profile()->GetPrefs();
@@ -3856,6 +3958,7 @@ class HardwareAccelerationModePolicyTest : public PolicyTest {
policies.Set(key::kHardwareAccelerationModeEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
provider_.UpdateChromePolicy(policies);
@@ -3887,6 +3990,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, UnifiedDesktopEnabledByDefault) {
policies.Set(key::kUnifiedDesktopEnabledByDefault,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(true),
NULL);
UpdateProviderPolicy(policies);
@@ -3894,6 +3998,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, UnifiedDesktopEnabledByDefault) {
policies.Set(key::kUnifiedDesktopEnabledByDefault,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(false),
NULL);
UpdateProviderPolicy(policies);

Powered by Google App Engine
This is Rietveld 408576698