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..b9c2c7ca79da5e2432e1aec7fa5efd16f8c12371 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,33 @@ |
-<script src="../../resources/js-test.js"></script> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
<canvas id='c'></canvas> |
<script> |
-// The reason this is implemented as a layout test instead of a unit test (see CanvasFontCacheTest.cpp) |
-// 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); |
-} |
- |
-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); |
-} |
- |
-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(); |
-} |
+test(function(t) { |
+ // The reason this is implemented as a layout test instead of a unit test (see CanvasFontCacheTest.cpp) |
+ // is to exercise interactions with animation frames. |
+ var cacheLimit = 0; |
+ 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); |
+ } |
+ assert_true(internals.isInCanvasFontCache(document, "1px sans-serif")); |
+ requestAnimationFrame(step2); |
+ } |
+ |
+ function step2() |
+ { |
+ // 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> |