| 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 d86196dc3526b7d47d8b017a8495a272fe67a608..41efd0b79af13b850d2007bc2b73197e2107931a 100644
|
| --- a/chrome/browser/policy/policy_prefs_browsertest.cc
|
| +++ b/chrome/browser/policy/policy_prefs_browsertest.cc
|
| @@ -101,12 +101,14 @@ class PrefMapping {
|
| bool is_local_state,
|
| bool check_for_mandatory,
|
| bool check_for_recommended,
|
| + const std::string& indicator_test_url,
|
| const std::string& indicator_test_setup_js,
|
| const std::string& indicator_selector)
|
| : pref_(pref),
|
| is_local_state_(is_local_state),
|
| check_for_mandatory_(check_for_mandatory),
|
| check_for_recommended_(check_for_recommended),
|
| + indicator_test_url_(indicator_test_url),
|
| indicator_test_setup_js_(indicator_test_setup_js),
|
| indicator_selector_(indicator_selector) {}
|
| ~PrefMapping() {}
|
| @@ -119,6 +121,10 @@ class PrefMapping {
|
|
|
| bool check_for_recommended() const { return check_for_recommended_; }
|
|
|
| + const std::string& indicator_test_url() const {
|
| + return indicator_test_url_;
|
| + }
|
| +
|
| const std::string& indicator_test_setup_js() const {
|
| return indicator_test_setup_js_;
|
| }
|
| @@ -139,6 +145,7 @@ class PrefMapping {
|
| const bool is_local_state_;
|
| const bool check_for_mandatory_;
|
| const bool check_for_recommended_;
|
| + const std::string indicator_test_url_;
|
| const std::string indicator_test_setup_js_;
|
| const std::string indicator_selector_;
|
| ScopedVector<IndicatorTestCase> indicator_test_cases_;
|
| @@ -218,7 +225,7 @@ class PolicyTestCase {
|
| DISALLOW_COPY_AND_ASSIGN(PolicyTestCase);
|
| };
|
|
|
| -// Parses all policy test cases and makes then available in a map.
|
| +// Parses all policy test cases and makes them available in a map.
|
| class PolicyTestCases {
|
| public:
|
| typedef std::vector<PolicyTestCase*> PolicyTestCaseVector;
|
| @@ -327,6 +334,9 @@ class PolicyTestCases {
|
| bool check_for_recommended = true;
|
| pref_mapping_dict->GetBoolean("check_for_recommended",
|
| &check_for_recommended);
|
| + std::string indicator_test_url;
|
| + pref_mapping_dict->GetString("indicator_test_url",
|
| + &indicator_test_url);
|
| std::string indicator_test_setup_js;
|
| pref_mapping_dict->GetString("indicator_test_setup_js",
|
| &indicator_test_setup_js);
|
| @@ -336,6 +346,7 @@ class PolicyTestCases {
|
| is_local_state,
|
| check_for_mandatory,
|
| check_for_recommended,
|
| + indicator_test_url,
|
| indicator_test_setup_js,
|
| indicator_selector);
|
| const base::ListValue* indicator_tests = NULL;
|
| @@ -693,6 +704,18 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefIndicatorTest, CheckPolicyIndicators) {
|
| (*pref_mapping)->indicator_test_setup_js()));
|
| }
|
|
|
| + // Note: a non-empty indicator_test_url is expected to be used in very
|
| + // few cases, so it's currently implemented by navigating to the URL
|
| + // right before the test and navigating back afterwards.
|
| + // If there should ever be many of these, we could consider grouping
|
| + // tests by indicator_test_url and only navigate to the URL once for
|
| + // many tests.
|
| + if (!(*pref_mapping)->indicator_test_url().empty()) {
|
| + ui_test_utils::NavigateToURL(
|
| + browser(),
|
| + GURL((*pref_mapping)->indicator_test_url()));
|
| + }
|
| +
|
| std::string indicator_selector = (*pref_mapping)->indicator_selector();
|
| if (indicator_selector.empty())
|
| indicator_selector = "[pref=\"" + (*pref_mapping)->pref() + "\"]";
|
| @@ -756,6 +779,9 @@ IN_PROC_BROWSER_TEST_P(PolicyPrefIndicatorTest, CheckPolicyIndicators) {
|
| (*indicator_test_case)->readonly());
|
| prefs->ClearPref((*pref_mapping)->pref().c_str());
|
| }
|
| +
|
| + if (!(*pref_mapping)->indicator_test_url().empty())
|
| + ui_test_utils::NavigateToURL(browser(), GURL(kMainSettingsPage));
|
| }
|
| }
|
| }
|
|
|