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/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/browser/prefs/chrome_command_line_pref_store.h" | 7 #include "chrome/browser/prefs/chrome_command_line_pref_store.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 // Supply our own profile so we use the correct profile data. The test | 56 // Supply our own profile so we use the correct profile data. The test |
57 // harness is not supposed to overwrite a profile if it's already created. | 57 // harness is not supposed to overwrite a profile if it's already created. |
58 | 58 |
59 // Set some (WebKit) user preferences. | 59 // Set some (WebKit) user preferences. |
60 sync_preferences::TestingPrefServiceSyncable* pref_services = | 60 sync_preferences::TestingPrefServiceSyncable* pref_services = |
61 profile()->GetTestingPrefService(); | 61 profile()->GetTestingPrefService(); |
62 pref_services->SetUserPref(prefs::kDefaultCharset, | 62 pref_services->SetUserPref(prefs::kDefaultCharset, |
63 new base::StringValue("utf8")); | 63 new base::StringValue("utf8")); |
64 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, | 64 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, |
65 new base::FundamentalValue(20)); | 65 new base::Value(20)); |
66 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, | 66 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, |
67 new base::FundamentalValue(false)); | 67 new base::Value(false)); |
68 pref_services->SetUserPref("webkit.webprefs.foo", | 68 pref_services->SetUserPref("webkit.webprefs.foo", |
69 new base::StringValue("bar")); | 69 new base::StringValue("bar")); |
70 } | 70 } |
71 }; | 71 }; |
72 | 72 |
73 // Tests to see that webkit preferences are properly loaded and copied over | 73 // Tests to see that webkit preferences are properly loaded and copied over |
74 // to a WebPreferences object. | 74 // to a WebPreferences object. |
75 TEST_F(ChromePrefServiceWebKitPrefs, PrefsCopied) { | 75 TEST_F(ChromePrefServiceWebKitPrefs, PrefsCopied) { |
76 WebPreferences webkit_prefs = | 76 WebPreferences webkit_prefs = |
77 RenderViewHostTester::For(rvh())->TestComputeWebkitPrefs(); | 77 RenderViewHostTester::For(rvh())->TestComputeWebkitPrefs(); |
78 | 78 |
79 // These values have been overridden by the profile preferences. | 79 // These values have been overridden by the profile preferences. |
80 EXPECT_EQ("UTF-8", webkit_prefs.default_encoding); | 80 EXPECT_EQ("UTF-8", webkit_prefs.default_encoding); |
81 EXPECT_EQ(20, webkit_prefs.default_font_size); | 81 EXPECT_EQ(20, webkit_prefs.default_font_size); |
82 EXPECT_FALSE(webkit_prefs.text_areas_are_resizable); | 82 EXPECT_FALSE(webkit_prefs.text_areas_are_resizable); |
83 | 83 |
84 // These should still be the default values. | 84 // These should still be the default values. |
85 #if defined(OS_MACOSX) | 85 #if defined(OS_MACOSX) |
86 const char kDefaultFont[] = "Times"; | 86 const char kDefaultFont[] = "Times"; |
87 #elif defined(OS_CHROMEOS) | 87 #elif defined(OS_CHROMEOS) |
88 const char kDefaultFont[] = "Tinos"; | 88 const char kDefaultFont[] = "Tinos"; |
89 #else | 89 #else |
90 const char kDefaultFont[] = "Times New Roman"; | 90 const char kDefaultFont[] = "Times New Roman"; |
91 #endif | 91 #endif |
92 EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont), | 92 EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont), |
93 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); | 93 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); |
94 EXPECT_TRUE(webkit_prefs.javascript_enabled); | 94 EXPECT_TRUE(webkit_prefs.javascript_enabled); |
95 } | 95 } |
OLD | NEW |