Commit 0f843737 authored by ksakamoto's avatar ksakamoto Committed by Commit Bot

Convert CSS font-display test to wpt

BUG=724932

Review-Url: https://codereview.chromium.org/2895123002
Cr-Commit-Position: refs/heads/master@{#475843}
parent b9f51ee9
...@@ -2705,7 +2705,7 @@ Bug(none) http/tests/w3c/webperf/submission/Google/resource-timing/html/test_res ...@@ -2705,7 +2705,7 @@ Bug(none) http/tests/w3c/webperf/submission/Google/resource-timing/html/test_res
Bug(none) http/tests/webaudio/autoplay-crossorigin.html [ Timeout ] Bug(none) http/tests/webaudio/autoplay-crossorigin.html [ Timeout ]
Bug(none) http/tests/webfont/crbug-655076.html [ Timeout ] Bug(none) http/tests/webfont/crbug-655076.html [ Timeout ]
Bug(none) http/tests/webfont/font-display-intervention.html [ Timeout ] Bug(none) http/tests/webfont/font-display-intervention.html [ Timeout ]
Bug(none) http/tests/webfont/font-display.html [ Timeout ] Bug(none) external/wpt/css-font-display/font-display.html [ Timeout ]
Bug(none) http/tests/webfont/same-origin-credentials.html [ Failure ] Bug(none) http/tests/webfont/same-origin-credentials.html [ Failure ]
Bug(none) http/tests/webfont/slow-loading.html [ Timeout ] Bug(none) http/tests/webfont/slow-loading.html [ Timeout ]
Bug(none) http/tests/websocket/bufferedAmount-after-send.html [ Failure ] Bug(none) http/tests/websocket/bufferedAmount-after-send.html [ Failure ]
......
...@@ -1892,9 +1892,8 @@ crbug.com/546215 [ Android ] fast/inline-block/overflow-clip.html [ Failure ] ...@@ -1892,9 +1892,8 @@ crbug.com/546215 [ Android ] fast/inline-block/overflow-clip.html [ Failure ]
crbug.com/548765 http/tests/inspector/console-fetch-logging.html [ Failure Pass ] crbug.com/548765 http/tests/inspector/console-fetch-logging.html [ Failure Pass ]
crbug.com/548765 virtual/mojo-loading/http/tests/inspector/console-fetch-logging.html [ Failure Pass ] crbug.com/548765 virtual/mojo-loading/http/tests/inspector/console-fetch-logging.html [ Failure Pass ]
crbug.com/564109 [ Win7 ] http/tests/webfont/font-display.html [ Pass Failure ] crbug.com/564109 [ Win7 ] external/wpt/css-font-display/font-display.html [ Pass Failure ]
crbug.com/564109 [ Win7 ] http/tests/webfont/font-display-intervention.html [ Pass Failure ] crbug.com/564109 [ Win7 ] http/tests/webfont/font-display-intervention.html [ Pass Failure ]
crbug.com/564109 [ Win7 ] virtual/mojo-loading/http/tests/webfont/font-display.html [ Pass Failure ]
crbug.com/564109 [ Win7 ] virtual/mojo-loading/http/tests/webfont/font-display-intervention.html [ Pass Failure ] crbug.com/564109 [ Win7 ] virtual/mojo-loading/http/tests/webfont/font-display-intervention.html [ Pass Failure ]
crbug.com/399951 http/tests/mime/javascript-mimetype-usecounters.html [ Pass Failure ] crbug.com/399951 http/tests/mime/javascript-mimetype-usecounters.html [ Pass Failure ]
......
<!DOCTYPE html> <!DOCTYPE html>
<title>Test for font-display @font-face descriptor</title> <title>Test for font-display @font-face descriptor</title>
<script src="/js-test-resources/ahem.js"></script>
<style> <style>
.ahem { .ahem {
font-family: Ahem; font-family: Ahem;
......
<!DOCTYPE html> <!DOCTYPE html>
<html class="reftest-wait">
<title>Test for font-display @font-face descriptor</title> <title>Test for font-display @font-face descriptor</title>
<link rel="match" href="font-display-ref.html">
<style> <style>
.hidden { display: none; } .hidden { display: none; }
</style> </style>
...@@ -16,9 +18,6 @@ ...@@ -16,9 +18,6 @@
</tr> </tr>
</table> </table>
<script> <script>
if (window.testRunner)
testRunner.waitUntilDone();
var fontDisplayValues = ['auto', 'block', 'swap', 'fallback', 'optional']; var fontDisplayValues = ['auto', 'block', 'swap', 'fallback', 'optional'];
var configs = [{time: 0, delay: 1000}, var configs = [{time: 0, delay: 1000},
{time: 1000, delay: 0}, {time: 1000, delay: 0},
...@@ -29,9 +28,7 @@ var configs = [{time: 0, delay: 1000}, ...@@ -29,9 +28,7 @@ var configs = [{time: 0, delay: 1000},
{time: 5000, delay: 8000}]; {time: 5000, delay: 8000}];
function makeFontFaceDeclaration(family, config, display) { function makeFontFaceDeclaration(family, config, display) {
var url = '/resources/Ahem.ttf'; url = 'resources/slow-ahem-loading.py?ms=' + config.delay;
if (config.delay > 0)
url = 'slow-ahem-loading.cgi?delay=' + config.delay + '&t=' + config.time;
return '@font-face { font-family: ' + family + '; src: url(' + url + '); font-display: ' + display + '; }'; return '@font-face { font-family: ' + family + '; src: url(' + url + '); font-display: ' + display + '; }';
} }
...@@ -63,8 +60,7 @@ window.onload = function() { ...@@ -63,8 +60,7 @@ window.onload = function() {
if (config.time == 0) { if (config.time == 0) {
setTimeout((function(tr){ setTimeout((function(tr){
tr.classList.remove('hidden'); tr.classList.remove('hidden');
if (window.testRunner) document.documentElement.classList.remove("reftest-wait");
testRunner.notifyDone();
}).bind(null, tr), maxTime); }).bind(null, tr), maxTime);
} else { } else {
setTimeout((function(tr){tr.classList.remove('hidden')}).bind(null, tr), maxTime - config.time); setTimeout((function(tr){tr.classList.remove('hidden')}).bind(null, tr), maxTime - config.time);
...@@ -73,3 +69,4 @@ window.onload = function() { ...@@ -73,3 +69,4 @@ window.onload = function() {
} }
</script> </script>
</html>
import os
import time
def main(request, response):
body = open(os.path.join(os.path.dirname(__file__), "../../css/fonts/ahem/ahem.ttf"), "rb").read()
delay = float(request.GET.first("ms", 500))
if delay > 0:
time.sleep(delay / 1E3);
response.add_required_headers = False
response.writer.write_status(200)
response.writer.write_header("content-length", len(body))
response.writer.write_header("content-type", "application/octet-stream")
response.writer.end_headers()
response.writer.write(body)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment