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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 protected: | 52 protected: |
53 void SetUp() override { | 53 void SetUp() override { |
54 ChromeRenderViewHostTestHarness::SetUp(); | 54 ChromeRenderViewHostTestHarness::SetUp(); |
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, new base::Value("utf8")); |
63 new base::StringValue("utf8")); | |
64 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, | 63 pref_services->SetUserPref(prefs::kWebKitDefaultFontSize, |
65 new base::Value(20)); | 64 new base::Value(20)); |
66 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, | 65 pref_services->SetUserPref(prefs::kWebKitTextAreasAreResizable, |
67 new base::Value(false)); | 66 new base::Value(false)); |
68 pref_services->SetUserPref("webkit.webprefs.foo", | 67 pref_services->SetUserPref("webkit.webprefs.foo", new base::Value("bar")); |
69 new base::StringValue("bar")); | |
70 } | 68 } |
71 }; | 69 }; |
72 | 70 |
73 // Tests to see that webkit preferences are properly loaded and copied over | 71 // Tests to see that webkit preferences are properly loaded and copied over |
74 // to a WebPreferences object. | 72 // to a WebPreferences object. |
75 TEST_F(ChromePrefServiceWebKitPrefs, PrefsCopied) { | 73 TEST_F(ChromePrefServiceWebKitPrefs, PrefsCopied) { |
76 WebPreferences webkit_prefs = | 74 WebPreferences webkit_prefs = |
77 RenderViewHostTester::For(rvh())->TestComputeWebkitPrefs(); | 75 RenderViewHostTester::For(rvh())->TestComputeWebkitPrefs(); |
78 | 76 |
79 // These values have been overridden by the profile preferences. | 77 // These values have been overridden by the profile preferences. |
(...skipping 12 matching lines...) Expand all Loading... |
92 const char kDefaultFont[] = "Times"; | 90 const char kDefaultFont[] = "Times"; |
93 #elif defined(OS_CHROMEOS) | 91 #elif defined(OS_CHROMEOS) |
94 const char kDefaultFont[] = "Tinos"; | 92 const char kDefaultFont[] = "Tinos"; |
95 #else | 93 #else |
96 const char kDefaultFont[] = "Times New Roman"; | 94 const char kDefaultFont[] = "Times New Roman"; |
97 #endif | 95 #endif |
98 EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont), | 96 EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont), |
99 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); | 97 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); |
100 EXPECT_TRUE(webkit_prefs.javascript_enabled); | 98 EXPECT_TRUE(webkit_prefs.javascript_enabled); |
101 } | 99 } |
OLD | NEW |