Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <cstdlib> | 6 #include <cstdlib> |
| 7 #include <map> | 7 #include <map> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "base/run_loop.h" | 21 #include "base/run_loop.h" |
| 22 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/values.h" | 25 #include "base/values.h" |
| 26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/search_engines/template_url_service_factory.h" | 28 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 29 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
| 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 31 #include "chrome/common/pref_names.h" | |
| 31 #include "chrome/test/base/in_process_browser_test.h" | 32 #include "chrome/test/base/in_process_browser_test.h" |
| 32 #include "chrome/test/base/ui_test_utils.h" | 33 #include "chrome/test/base/ui_test_utils.h" |
| 33 #include "components/policy/core/browser/browser_policy_connector.h" | 34 #include "components/policy/core/browser/browser_policy_connector.h" |
| 34 #include "components/policy/core/common/external_data_fetcher.h" | 35 #include "components/policy/core/common/external_data_fetcher.h" |
| 35 #include "components/policy/core/common/external_data_manager.h" | 36 #include "components/policy/core/common/external_data_manager.h" |
| 36 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 37 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
| 37 #include "components/policy/core/common/policy_details.h" | 38 #include "components/policy/core/common/policy_details.h" |
| 38 #include "components/policy/core/common/policy_map.h" | 39 #include "components/policy/core/common/policy_map.h" |
| 39 #include "components/policy/core/common/schema.h" | 40 #include "components/policy/core/common/schema.h" |
| 40 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 713 continue; | 714 continue; |
| 714 } | 715 } |
| 715 | 716 |
| 716 PrefService* prefs = | 717 PrefService* prefs = |
| 717 (*pref_mapping)->is_local_state() ? local_state : user_prefs; | 718 (*pref_mapping)->is_local_state() ? local_state : user_prefs; |
| 718 // The preference must have been registered. | 719 // The preference must have been registered. |
| 719 const PrefService::Preference* pref = | 720 const PrefService::Preference* pref = |
| 720 prefs->FindPreference((*pref_mapping)->pref().c_str()); | 721 prefs->FindPreference((*pref_mapping)->pref().c_str()); |
| 721 ASSERT_TRUE(pref); | 722 ASSERT_TRUE(pref); |
| 722 | 723 |
| 724 // This hack is necessary because | |
| 725 // BrowserOptionsHandler::MigrateNetworkPredictionOptions migrates the | |
| 726 // deprecated kNetworkPredicitonEnabled preference into | |
| 727 // kNetworkPredictionOptions, setting a user value. | |
|
bartfab (slow)
2014/08/04 16:44:13
User values should be set by the user. The migrati
Bence
2014/08/04 20:35:32
Done.
| |
| 728 // TODO(bnc): https://crbug.com/334602 Remove this hack once | |
| 729 // migration code is removed. | |
| 730 if ((*pref_mapping)->pref().compare( | |
| 731 prefs::kNetworkPredictionOptions) == 0) { | |
| 732 prefs->ClearPref((*pref_mapping)->pref().c_str()); | |
| 733 } | |
| 734 | |
| 723 // Check that the appropriate controlled setting indicator is shown | 735 // Check that the appropriate controlled setting indicator is shown |
| 724 // when a value is recommended by policy and the user has not | 736 // when a value is recommended by policy and the user has not |
| 725 // overridden the recommendation. | 737 // overridden the recommendation. |
| 726 SetProviderPolicy((*indicator_test_case)->policy(), | 738 SetProviderPolicy((*indicator_test_case)->policy(), |
| 727 POLICY_LEVEL_RECOMMENDED); | 739 POLICY_LEVEL_RECOMMENDED); |
| 728 VerifyControlledSettingIndicators(browser(), | 740 VerifyControlledSettingIndicators(browser(), |
| 729 indicator_selector, | 741 indicator_selector, |
| 730 (*indicator_test_case)->value(), | 742 (*indicator_test_case)->value(), |
| 731 "recommended", | 743 "recommended", |
| 732 (*indicator_test_case)->readonly()); | 744 (*indicator_test_case)->readonly()); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 744 } | 756 } |
| 745 } | 757 } |
| 746 } | 758 } |
| 747 } | 759 } |
| 748 | 760 |
| 749 INSTANTIATE_TEST_CASE_P(PolicyPrefIndicatorTestInstance, | 761 INSTANTIATE_TEST_CASE_P(PolicyPrefIndicatorTestInstance, |
| 750 PolicyPrefIndicatorTest, | 762 PolicyPrefIndicatorTest, |
| 751 testing::ValuesIn(SplitPoliciesIntoChunks(10))); | 763 testing::ValuesIn(SplitPoliciesIntoChunks(10))); |
| 752 | 764 |
| 753 } // namespace policy | 765 } // namespace policy |
| OLD | NEW |