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

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

Issue 10716003: [Font Settings API]: Rename fontName and localizedName to fontId and displayName (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing Created 8 years, 5 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 for split mode (in incognito context) 5 // Font settings API test for split mode (in incognito context)
6 // Run with browser_tests --gtest_filter=ExtensionApiTest.FontSettingsIncognito 6 // Run with browser_tests --gtest_filter=ExtensionApiTest.FontSettingsIncognito
7 7
8 var fs = chrome.experimental.fontSettings; 8 var fs = chrome.experimental.fontSettings;
9 9
10 var CONTROLLABLE_BY_THIS_EXTENSION = 'controllable_by_this_extension'; 10 var CONTROLLABLE_BY_THIS_EXTENSION = 'controllable_by_this_extension';
11 var SET_FROM_INCOGNITO_ERROR = 11 var SET_FROM_INCOGNITO_ERROR =
12 "Can't modify regular settings from an incognito context."; 12 "Can't modify regular settings from an incognito context.";
13 13
14 function expect(expected, message) { 14 function expect(expected, message) {
15 return chrome.test.callbackPass(function(value) { 15 return chrome.test.callbackPass(function(value) {
16 chrome.test.assertEq(expected, value, message); 16 chrome.test.assertEq(expected, value, message);
17 }); 17 });
18 } 18 }
19 19
20 chrome.test.runTests([ 20 chrome.test.runTests([
21 function setPerScriptFont() { 21 function setPerScriptFont() {
22 var script = 'Hang'; 22 var script = 'Hang';
23 var genericFamily = 'standard'; 23 var genericFamily = 'standard';
24 var fontName = 'Verdana'; 24 var fontId = 'Verdana';
25 25
26 fs.setFont({ 26 fs.setFont({
27 script: script, 27 script: script,
28 genericFamily: genericFamily, 28 genericFamily: genericFamily,
29 fontName: fontName 29 fontId: fontId
30 }, chrome.test.callbackFail(SET_FROM_INCOGNITO_ERROR)); 30 }, chrome.test.callbackFail(SET_FROM_INCOGNITO_ERROR));
31 }, 31 },
32 32
33 function setGlobalFontName() { 33 function setGlobalFontName() {
34 var genericFamily = 'sansserif'; 34 var genericFamily = 'sansserif';
35 var fontName = 'Tahoma'; 35 var fontId = 'Tahoma';
36 36
37 fs.setFont({ 37 fs.setFont({
38 genericFamily: genericFamily, 38 genericFamily: genericFamily,
39 fontName: fontName 39 fontId: fontId
40 }, chrome.test.callbackFail(SET_FROM_INCOGNITO_ERROR)); 40 }, chrome.test.callbackFail(SET_FROM_INCOGNITO_ERROR));
41 }, 41 },
42 42
43 function setDefaultFontSize() { 43 function setDefaultFontSize() {
44 var pixelSize = 22; 44 var pixelSize = 22;
45 45
46 fs.setDefaultFontSize({ 46 fs.setDefaultFontSize({
47 pixelSize: pixelSize 47 pixelSize: pixelSize
48 }, chrome.test.callbackFail(SET_FROM_INCOGNITO_ERROR)); 48 }, chrome.test.callbackFail(SET_FROM_INCOGNITO_ERROR));
49 }, 49 },
50 50
51 function getFontList() { 51 function getFontList() {
52 var message = 'getFontList should return an array of objects with ' + 52 var message = 'getFontList should return an array of objects with ' +
53 'fontName and localizedName properties.'; 53 'fontId and displayName properties.';
54 fs.getFontList(chrome.test.callbackPass(function(value) { 54 fs.getFontList(chrome.test.callbackPass(function(value) {
55 chrome.test.assertTrue(value.length > 0, 55 chrome.test.assertTrue(value.length > 0,
56 "Font list is not expected to be empty."); 56 "Font list is not expected to be empty.");
57 chrome.test.assertEq('string', typeof(value[0].fontName), message); 57 chrome.test.assertEq('string', typeof(value[0].fontId), message);
58 chrome.test.assertEq('string', typeof(value[0].localizedName), message); 58 chrome.test.assertEq('string', typeof(value[0].displayName), message);
59 })); 59 }));
60 }, 60 },
61 61
62 function getPerScriptFontName() { 62 function getPerScriptFontName() {
63 fs.getFont({ 63 fs.getFont({
64 script: 'Hang', 64 script: 'Hang',
65 genericFamily: 'standard' 65 genericFamily: 'standard'
66 }, expect({ 66 }, expect({
67 fontName: 'Tahoma', 67 fontId: 'Tahoma',
68 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION 68 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION
69 })); 69 }));
70 }, 70 },
71 71
72 function getGlobalFontName() { 72 function getGlobalFontName() {
73 fs.getFont({ 73 fs.getFont({
74 genericFamily: 'sansserif' 74 genericFamily: 'sansserif'
75 }, expect({ 75 }, expect({
76 fontName: 'Arial', 76 fontId: 'Arial',
77 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION 77 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION
78 })); 78 }));
79 }, 79 },
80 80
81 function getDefaultFontSize() { 81 function getDefaultFontSize() {
82 fs.getDefaultFontSize({}, expect({ 82 fs.getDefaultFontSize({}, expect({
83 pixelSize: 16, 83 pixelSize: 16,
84 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION 84 levelOfControl: CONTROLLABLE_BY_THIS_EXTENSION
85 })); 85 }));
86 }, 86 },
(...skipping 15 matching lines...) Expand all
102 genericFamily: genericFamily, 102 genericFamily: genericFamily,
103 }, chrome.test.callbackFail(SET_FROM_INCOGNITO_ERROR)); 103 }, chrome.test.callbackFail(SET_FROM_INCOGNITO_ERROR));
104 }, 104 },
105 105
106 function clearDefaultFontSize() { 106 function clearDefaultFontSize() {
107 fs.clearDefaultFontSize({}, 107 fs.clearDefaultFontSize({},
108 chrome.test.callbackFail(SET_FROM_INCOGNITO_ERROR)); 108 chrome.test.callbackFail(SET_FROM_INCOGNITO_ERROR));
109 } 109 }
110 ]); 110 ]);
111 111
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698