Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc

Issue 12330008: Get rid of the ability to unregister preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/prefs/prefs_tab_helper.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/common/chrome_constants.h" 10 #include "chrome/common/chrome_constants.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // This migration moves the formerly "non-per-script" font prefs into the 62 // This migration moves the formerly "non-per-script" font prefs into the
63 // per-script font maps, as the entry for "Common" script (Zyyy is the ISO 15924 63 // per-script font maps, as the entry for "Common" script (Zyyy is the ISO 15924
64 // script code for the Common script). 64 // script code for the Common script).
65 // 65 //
66 // In addition, it tests that the former migration of 66 // In addition, it tests that the former migration of
67 // webkit.webprefs.blahblah -> webkit.webprefs.global.blahblah 67 // webkit.webprefs.blahblah -> webkit.webprefs.global.blahblah
68 // no longer occurs. 68 // no longer occurs.
69 IN_PROC_BROWSER_TEST_F(PrefsTabHelperBrowserTest, PrefsAreMigratedToFontMap) { 69 IN_PROC_BROWSER_TEST_F(PrefsTabHelperBrowserTest, PrefsAreMigratedToFontMap) {
70 PrefService* prefs = browser()->profile()->GetPrefs(); 70 PrefService* prefs = browser()->profile()->GetPrefs();
71 71
72 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kGlobalDefaultCharset)); 72 EXPECT_TRUE(prefs->FindPreference(
73 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalDefaultFontSize)); 73 prefs::kGlobalDefaultCharset)->IsDefaultValue());
74 EXPECT_EQ(NULL, 74 EXPECT_TRUE(prefs->FindPreference(
75 prefs->FindPreference(prefs::kWebKitGlobalDefaultFixedFontSize)); 75 prefs::kWebKitGlobalDefaultFontSize)->IsDefaultValue());
76 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalMinimumFontSize)); 76 EXPECT_TRUE(prefs->FindPreference(
77 EXPECT_EQ(NULL, 77 prefs::kWebKitGlobalDefaultFixedFontSize)->IsDefaultValue());
78 prefs->FindPreference(prefs::kWebKitGlobalMinimumLogicalFontSize)); 78 EXPECT_TRUE(prefs->FindPreference(
79 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldCursiveFontFamily)); 79 prefs::kWebKitGlobalMinimumFontSize)->IsDefaultValue());
80 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldFantasyFontFamily)); 80 EXPECT_TRUE(prefs->FindPreference(
81 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldFixedFontFamily)); 81 prefs::kWebKitGlobalMinimumLogicalFontSize)->IsDefaultValue());
82 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldSansSerifFontFamily)); 82 EXPECT_TRUE(prefs->FindPreference(
83 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldSerifFontFamily)); 83 prefs::kWebKitOldCursiveFontFamily)->IsDefaultValue());
84 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitOldStandardFontFamily)); 84 EXPECT_TRUE(prefs->FindPreference(
85 prefs::kWebKitOldFantasyFontFamily)->IsDefaultValue());
86 EXPECT_TRUE(prefs->FindPreference(
87 prefs::kWebKitOldFixedFontFamily)->IsDefaultValue());
88 EXPECT_TRUE(prefs->FindPreference(
89 prefs::kWebKitOldSansSerifFontFamily)->IsDefaultValue());
90 EXPECT_TRUE(prefs->FindPreference(
91 prefs::kWebKitOldSerifFontFamily)->IsDefaultValue());
92 EXPECT_TRUE(prefs->FindPreference(
93 prefs::kWebKitOldStandardFontFamily)->IsDefaultValue());
85 94
86 EXPECT_EQ("ISO-8859-1", prefs->GetString(prefs::kDefaultCharset)); 95 EXPECT_EQ("ISO-8859-1", prefs->GetString(prefs::kDefaultCharset));
87 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitDefaultFontSize)); 96 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitDefaultFontSize));
88 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize)); 97 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize));
89 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitMinimumFontSize)); 98 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitMinimumFontSize));
90 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize)); 99 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize));
91 EXPECT_EQ("CursiveFontFamily", 100 EXPECT_EQ("CursiveFontFamily",
92 prefs->GetString(prefs::kWebKitCursiveFontFamily)); 101 prefs->GetString(prefs::kWebKitCursiveFontFamily));
93 EXPECT_EQ("FantasyFontFamily", 102 EXPECT_EQ("FantasyFontFamily",
94 prefs->GetString(prefs::kWebKitFantasyFontFamily)); 103 prefs->GetString(prefs::kWebKitFantasyFontFamily));
(...skipping 29 matching lines...) Expand all
124 // pref mechanism, which has since been removed). 133 // pref mechanism, which has since been removed).
125 // 134 //
126 // In addition it tests the migration for font families: 135 // In addition it tests the migration for font families:
127 // webkit.webprefs.global.standard_font_family -> 136 // webkit.webprefs.global.standard_font_family ->
128 // webkit.webprefs.fonts.standard.Zyyy 137 // webkit.webprefs.fonts.standard.Zyyy
129 // This moves the formerly "non-per-script" font prefs into the per-script font 138 // This moves the formerly "non-per-script" font prefs into the per-script font
130 // maps, as described in the comment for PrefsAreMigratedToFontMap. 139 // maps, as described in the comment for PrefsAreMigratedToFontMap.
131 IN_PROC_BROWSER_TEST_F(PrefsTabHelperBrowserTest2, GlobalPrefsAreMigrated) { 140 IN_PROC_BROWSER_TEST_F(PrefsTabHelperBrowserTest2, GlobalPrefsAreMigrated) {
132 PrefService* prefs = browser()->profile()->GetPrefs(); 141 PrefService* prefs = browser()->profile()->GetPrefs();
133 142
134 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kGlobalDefaultCharset)); 143 EXPECT_TRUE(prefs->FindPreference(
135 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalDefaultFontSize)); 144 prefs::kGlobalDefaultCharset)->IsDefaultValue());
136 EXPECT_EQ(NULL, 145 EXPECT_TRUE(prefs->FindPreference(
137 prefs->FindPreference(prefs::kWebKitGlobalDefaultFixedFontSize)); 146 prefs::kWebKitGlobalDefaultFontSize)->IsDefaultValue());
138 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalMinimumFontSize)); 147 EXPECT_TRUE(prefs->FindPreference(
139 EXPECT_EQ(NULL, 148 prefs::kWebKitGlobalDefaultFixedFontSize)->IsDefaultValue());
140 prefs->FindPreference(prefs::kWebKitGlobalMinimumLogicalFontSize)); 149 EXPECT_TRUE(prefs->FindPreference(
141 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalCursiveFontFamily)); 150 prefs::kWebKitGlobalMinimumFontSize)->IsDefaultValue());
142 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalFantasyFontFamily)); 151 EXPECT_TRUE(prefs->FindPreference(
143 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalFixedFontFamily)); 152 prefs::kWebKitGlobalMinimumLogicalFontSize)->IsDefaultValue());
144 EXPECT_EQ(NULL, 153 EXPECT_TRUE(prefs->FindPreference(
145 prefs->FindPreference(prefs::kWebKitGlobalSansSerifFontFamily)); 154 prefs::kWebKitGlobalCursiveFontFamily)->IsDefaultValue());
146 EXPECT_EQ(NULL, prefs->FindPreference(prefs::kWebKitGlobalSerifFontFamily)); 155 EXPECT_TRUE(prefs->FindPreference(
147 EXPECT_EQ(NULL, 156 prefs::kWebKitGlobalFantasyFontFamily)->IsDefaultValue());
148 prefs->FindPreference(prefs::kWebKitGlobalStandardFontFamily)); 157 EXPECT_TRUE(prefs->FindPreference(
158 prefs::kWebKitGlobalFixedFontFamily)->IsDefaultValue());
159 EXPECT_TRUE(prefs->FindPreference(
160 prefs::kWebKitGlobalSansSerifFontFamily)->IsDefaultValue());
161 EXPECT_TRUE(prefs->FindPreference(
162 prefs::kWebKitGlobalSerifFontFamily)->IsDefaultValue());
163 EXPECT_TRUE(prefs->FindPreference(
164 prefs::kWebKitGlobalStandardFontFamily)->IsDefaultValue());
149 165
150 EXPECT_EQ("ISO-8859-1", prefs->GetString(prefs::kDefaultCharset)); 166 EXPECT_EQ("ISO-8859-1", prefs->GetString(prefs::kDefaultCharset));
151 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitDefaultFontSize)); 167 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitDefaultFontSize));
152 EXPECT_EQ(42, 168 EXPECT_EQ(42,
153 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize)); 169 prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize));
154 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitMinimumFontSize)); 170 EXPECT_EQ(42, prefs->GetInteger(prefs::kWebKitMinimumFontSize));
155 EXPECT_EQ(42, 171 EXPECT_EQ(42,
156 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize)); 172 prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize));
157 EXPECT_EQ("CursiveFontFamily", 173 EXPECT_EQ("CursiveFontFamily",
158 prefs->GetString(prefs::kWebKitCursiveFontFamily)); 174 prefs->GetString(prefs::kWebKitCursiveFontFamily));
159 EXPECT_EQ("FantasyFontFamily", 175 EXPECT_EQ("FantasyFontFamily",
160 prefs->GetString(prefs::kWebKitFantasyFontFamily)); 176 prefs->GetString(prefs::kWebKitFantasyFontFamily));
161 // PictographFontFamily was added after the migration, so it never exists 177 // PictographFontFamily was added after the migration, so it never exists
162 // in the old format (and consequently isn't in the test Preferences file). 178 // in the old format (and consequently isn't in the test Preferences file).
163 // So it doesn't need to be tested here. 179 // So it doesn't need to be tested here.
164 EXPECT_EQ("FixedFontFamily", 180 EXPECT_EQ("FixedFontFamily",
165 prefs->GetString(prefs::kWebKitFixedFontFamily)); 181 prefs->GetString(prefs::kWebKitFixedFontFamily));
166 EXPECT_EQ("SansSerifFontFamily", 182 EXPECT_EQ("SansSerifFontFamily",
167 prefs->GetString(prefs::kWebKitSansSerifFontFamily)); 183 prefs->GetString(prefs::kWebKitSansSerifFontFamily));
168 EXPECT_EQ("SerifFontFamily", 184 EXPECT_EQ("SerifFontFamily",
169 prefs->GetString(prefs::kWebKitSerifFontFamily)); 185 prefs->GetString(prefs::kWebKitSerifFontFamily));
170 EXPECT_EQ("StandardFontFamily", 186 EXPECT_EQ("StandardFontFamily",
171 prefs->GetString(prefs::kWebKitStandardFontFamily)); 187 prefs->GetString(prefs::kWebKitStandardFontFamily));
172 }; 188 };
OLDNEW
« no previous file with comments | « chrome/browser/ui/prefs/prefs_tab_helper.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698