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

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

Issue 11276006: Add Chrome OS-specific controlled setting indicators (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mark DeviceMetricsReporting policy as official only. Created 8 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/browser_options.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_prefs_browsertest.cc
diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc
index 67667381b77153837ac9e5bc8c189b53db6e1562..7991c3fb521fef74d63f9018822d39d6240ed27c 100644
--- a/chrome/browser/policy/policy_prefs_browsertest.cc
+++ b/chrome/browser/policy/policy_prefs_browsertest.cc
@@ -15,6 +15,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/stl_util.h"
+#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
@@ -53,6 +54,8 @@ const char* kSettingsPages[] = {
#endif
};
+const char kCrosSettingsPrefix[] = "cros.";
+
// Contains the details of a single test case verifying that the controlled
// setting indicators for a pref affected by a policy work correctly. This is
// part of the data loaded from chrome/test/data/policy/policy_test_cases.json.
@@ -504,6 +507,11 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, PolicyToPrefsMapping) {
pref_mapping = pref_mappings.begin();
pref_mapping != pref_mappings.end();
++pref_mapping) {
+ // Skip Chrome OS preferences that use a different backend and cannot be
+ // retrieved through the prefs mechanism.
+ if (StartsWithASCII((*pref_mapping)->pref(), kCrosSettingsPrefix, true))
+ continue;
+
PrefService* prefs = (*pref_mapping)->is_local_state() ?
g_browser_process->local_state() : browser()->profile()->GetPrefs();
// The preference must have been registered.
@@ -581,12 +589,6 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, CheckPolicyIndicators) {
indicator_test_cases = (*pref_mapping)->indicator_test_cases();
if (indicator_test_cases.empty())
continue;
- PrefService* prefs = (*pref_mapping)->is_local_state() ?
- g_browser_process->local_state() : browser()->profile()->GetPrefs();
- // The preference must have been registered.
- const PrefService::Preference* pref =
- prefs->FindPreference((*pref_mapping)->pref().c_str());
- ASSERT_TRUE(pref);
ui_test_utils::NavigateToURL(browser(), GURL(kSettingsPages[0]));
if (!(*pref_mapping)->indicator_test_setup_js().empty()) {
@@ -617,8 +619,17 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, CheckPolicyIndicators) {
(*indicator_test_case)->value(),
"policy",
(*indicator_test_case)->readonly());
+
if (!policy_test_case->can_be_recommended())
continue;
+
+ PrefService* prefs = (*pref_mapping)->is_local_state() ?
+ g_browser_process->local_state() : browser()->profile()->GetPrefs();
+ // The preference must have been registered.
+ const PrefService::Preference* pref =
+ prefs->FindPreference((*pref_mapping)->pref().c_str());
+ ASSERT_TRUE(pref);
+
// Check that the appropriate controlled setting indicator is shown when a
// value is recommended by policy and the user has not overridden the
// recommendation.
« no previous file with comments | « no previous file | chrome/browser/resources/options/browser_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698