| Index: LayoutTests/inspector-protocol/css/css-get-platform-fonts.html
|
| diff --git a/LayoutTests/inspector-protocol/css/css-get-platform-fonts.html b/LayoutTests/inspector-protocol/css/css-get-platform-fonts.html
|
| index 9b9c98ef2bfea0d98e2be9a15b3ecf60f43288c0..b0f49acdd28304c7fa70762511ef217f1d0d0360 100644
|
| --- a/LayoutTests/inspector-protocol/css/css-get-platform-fonts.html
|
| +++ b/LayoutTests/inspector-protocol/css/css-get-platform-fonts.html
|
| @@ -1,39 +1,51 @@
|
| <html>
|
| <head>
|
| <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
|
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/css-protocol-test.js"></script>
|
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/dom-protocol-test.js"></script>
|
| <script type="text/javascript">
|
|
|
| function test()
|
| {
|
| - function sendCommand(command, properties, callback) {
|
| - InspectorTest.sendCommand(command, properties || {}, commandCallback);
|
| - function commandCallback(msg)
|
| - {
|
| - if (msg.error) {
|
| - InspectorTest.log(msg.error.message);
|
| - InspectorTest.completeTest();
|
| - return;
|
| - }
|
| - callback(msg.result);
|
| - }
|
| - }
|
| - sendCommand("DOM.getDocument", {}, onGotDocument);
|
| + var documentNodeId;
|
|
|
| - function onGotDocument(result)
|
| + InspectorTest.requestDocumentNodeId(onDocumentNodeId);
|
| +
|
| + function onDocumentNodeId(nodeId)
|
| {
|
| - var root = result.root;
|
| - sendCommand("DOM.querySelector", { "nodeId": root.nodeId , "selector": "#fancy" }, onGotNode);
|
| + documentNodeId = nodeId;
|
| + InspectorTest.runTestSuite([
|
| + function testFirstLetterPseudoClass(next)
|
| + {
|
| + platformFontsForElementWithSelector("#fancy", next);
|
| + },
|
| +
|
| + function testSelectElementPlatformFonts(next)
|
| + {
|
| + platformFontsForElementWithSelector("select", next);
|
| + }
|
| + ]);
|
| }
|
|
|
| - function onGotNode(node)
|
| +
|
| + function platformFontsForElementWithSelector(selector, callback)
|
| {
|
| - sendCommand("CSS.getPlatformFontsForNode", { "nodeId": node.nodeId }, onGotComputedFonts);
|
| + InspectorTest.requestNodeId(documentNodeId, selector, onNodeId);
|
| +
|
| + function onNodeId(nodeId)
|
| + {
|
| + InspectorTest.sendCommandOrDie("CSS.getPlatformFontsForNode", { nodeId: nodeId }, onGotComputedFonts);
|
| + }
|
| +
|
| + function onGotComputedFonts(response)
|
| + {
|
| + dumpComputedFonts(response);
|
| + callback();
|
| + }
|
| }
|
|
|
| - function onGotComputedFonts(response)
|
| + function dumpComputedFonts(response)
|
| {
|
| - var cssFamilyName = response.cssFamilyName;
|
| - InspectorTest.log("cssFamilyName: " + cssFamilyName);
|
| var fonts = response.fonts;
|
| fonts.sort(function(a, b) {
|
| return b.glyphCount - a.glyphCount;
|
| @@ -41,7 +53,6 @@ function test()
|
| for (var i = 0; i < fonts.length; ++i)
|
| fonts[i].familyName = "<Some-family-name-" + i + ">";
|
| InspectorTest.log(JSON.stringify(fonts));
|
| - InspectorTest.completeTest();
|
| }
|
| };
|
|
|
| @@ -70,10 +81,13 @@ window.addEventListener("DOMContentLoaded", function () {
|
| <body>
|
|
|
| <div id="fancy">
|
| -First line.
|
| -<br>
|
| -Second line.
|
| +7chars.<br>
|
| +Some line with 29 characters.
|
| </div>
|
| +<select>
|
| + <option>Short</option>
|
| + <option selected>Option with a lot of chars.</option>
|
| +</select>
|
|
|
| </body>
|
| </html>
|
|
|