Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / canvas-font-cache.html
blob984c839fe0c9c54956ac41af3d12e6d4370e542e
1 <script src="../../resources/js-test.js"></script>
2 <canvas id='c'></canvas>
3 <script>
4 // The reason this is implemented as a layout test instead of a unit test (see CanvasFontCacheTest.cpp)
5 // is to exercise interactions with animation frames.
7 var cacheLimit = 0;
8 if (!window.internals || !window.testRunner) {
9 testFailed('This test requires the window.internals and window.testRunner interfaces');
10 } else {
11 cacheLimit = internals.canvasFontCacheMaxFonts();
12 testRunner.waitUntilDone();
13 testRunner.dumpAsText();
14 requestAnimationFrame(step1);
17 var ctx = document.getElementById('c').getContext('2d');
19 function step1()
21 for (var i = 0; i < cacheLimit + 1; i ++) {
22 ctx.font = (1 + i) + 'px sans-serif';
23 ctx.fillText('a', 0, 50);
25 shouldBeTrue('internals.isInCanvasFontCache(document, "1px sans-serif")');
26 requestAnimationFrame(step2);
29 function step2()
31 // Pruning of the cache is expected to happen between tasks
32 shouldBeFalse('internals.isInCanvasFontCache(document, "1px sans-serif")');
33 shouldBeTrue('internals.isInCanvasFontCache(document, "2px sans-serif")');
34 testRunner.notifyDone();
37 </script>