OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
4 <script type="text/javascript" src="../../http/tests/inspector-protocol/css-prot
ocol-test.js"></script> | 4 <script type="text/javascript" src="../../http/tests/inspector-protocol/css-prot
ocol-test.js"></script> |
5 <script type="text/javascript" src="../../http/tests/inspector-protocol/dom-prot
ocol-test.js"></script> | 5 <script type="text/javascript" src="../../http/tests/inspector-protocol/dom-prot
ocol-test.js"></script> |
6 <script type="text/javascript"> | 6 <script type="text/javascript"> |
7 | 7 |
8 function test() | 8 function test() |
9 { | 9 { |
10 var documentNodeId; | 10 var documentNodeId; |
(...skipping 10 matching lines...) Expand all Loading... |
21 }, | 21 }, |
22 | 22 |
23 function testSelectElementPlatformFonts(next) | 23 function testSelectElementPlatformFonts(next) |
24 { | 24 { |
25 platformFontsForElementWithSelector("select", next); | 25 platformFontsForElementWithSelector("select", next); |
26 } | 26 } |
27 ]); | 27 ]); |
28 } | 28 } |
29 | 29 |
30 | 30 |
31 async function platformFontsForElementWithSelector(selector, callback) | 31 function platformFontsForElementWithSelector(selector, callback) |
32 { | 32 { |
33 var nodeId = await InspectorTest.requestNodeId(documentNodeId, selector)
; | 33 InspectorTest.requestNodeId(documentNodeId, selector, onNodeId); |
34 await InspectorTest.sendCommandOrDie("CSS.enable", { }); | 34 |
35 var response = await InspectorTest.sendCommandOrDie("CSS.getPlatformFont
sForNode", { nodeId: nodeId }); | 35 function onNodeId(nodeId) |
36 dumpComputedFonts(response); | 36 { |
37 callback(); | 37 InspectorTest.sendCommandOrDie("CSS.getPlatformFontsForNode", { node
Id: nodeId }, onGotComputedFonts); |
| 38 } |
| 39 |
| 40 function onGotComputedFonts(response) |
| 41 { |
| 42 dumpComputedFonts(response); |
| 43 callback(); |
| 44 } |
38 } | 45 } |
39 | 46 |
40 function dumpComputedFonts(response) | 47 function dumpComputedFonts(response) |
41 { | 48 { |
42 var fonts = response.fonts; | 49 var fonts = response.fonts; |
43 fonts.sort(function(a, b) { | 50 fonts.sort(function(a, b) { |
44 return b.glyphCount - a.glyphCount; | 51 return b.glyphCount - a.glyphCount; |
45 }); | 52 }); |
46 for (var i = 0; i < fonts.length; ++i) | 53 for (var i = 0; i < fonts.length; ++i) |
47 fonts[i].familyName = "<Some-family-name-" + i + ">"; | 54 fonts[i].familyName = "<Some-family-name-" + i + ">"; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 7chars.<br> | 97 7chars.<br> |
91 Some line with 29 characters. | 98 Some line with 29 characters. |
92 </div> | 99 </div> |
93 <select> | 100 <select> |
94 <option>Short</option> | 101 <option>Short</option> |
95 <option selected>Option with a lot of chars.</option> | 102 <option selected>Option with a lot of chars.</option> |
96 </select> | 103 </select> |
97 | 104 |
98 </body> | 105 </body> |
99 </html> | 106 </html> |
OLD | NEW |