OLD | NEW |
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 27 matching lines...) Expand all Loading... |
38 }, chrome.test.callbackPass()); | 38 }, chrome.test.callbackPass()); |
39 }, | 39 }, |
40 | 40 |
41 function getGlobalFontName() { | 41 function getGlobalFontName() { |
42 var expected = 'Arial'; | 42 var expected = 'Arial'; |
43 var message = | 43 var message = |
44 'Setting for global sansserif font should be ' + expected; | 44 'Setting for global sansserif font should be ' + expected; |
45 fs.getFontName({ | 45 fs.getFontName({ |
46 genericFamily: 'sansserif' | 46 genericFamily: 'sansserif' |
47 }, expect({fontName: expected}, message)); | 47 }, expect({fontName: expected}, message)); |
| 48 }, |
| 49 |
| 50 function getFontList() { |
| 51 var message = 'getFontList should return an array of objects with ' + |
| 52 'fontName and localizedName properties.'; |
| 53 fs.getFontList(chrome.test.callbackPass(function(value) { |
| 54 chrome.test.assertTrue(value.length > 0, |
| 55 "Font list is not expected to be empty."); |
| 56 chrome.test.assertEq('string', typeof(value[0].fontName), message); |
| 57 chrome.test.assertEq('string', typeof(value[0].localizedName), message); |
| 58 })); |
48 } | 59 } |
49 ]); | 60 ]); |
OLD | NEW |