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

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

Issue 10107014: Migrate WebKit "global script" font prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile fixes 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
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) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.onFontChanged, 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 script: 'Zyyy',
60 levelOfControl: 'controlled_by_this_extension' 61 levelOfControl: 'controlled_by_this_extension'
61 }); 62 });
62 }); 63 });
63 64
64 fs.setFont({ 65 fs.setFont({
65 genericFamily: 'sansserif', 66 genericFamily: 'sansserif',
66 fontName: 'Tahoma' 67 fontName: 'Tahoma'
67 }, chrome.test.callbackPass()); 68 }, chrome.test.callbackPass());
68 }, 69 },
69 70
70 function getGlobalFontName() { 71 function getGlobalFontName() {
71 var expected = 'Tahoma'; 72 var expected = 'Tahoma';
72 var message = 73 var message =
73 'Setting for global sansserif font should be ' + expected; 74 'Setting for global sansserif font should be ' + expected;
74 75
75 fs.getFont({ 76 fs.getFont({
76 genericFamily: 'sansserif' 77 genericFamily: 'sansserif'
77 }, expect({fontName: expected}, message)); 78 }, expect({fontName: expected}, message));
78 }, 79 },
79 80
80 function getFontList() { 81 function getFontList() {
81 var message = 'getFontList should return an array of objects with ' + 82 var message = 'getFontList should return an array of objects with ' +
82 'fontName and localizedName properties.'; 83 'fontName and localizedName properties.';
83 fs.getFontList(chrome.test.callbackPass(function(value) { 84 fs.getFontList(chrome.test.callbackPass(function(value) {
84 chrome.test.assertTrue(value.length > 0, 85 chrome.test.assertTrue(value.length > 0,
85 "Font list is not expected to be empty."); 86 'Font list is not expected to be empty.');
86 chrome.test.assertEq('string', typeof(value[0].fontName), message); 87 chrome.test.assertEq('string', typeof(value[0].fontName), message);
87 chrome.test.assertEq('string', typeof(value[0].localizedName), message); 88 chrome.test.assertEq('string', typeof(value[0].localizedName), message);
88 })); 89 }));
89 }, 90 },
90 91
91 function setDefaultFontSize() { 92 function setDefaultFontSize() {
92 fs.setDefaultFontSize({ 93 fs.setDefaultFontSize({
93 pixelSize: 22 94 pixelSize: 22
94 }, chrome.test.callbackPass()); 95 }, chrome.test.callbackPass());
95 }, 96 },
(...skipping 27 matching lines...) Expand all
123 var message = 'Setting for default fixed font size should be ' + expected; 124 var message = 'Setting for default fixed font size should be ' + expected;
124 fs.getDefaultFixedFontSize({}, expect({pixelSize: expected}, message)); 125 fs.getDefaultFixedFontSize({}, expect({pixelSize: expected}, message));
125 }, 126 },
126 127
127 function getMinimumFontSize() { 128 function getMinimumFontSize() {
128 var expected = 7; 129 var expected = 7;
129 var message = 'Setting for minimum font size should be ' + expected; 130 var message = 'Setting for minimum font size should be ' + expected;
130 fs.getMinimumFontSize({}, expect({pixelSize: expected}, message)); 131 fs.getMinimumFontSize({}, expect({pixelSize: expected}, message));
131 } 132 }
132 ]); 133 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698