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" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 sync_preferences::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::Value(20)); |
109 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, | 109 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, |
110 new base::FundamentalValue(false)); | 110 new base::Value(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 } |
114 }; | 114 }; |
115 | 115 |
116 // Tests to see that webkit preferences are properly loaded and copied over | 116 // Tests to see that webkit preferences are properly loaded and copied over |
117 // to a WebPreferences object. | 117 // to a WebPreferences object. |
118 TEST_F(ChromePrefServiceWebKitPrefs, PrefsCopied) { | 118 TEST_F(ChromePrefServiceWebKitPrefs, PrefsCopied) { |
119 WebPreferences webkit_prefs = | 119 WebPreferences webkit_prefs = |
120 RenderViewHostTester::For(rvh())->TestComputeWebkitPrefs(); | 120 RenderViewHostTester::For(rvh())->TestComputeWebkitPrefs(); |
121 | 121 |
122 // These values have been overridden by the profile preferences. | 122 // These values have been overridden by the profile preferences. |
123 EXPECT_EQ("UTF-8", webkit_prefs.default_encoding); | 123 EXPECT_EQ("UTF-8", webkit_prefs.default_encoding); |
124 EXPECT_EQ(20, webkit_prefs.default_font_size); | 124 EXPECT_EQ(20, webkit_prefs.default_font_size); |
125 EXPECT_FALSE(webkit_prefs.text_areas_are_resizable); | 125 EXPECT_FALSE(webkit_prefs.text_areas_are_resizable); |
126 | 126 |
127 // These should still be the default values. | 127 // These should still be the default values. |
128 #if defined(OS_MACOSX) | 128 #if defined(OS_MACOSX) |
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 |