OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "chrome/browser/prefs/browser_prefs.h" | 14 #include "chrome/browser/prefs/browser_prefs.h" |
15 #include "chrome/browser/prefs/chrome_command_line_pref_store.h" | 15 #include "chrome/browser/prefs/chrome_command_line_pref_store.h" |
16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
21 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 21 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
22 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 22 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
23 #include "components/pref_registry/pref_registry_syncable.h" | 23 #include "components/pref_registry/pref_registry_syncable.h" |
24 #include "components/prefs/pref_registry_simple.h" | 24 #include "components/prefs/pref_registry_simple.h" |
25 #include "components/prefs/scoped_user_pref_update.h" | 25 #include "components/prefs/scoped_user_pref_update.h" |
26 #include "components/syncable_prefs/pref_service_mock_factory.h" | 26 #include "components/sync_preferences/pref_service_mock_factory.h" |
27 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 27 #include "components/sync_preferences/testing_pref_service_syncable.h" |
28 #include "content/public/common/web_preferences.h" | 28 #include "content/public/common/web_preferences.h" |
29 #include "content/public/test/test_renderer_host.h" | 29 #include "content/public/test/test_renderer_host.h" |
30 #include "ui/base/test/data/resource.h" | 30 #include "ui/base/test/data/resource.h" |
31 | 31 |
32 using content::RenderViewHostTester; | 32 using content::RenderViewHostTester; |
33 using content::WebPreferences; | 33 using content::WebPreferences; |
34 | 34 |
35 TEST(ChromePrefServiceTest, UpdateCommandLinePrefStore) { | 35 TEST(ChromePrefServiceTest, UpdateCommandLinePrefStore) { |
36 TestingPrefServiceSimple prefs; | 36 TestingPrefServiceSimple prefs; |
37 prefs.registry()->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, false); | 37 prefs.registry()->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, false); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 class ChromePrefServiceWebKitPrefs : public ChromeRenderViewHostTestHarness { | 94 class ChromePrefServiceWebKitPrefs : public ChromeRenderViewHostTestHarness { |
95 protected: | 95 protected: |
96 void SetUp() override { | 96 void SetUp() override { |
97 ChromeRenderViewHostTestHarness::SetUp(); | 97 ChromeRenderViewHostTestHarness::SetUp(); |
98 | 98 |
99 // Supply our own profile so we use the correct profile data. The test | 99 // Supply our own profile so we use the correct profile data. The test |
100 // harness is not supposed to overwrite a profile if it's already created. | 100 // harness is not supposed to overwrite a profile if it's already created. |
101 | 101 |
102 // Set some (WebKit) user preferences. | 102 // Set some (WebKit) user preferences. |
103 syncable_prefs::TestingPrefServiceSyncable* pref_services = | 103 sync_preferences::TestingPrefServiceSyncable* pref_services = |
104 profile()->GetTestingPrefService(); | 104 profile()->GetTestingPrefService(); |
105 pref_services->SetUserPref(prefs::kDefaultCharset, | 105 pref_services->SetUserPref(prefs::kDefaultCharset, |
106 new base::StringValue("utf8")); | 106 new base::StringValue("utf8")); |
107 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, | 107 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, |
108 new base::FundamentalValue(20)); | 108 new base::FundamentalValue(20)); |
109 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, | 109 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, |
110 new base::FundamentalValue(false)); | 110 new base::FundamentalValue(false)); |
111 pref_services->SetUserPref("webkit.webprefs.foo", | 111 pref_services->SetUserPref("webkit.webprefs.foo", |
112 new base::StringValue("bar")); | 112 new base::StringValue("bar")); |
113 } | 113 } |
(...skipping 15 matching lines...) Expand all Loading... |
129 const char kDefaultFont[] = "Times"; | 129 const char kDefaultFont[] = "Times"; |
130 #elif defined(OS_CHROMEOS) | 130 #elif defined(OS_CHROMEOS) |
131 const char kDefaultFont[] = "Tinos"; | 131 const char kDefaultFont[] = "Tinos"; |
132 #else | 132 #else |
133 const char kDefaultFont[] = "Times New Roman"; | 133 const char kDefaultFont[] = "Times New Roman"; |
134 #endif | 134 #endif |
135 EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont), | 135 EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont), |
136 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); | 136 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); |
137 EXPECT_TRUE(webkit_prefs.javascript_enabled); | 137 EXPECT_TRUE(webkit_prefs.javascript_enabled); |
138 } | 138 } |
OLD | NEW |