Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache.html |
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache.html |
index 984c839fe0c9c54956ac41af3d12e6d4370e542e..708847e79725f7b02ca04624f3b12916dda41b9d 100644 |
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache.html |
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-font-cache.html |
@@ -1,37 +1,34 @@ |
-<script src="../../resources/js-test.js"></script> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
<canvas id='c'></canvas> |
<script> |
+test(function(t) { |
+ |
// The reason this is implemented as a layout test instead of a unit test (see CanvasFontCacheTest.cpp) |
Justin Novosad
2017/02/03 18:39:32
indent
zakerinasab
2017/02/09 18:11:03
Done.
|
// is to exercise interactions with animation frames. |
var cacheLimit = 0; |
-if (!window.internals || !window.testRunner) { |
- testFailed('This test requires the window.internals and window.testRunner interfaces'); |
-} else { |
- cacheLimit = internals.canvasFontCacheMaxFonts(); |
- testRunner.waitUntilDone(); |
- testRunner.dumpAsText(); |
- requestAnimationFrame(step1); |
-} |
+cacheLimit = window.internals.canvasFontCacheMaxFonts(); |
+requestAnimationFrame(step1); |
var ctx = document.getElementById('c').getContext('2d'); |
function step1() |
{ |
- for (var i = 0; i < cacheLimit + 1; i ++) { |
- ctx.font = (1 + i) + 'px sans-serif'; |
- ctx.fillText('a', 0, 50); |
- } |
- shouldBeTrue('internals.isInCanvasFontCache(document, "1px sans-serif")'); |
- requestAnimationFrame(step2); |
+ for (var i = 0; i < cacheLimit + 1; i ++) { |
+ ctx.font = (1 + i) + 'px sans-serif'; |
+ ctx.fillText('a', 0, 50); |
+ } |
+ assert_true(internals.isInCanvasFontCache(document, "1px sans-serif")); |
+ requestAnimationFrame(step2); |
} |
function step2() |
{ |
- // Pruning of the cache is expected to happen between tasks |
- shouldBeFalse('internals.isInCanvasFontCache(document, "1px sans-serif")'); |
- shouldBeTrue('internals.isInCanvasFontCache(document, "2px sans-serif")'); |
- testRunner.notifyDone(); |
+ // Pruning of the cache is expected to happen between tasks |
+ assert_false(internals.isInCanvasFontCache(document, "1px sans-serif")); |
+ assert_true(internals.isInCanvasFontCache(document, "2px sans-serif")); |
} |
+}, 'Test that createImageBitmap from a bitmaprenderer canvas produces correct result'); |
</script> |