blob: a7f2fecb5a68cc4f9cca1aba0884b5f7e0955944 [file] [log] [blame]
<!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.setResourceLoadStatisticsEnabled(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() {
testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
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(function() {
testRunner.statisticsNotifyObserver();
}, 0);
}
if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
testRunner.dumpAsText();
testRunner.dumpResourceLoadStatistics();
testRunner.waitUntilDone();
internals.setResourceLoadStatisticsEnabled(true);
runTestRunnerTest();
}
</script>
</body>
</html>