Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache.html

Issue 2676493005: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <script src="../../resources/js-test.js"></script> 1 <script src="../../resources/testharness.js"></script>
2 <script src="../../resources/testharnessreport.js"></script>
2 <canvas id='c'></canvas> 3 <canvas id='c'></canvas>
3 <script> 4 <script>
5 test(function(t) {
6
4 // The reason this is implemented as a layout test instead of a unit test (see C anvasFontCacheTest.cpp) 7 // The reason this is implemented as a layout test instead of a unit test (see C anvasFontCacheTest.cpp)
Justin Novosad 2017/02/03 18:39:32 indent
zakerinasab 2017/02/09 18:11:03 Done.
5 // is to exercise interactions with animation frames. 8 // is to exercise interactions with animation frames.
6 9
7 var cacheLimit = 0; 10 var cacheLimit = 0;
8 if (!window.internals || !window.testRunner) { 11 cacheLimit = window.internals.canvasFontCacheMaxFonts();
9 » testFailed('This test requires the window.internals and window.testRunne r interfaces'); 12 requestAnimationFrame(step1);
10 } else {
11 » cacheLimit = internals.canvasFontCacheMaxFonts();
12 » testRunner.waitUntilDone();
13 » testRunner.dumpAsText();
14 » requestAnimationFrame(step1);
15 }
16 13
17 var ctx = document.getElementById('c').getContext('2d'); 14 var ctx = document.getElementById('c').getContext('2d');
18 15
19 function step1() 16 function step1()
20 { 17 {
21 » for (var i = 0; i < cacheLimit + 1; i ++) { 18 for (var i = 0; i < cacheLimit + 1; i ++) {
22 » » ctx.font = (1 + i) + 'px sans-serif'; 19 ctx.font = (1 + i) + 'px sans-serif';
23 » » ctx.fillText('a', 0, 50); 20 ctx.fillText('a', 0, 50);
24 » } 21 }
25 » shouldBeTrue('internals.isInCanvasFontCache(document, "1px sans-serif")' ); 22 assert_true(internals.isInCanvasFontCache(document, "1px sans-serif"));
26 » requestAnimationFrame(step2); 23 requestAnimationFrame(step2);
27 } 24 }
28 25
29 function step2() 26 function step2()
30 { 27 {
31 » // Pruning of the cache is expected to happen between tasks 28 // Pruning of the cache is expected to happen between tasks
32 » shouldBeFalse('internals.isInCanvasFontCache(document, "1px sans-serif") '); 29 assert_false(internals.isInCanvasFontCache(document, "1px sans-serif"));
33 » shouldBeTrue('internals.isInCanvasFontCache(document, "2px sans-serif")' ); 30 assert_true(internals.isInCanvasFontCache(document, "2px sans-serif"));
34 » testRunner.notifyDone();
35 } 31 }
36 32
33 }, 'Test that createImageBitmap from a bitmaprenderer canvas produces correct re sult');
37 </script> 34 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698