| <!DOCTYPE html><!-- webkit-test-runner [ WebAPIStatisticsEnabled=true ] --> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Test for font loading data collection in resource load statistics</title> | |
| </head> | |
| <script> | |
| internals.setTrackingPreventionEnabled(false); | |
| </script> | |
| <body> | |
| <p> Tests for font loading data collection in ResourceLoadStatistics plist by loading fonts and dumping the entire resource load statistics map. The test tries to load various fonts through a comma separated font-family list to draw a string with many m's since they differ in width more prominently among fonts. </p> | |
| <script> | |
| const hostUnderTest = "127.0.0.1:8000"; | |
| const statisticsUrl = "http://" + hostUnderTest + "/temp"; | |
| function completeTest() { | |
| testRunner.statisticsResetToConsistentState(function() { | |
| testRunner.notifyDone(); | |
| }); | |
| } | |
| function runTestRunnerTest() { | |
| var body = document.getElementsByTagName('body')[0] | |
| var span = document.createElement('span'); | |
| var testFontString = 'mmmmmmmmmmlli'; | |
| span.innerHTML = testFontString; | |
| span.style.fontFamily = 'Andale, Fransiscan, notARealFont, serif'; | |
| body.appendChild(span); | |
| // Adds a timeout to allow font loads to be recorded. | |
| setTimeout(async function() { | |
| await testRunner.statisticsNotifyObserver(); | |
| completeTest(); | |
| }, 0); | |
| } | |
| if (document.location.host === hostUnderTest && window.testRunner && window.internals) { | |
| testRunner.dumpAsText(); | |
| testRunner.dumpResourceLoadStatistics(); | |
| testRunner.waitUntilDone(); | |
| internals.setTrackingPreventionEnabled(true); | |
| runTestRunnerTest(); | |
| } | |
| </script> | |
| </body> | |
| </html> |