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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // harness is not supposed to overwrite a profile if it's already created. | 98 // harness is not supposed to overwrite a profile if it's already created. |
99 | 99 |
100 // Set some (WebKit) user preferences. | 100 // Set some (WebKit) user preferences. |
101 TestingPrefServiceSyncable* pref_services = | 101 TestingPrefServiceSyncable* pref_services = |
102 profile()->GetTestingPrefService(); | 102 profile()->GetTestingPrefService(); |
103 pref_services->SetUserPref(prefs::kDefaultCharset, | 103 pref_services->SetUserPref(prefs::kDefaultCharset, |
104 base::Value::CreateStringValue("utf8")); | 104 base::Value::CreateStringValue("utf8")); |
105 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, | 105 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, |
106 base::Value::CreateIntegerValue(20)); | 106 base::Value::CreateIntegerValue(20)); |
107 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, | 107 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, |
108 base::Value::CreateBooleanValue(false)); | 108 new base::FundamentalValue(false)); |
109 pref_services->SetUserPref(prefs::kWebKitUsesUniversalDetector, | 109 pref_services->SetUserPref(prefs::kWebKitUsesUniversalDetector, |
110 base::Value::CreateBooleanValue(true)); | 110 new base::FundamentalValue(true)); |
111 pref_services->SetUserPref("webkit.webprefs.foo", | 111 pref_services->SetUserPref("webkit.webprefs.foo", |
112 base::Value::CreateStringValue("bar")); | 112 base::Value::CreateStringValue("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 WebContentsTester::For(web_contents())->TestGetWebkitPrefs(); | 120 WebContentsTester::For(web_contents())->TestGetWebkitPrefs(); |
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 EXPECT_TRUE(webkit_prefs.uses_universal_detector); | 126 EXPECT_TRUE(webkit_prefs.uses_universal_detector); |
127 | 127 |
128 // These should still be the default values. | 128 // These should still be the default values. |
129 #if defined(OS_MACOSX) | 129 #if defined(OS_MACOSX) |
130 const char kDefaultFont[] = "Times"; | 130 const char kDefaultFont[] = "Times"; |
131 #elif defined(OS_CHROMEOS) | 131 #elif defined(OS_CHROMEOS) |
132 const char kDefaultFont[] = "Tinos"; | 132 const char kDefaultFont[] = "Tinos"; |
133 #else | 133 #else |
134 const char kDefaultFont[] = "Times New Roman"; | 134 const char kDefaultFont[] = "Times New Roman"; |
135 #endif | 135 #endif |
136 EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont), | 136 EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont), |
137 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); | 137 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); |
138 EXPECT_TRUE(webkit_prefs.javascript_enabled); | 138 EXPECT_TRUE(webkit_prefs.javascript_enabled); |
139 } | 139 } |
OLD | NEW |