| OLD | NEW | 
|---|
| 1 function test() | 1 function test() | 
| 2 { | 2 { | 
| 3     var documentNodeId; | 3     var documentNodeId; | 
| 4     var documentNodeSelector; | 4     var documentNodeSelector; | 
| 5     var testSelectors = []; | 5     var testSelectors = []; | 
| 6     var collectedFontUsage = {}; | 6     var collectedFontUsage = {}; | 
| 7 | 7 | 
| 8     InspectorTest.requestDocumentNodeId(onDocumentNodeId); | 8     InspectorTest.requestDocumentNodeId(onDocumentNodeId); | 
| 9 | 9 | 
| 10     function onDocumentNodeId(nodeId) | 10     function onDocumentNodeId(nodeId) | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 50         // the content_shell text dump is easier to validate. | 50         // the content_shell text dump is easier to validate. | 
| 51         InspectorTest.evaluateInInspectedPage("injectCollectedResultsInPage(" + | 51         InspectorTest.evaluateInInspectedPage("injectCollectedResultsInPage(" + | 
| 52                                               JSON.stringify(collectedFontUsage)
      + | 52                                               JSON.stringify(collectedFontUsage)
      + | 
| 53                                               ")"); | 53                                               ")"); | 
| 54         InspectorTest.evaluateInInspectedPage("postTestHookWithFontResults(" + | 54         InspectorTest.evaluateInInspectedPage("postTestHookWithFontResults(" + | 
| 55                                               JSON.stringify(collectedFontUsage)
      + | 55                                               JSON.stringify(collectedFontUsage)
      + | 
| 56                                               ")"); | 56                                               ")"); | 
| 57 | 57 | 
| 58     } | 58     } | 
| 59 | 59 | 
| 60     async function platformFontsForElementWithSelector(selector) | 60     function platformFontsForElementWithSelector(selector) | 
| 61     { | 61     { | 
| 62         var nodeId = await InspectorTest.requestNodeId(documentNodeId, selector)
     ; | 62         InspectorTest.requestNodeId(documentNodeId, selector, onNodeId); | 
| 63         await InspectorTest.sendCommandOrDie("CSS.enable", {}); | 63 | 
| 64         var response = await InspectorTest.sendCommandOrDie("CSS.getPlatformFont
     sForNode", { nodeId: nodeId }); | 64         function onNodeId(nodeId) | 
| 65         collectResults(response); | 65         { | 
| 66         testNextPageElement(); | 66             InspectorTest.sendCommandOrDie("CSS.getPlatformFontsForNode", { node
     Id: nodeId }, onGotComputedFonts); | 
|  | 67         } | 
|  | 68 | 
|  | 69         function onGotComputedFonts(response) | 
|  | 70         { | 
|  | 71             collectResults(response); | 
|  | 72             testNextPageElement(); | 
|  | 73         } | 
| 67     } | 74     } | 
| 68 | 75 | 
| 69     function collectResults(response) | 76     function collectResults(response) | 
| 70     { | 77     { | 
| 71         var usedFonts = response.fonts; | 78         var usedFonts = response.fonts; | 
| 72         usedFonts.sort(function(a, b) { | 79         usedFonts.sort(function(a, b) { | 
| 73             return b.glyphCount - a.glyphCount; | 80             return b.glyphCount - a.glyphCount; | 
| 74         }); | 81         }); | 
| 75         collectedFontUsage[documentNodeSelector] = usedFonts; | 82         collectedFontUsage[documentNodeSelector] = usedFonts; | 
| 76     } | 83     } | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 102         var resultTextNode = document.createTextNode(resultText); | 109         var resultTextNode = document.createTextNode(resultText); | 
| 103         resultTextPre.appendChild(resultTextNode); | 110         resultTextPre.appendChild(resultTextNode); | 
| 104         resultElement.appendChild(resultTextPre); | 111         resultElement.appendChild(resultTextPre); | 
| 105         testNode.parentNode.insertBefore(resultElement, testNode.nextSibling); | 112         testNode.parentNode.insertBefore(resultElement, testNode.nextSibling); | 
| 106     } | 113     } | 
| 107 } | 114 } | 
| 108 | 115 | 
| 109 window.addEventListener("DOMContentLoaded", function () { | 116 window.addEventListener("DOMContentLoaded", function () { | 
| 110     runTest(); | 117     runTest(); | 
| 111 }, false); | 118 }, false); | 
| OLD | NEW | 
|---|