1 <!DOCTYPE html><!-- webkit-test-runner [ internal:WebAPIStatisticsEnabled=true ] -->
4 <title>Test for font loading data collection in resource load statistics</title>
7 internals.setResourceLoadStatisticsEnabled(false);
10 <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>
12 const hostUnderTest = "127.0.0.1:8000";
13 const statisticsUrl = "http://" + hostUnderTest + "/temp";
15 function completeTest() {
16 testRunner.statisticsResetToConsistentState(function() {
17 testRunner.notifyDone();
21 function runTestRunnerTest() {
22 testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
24 testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
26 var body = document.getElementsByTagName('body')[0]
28 var span = document.createElement('span');
29 var testFontString = 'mmmmmmmmmmlli';
31 span.innerHTML = testFontString;
32 span.style.fontFamily = 'Andale, Fransiscan, notARealFont, serif';
33 body.appendChild(span);
34 // Adds a timeout to allow font loads to be recorded.
35 setTimeout(function() {
36 testRunner.statisticsNotifyObserver();
40 if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
41 testRunner.dumpAsText();
42 testRunner.dumpResourceLoadStatistics();
43 testRunner.waitUntilDone();
44 internals.setResourceLoadStatisticsEnabled(true);
45 testRunner.setWebAPIStatisticsEnabled(true);