Chromium Code Reviews| 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..55a1dcf52fe640864e75285335dfc4f9e1301a87 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."; |
|
Joao da Silva
2012/10/24 16:26:17
This is chromeos::kCrosSettingsPrefix from chrome/
bartfab (slow)
2012/10/24 17:33:51
Done.
|
| + |
| // 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,9 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, PolicyToPrefsMapping) { |
| pref_mapping = pref_mappings.begin(); |
| pref_mapping != pref_mappings.end(); |
| ++pref_mapping) { |
| + if (StartsWithASCII((*pref_mapping)->pref(), kCrosSettingsPrefix, true)) |
|
Joao da Silva
2012/10/24 16:26:17
Add a comment ("Skip chromeos preferences" or simi
bartfab (slow)
2012/10/24 17:33:51
Done.
|
| + continue; |
| + |
| PrefService* prefs = (*pref_mapping)->is_local_state() ? |
| g_browser_process->local_state() : browser()->profile()->GetPrefs(); |
| // The preference must have been registered. |
| @@ -583,10 +589,8 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, CheckPolicyIndicators) { |
| 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 +621,12 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefsTest, CheckPolicyIndicators) { |
| (*indicator_test_case)->value(), |
| "policy", |
| (*indicator_test_case)->readonly()); |
| + |
| if (!policy_test_case->can_be_recommended()) |
| continue; |
| + // The preference must have been registered. |
| + ASSERT_TRUE(pref); |
|
Joao da Silva
2012/10/24 16:26:17
Move the |pref| definition here too, closer to whe
bartfab (slow)
2012/10/24 17:33:51
Done.
|
| + |
| // Check that the appropriate controlled setting indicator is shown when a |
| // value is recommended by policy and the user has not overridden the |
| // recommendation. |