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

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

Issue 10108007: Font Settings Extension API: Rename get/setFontName to get/setFont. (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/static/experimental.fontSettings.html ('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 9
10 function expect(expected, message) { 10 function expect(expected, message) {
11 return chrome.test.callbackPass(function(value) { 11 return chrome.test.callbackPass(function(value) {
12 chrome.test.assertEq(expected, value, message); 12 chrome.test.assertEq(expected, value, message);
13 }); 13 });
14 } 14 }
15 15
16 chrome.test.runTests([ 16 chrome.test.runTests([
17 // This test may fail on Windows if the font is not installed on the 17 // This test may fail on Windows if the font is not installed on the
18 // system. See crbug.com/122303 18 // system. See crbug.com/122303
19 function setPerScriptFontName() { 19 function setPerScriptFont() {
20 var script = 'Hang'; 20 var script = 'Hang';
21 var genericFamily = 'standard'; 21 var genericFamily = 'standard';
22 var fontName = 'Verdana'; 22 var fontName = 'Verdana';
23 23
24 chrome.test.listenOnce(fs.onFontNameChanged, function(details) { 24 chrome.test.listenOnce(fs.onFontChanged, function(details) {
25 chrome.test.assertEq(details, { 25 chrome.test.assertEq(details, {
26 script: script, 26 script: script,
27 genericFamily: genericFamily, 27 genericFamily: genericFamily,
28 fontName: fontName, 28 fontName: fontName,
29 levelOfControl: 'controlled_by_this_extension' 29 levelOfControl: 'controlled_by_this_extension'
30 }); 30 });
31 }); 31 });
32 32
33 fs.setFontName({ 33 fs.setFont({
34 script: script, 34 script: script,
35 genericFamily: genericFamily, 35 genericFamily: genericFamily,
36 fontName: fontName 36 fontName: fontName
37 }, chrome.test.callbackPass()); 37 }, chrome.test.callbackPass());
38 }, 38 },
39 39
40 function getPerScriptFontName() { 40 function getPerScriptFontName() {
41 var expected = 'Verdana'; 41 var expected = 'Verdana';
42 var message = 'Setting for Hangul standard font should be ' + expected; 42 var message = 'Setting for Hangul standard font should be ' + expected;
43 43
44 fs.getFontName({ 44 fs.getFont({
45 script: 'Hang', 45 script: 'Hang',
46 genericFamily: 'standard' 46 genericFamily: 'standard'
47 }, expect({fontName: expected}, message)); 47 }, expect({fontName: expected}, message));
48 }, 48 },
49 49
50 // This test may fail on Windows if the font is not installed on 50 // This test may fail on Windows if the font is not installed on
51 // the system. See crbug.com/122303 51 // the system. See crbug.com/122303
52 function setGlobalFontName() { 52 function setGlobalFontName() {
53 var fontName = 'Tahoma'; 53 var fontName = 'Tahoma';
54 var genericFamily = 'sansserif'; 54 var genericFamily = 'sansserif';
55 55
56 chrome.test.listenOnce(fs.onFontNameChanged, function(details) { 56 chrome.test.listenOnce(fs.onFontChanged, function(details) {
57 chrome.test.assertEq(details, { 57 chrome.test.assertEq(details, {
58 genericFamily: genericFamily, 58 genericFamily: genericFamily,
59 fontName: fontName, 59 fontName: fontName,
60 levelOfControl: 'controlled_by_this_extension' 60 levelOfControl: 'controlled_by_this_extension'
61 }); 61 });
62 }); 62 });
63 63
64 fs.setFontName({ 64 fs.setFont({
65 genericFamily: 'sansserif', 65 genericFamily: 'sansserif',
66 fontName: 'Tahoma' 66 fontName: 'Tahoma'
67 }, chrome.test.callbackPass()); 67 }, chrome.test.callbackPass());
68 }, 68 },
69 69
70 function getGlobalFontName() { 70 function getGlobalFontName() {
71 var expected = 'Tahoma'; 71 var expected = 'Tahoma';
72 var message = 72 var message =
73 'Setting for global sansserif font should be ' + expected; 73 'Setting for global sansserif font should be ' + expected;
74 74
75 fs.getFontName({ 75 fs.getFont({
76 genericFamily: 'sansserif' 76 genericFamily: 'sansserif'
77 }, expect({fontName: expected}, message)); 77 }, expect({fontName: expected}, message));
78 }, 78 },
79 79
80 function getFontList() { 80 function getFontList() {
81 var message = 'getFontList should return an array of objects with ' + 81 var message = 'getFontList should return an array of objects with ' +
82 'fontName and localizedName properties.'; 82 'fontName and localizedName properties.';
83 fs.getFontList(chrome.test.callbackPass(function(value) { 83 fs.getFontList(chrome.test.callbackPass(function(value) {
84 chrome.test.assertTrue(value.length > 0, 84 chrome.test.assertTrue(value.length > 0,
85 "Font list is not expected to be empty."); 85 "Font list is not expected to be empty.");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 var message = 'Setting for default fixed font size should be ' + expected; 123 var message = 'Setting for default fixed font size should be ' + expected;
124 fs.getDefaultFixedFontSize({}, expect({pixelSize: expected}, message)); 124 fs.getDefaultFixedFontSize({}, expect({pixelSize: expected}, message));
125 }, 125 },
126 126
127 function getMinimumFontSize() { 127 function getMinimumFontSize() {
128 var expected = 7; 128 var expected = 7;
129 var message = 'Setting for minimum font size should be ' + expected; 129 var message = 'Setting for minimum font size should be ' + expected;
130 fs.getMinimumFontSize({}, expect({pixelSize: expected}, message)); 130 fs.getMinimumFontSize({}, expect({pixelSize: expected}, message));
131 } 131 }
132 ]); 132 ]);
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/static/experimental.fontSettings.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698