blob: fee231d0212d88b99449ca93896bcbd6406f2930 [file] [log] [blame]
<!doctype html>
<html>
<body>
<div>font loading revalidation test</div>
<script>
// Try to cover the case FontResource is reused even after
// frame.location.reload(). So that memory cache performs revalidation,
// The URL should not have a query like .cgi?delay=100, and HTTP response
// should have at least either Last-modified or Etag header.
var font = new FontFace('Foo', 'url(../cachable-slow-ahem-loading.cgi)', {});
var startTime = performance.now();
font.load();
font.loaded.then(() => {
var loadTime = performance.now() - startTime;
parent.postMessage('pass:font.load()', '*');
var testName = 'loadTime > 900';
var testResult = loadTime > 900 ? 'pass' : 'fail';
parent.postMessage([testResult, testName].join(':'), '*');
parent.postMessage('reload', '*');
}, () => {
parent.postMessage('fail:font.load()', '*');
});
</script>
</body>
</html>