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

Side by Side Diff: chrome/test/data/extensions/api_test/font_settings/test.js

Issue 10177003: Font Settings Extension API: Add functions to clear prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/common/extensions/docs/samples.json ('k') | no next file » | 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 // Font settings API test 5 // Font settings API test
6 // Run with browser_tests --gtest_filter=ExtensionApiTest.FontSettings 6 // Run with browser_tests --gtest_filter=ExtensionApiTest.FontSettings
7 7
8 var fs = chrome.experimental.fontSettings; 8 var fs = chrome.experimental.fontSettings;
9 var CONTROLLABLE_BY_THIS_EXTENSION = 'controllable_by_this_extension';
9 10
10 function expect(expected, message) { 11 function expect(expected, message) {
11 return chrome.test.callbackPass(function(value) { 12 return chrome.test.callbackPass(function(value) {
12 chrome.test.assertEq(expected, value, message); 13 chrome.test.assertEq(expected, value, message);
13 }); 14 });
14 } 15 }
15 16
16 chrome.test.runTests([ 17 chrome.test.runTests([
17 // This test may fail on Windows if the font is not installed on the 18 // This test may fail on Windows if the font is not installed on the
18 // system. See crbug.com/122303 19 // system. See crbug.com/122303
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 var expected = 7; 167 var expected = 7;
167 var message = 'Setting for minimum font size should be ' + expected; 168 var message = 'Setting for minimum font size should be ' + expected;
168 fs.getMinimumFontSize({}, expect({pixelSize: expected}, message)); 169 fs.getMinimumFontSize({}, expect({pixelSize: expected}, message));
169 }, 170 },
170 171
171 function getDefaultCharacterSet() { 172 function getDefaultCharacterSet() {
172 var expected = 'GBK'; 173 var expected = 'GBK';
173 var message = 'Setting for default character set should be ' + expected; 174 var message = 'Setting for default character set should be ' + expected;
174 fs.getDefaultCharacterSet(expect({charset: expected}, message)); 175 fs.getDefaultCharacterSet(expect({charset: expected}, message));
175 }, 176 },
177
178 // This test may fail on Windows if the font is not installed on the
179 // system. See crbug.com/122303
180 function clearPerScriptFont() {
181 var script = 'Hang';
182 var genericFamily = 'standard';
183 var fontName = 'Tahoma';
184
185 chrome.test.listenOnce(fs.onFontChanged, function(details) {
186 chrome.test.assertEq(details, {
187 script: script,
188 genericFamily: genericFamily,
189 fontName: fontName,
190 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION
191 });
192 });
193
194 fs.clearFont({
195 script: script,
196 genericFamily: genericFamily,
197 }, chrome.test.callbackPass());
198 },
199
200 // This test may fail on Windows if the font is not installed on the
201 // system. See crbug.com/122303
202 function clearGlobalFont() {
203 var genericFamily = 'sansserif';
204 var fontName = 'Arial';
205
206 chrome.test.listenOnce(fs.onFontChanged, function(details) {
207 chrome.test.assertEq(details, {
208 genericFamily: genericFamily,
209 fontName: fontName,
210 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION
211 });
212 });
213
214 fs.clearFont({
215 genericFamily: genericFamily,
216 }, chrome.test.callbackPass());
217 },
218
219 function clearDefaultFontSize() {
220 var pixelSize = 16;
221 chrome.test.listenOnce(fs.onDefaultFontSizeChanged, function(details) {
222 chrome.test.assertEq(details, {
223 pixelSize: pixelSize,
224 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION
225 });
226 });
227
228 fs.clearDefaultFontSize({}, chrome.test.callbackPass());
229 },
230
231 function clearDefaultFixedFontSize() {
232 var pixelSize = 14;
233 chrome.test.listenOnce(fs.onDefaultFixedFontSizeChanged, function(details) {
234 chrome.test.assertEq(details, {
235 pixelSize: pixelSize,
236 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION
237 });
238 });
239
240 fs.clearDefaultFixedFontSize({}, chrome.test.callbackPass());
241 },
242
243 function clearMinimumFontSize() {
244 var pixelSize = 8;
245 chrome.test.listenOnce(fs.onMinimumFontSizeChanged, function(details) {
246 chrome.test.assertEq(details, {
247 pixelSize: pixelSize,
248 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION
249 });
250 });
251
252 fs.clearMinimumFontSize({}, chrome.test.callbackPass());
253 },
254
255 function clearDefaultCharacterSet() {
256 var charset = 'Shift_JIS';
257 chrome.test.listenOnce(fs.onDefaultCharacterSetChanged, function(details) {
258 chrome.test.assertEq(details, {
259 charset: charset,
260 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION
261 });
262 });
263
264 fs.clearDefaultCharacterSet({}, chrome.test.callbackPass());
265 },
176 ]); 266 ]);
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/samples.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698