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

Unified Diff: LayoutTests/inspector-protocol/css/css-get-platform-fonts.html

Issue 1187073016: DevTools: generalize getPlatformFonts code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: do not dump cssFamilyFontName Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/css/css-get-platform-fonts-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/css/css-get-platform-fonts-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698