Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-with-illegal-args.html |
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-with-illegal-args.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-with-illegal-args.html |
index ea9f5b764961471ac9e9dba39c9e328e9874b4d2..5b0e424f73bc468e055b3a380181fde883dd9d6c 100644 |
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-with-illegal-args.html |
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-with-illegal-args.html |
@@ -1,9 +1,63 @@ |
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
-<html> |
-<head> |
-<script src="../../resources/js-test.js"></script> |
-</head> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
<body> |
-<script src="script-tests/canvas-with-illegal-args.js"></script> |
+<script> |
+ |
+function CheckPixelRGB(ctx, x, y, rgb) |
+{ |
+ var imageData = ctx.getImageData(x, y, 1, 1).data; |
+ assert_array_equals(imageData.slice(0, 3), rgb); |
+} |
+ |
+function TestContextScale(scaleWidth, scaleHeight) |
+{ |
+ ctx = document.createElement('canvas').getContext('2d'); |
+ ctx.scale(scaleWidth, scaleHeight); |
+ ctx.fillStyle = 'green'; |
+ ctx.fillRect(0, 0, 100, 100); |
+ CheckPixelRGB(ctx, 50, 50, [0, 128, 0]); |
+} |
+ |
+function TestContextTranslate(scaleWidth, scaleHeight) |
+{ |
+ ctx = document.createElement('canvas').getContext('2d'); |
+ ctx.translate(scaleWidth, scaleHeight); |
+ ctx.fillStyle = 'green'; |
+ ctx.fillRect(0, 0, 100, 100); |
+ CheckPixelRGB(ctx, 50, 50, [0, 128, 0]); |
+} |
+ |
+function TestContextRotate(rotation) |
+{ |
+ ctx = document.createElement('canvas').getContext('2d'); |
+ ctx.rotate(rotation); |
+ ctx.fillStyle = 'green'; |
+ ctx.fillRect(0, 0, 100, 100); |
+ CheckPixelRGB(ctx, 50, 50, [0, 128, 0]); |
+} |
+ |
+var testScenariosScale = [ |
+ ['Test scale(NaN, 1)', NaN, 1], |
+ ['Test scale(1, NaN)', 1, NaN], |
+ ['Test scale(Infinity, 1)', Infinity, 1], |
+ ['Test scale(1, Infinity)', 1, Infinity], |
+]; |
+ |
+var testScenariosTranslate = [ |
+ ['Test translate(NaN, 1)', NaN, 1], |
+ ['Test translate(1, NaN)', 1, NaN], |
+ ['Test translate(Infinity, 1)', Infinity, 1], |
+ ['Test translate(1, Infinity)', 1, Infinity], |
+]; |
+ |
+var testScenariosRotate = [ |
+ ['Test rotate(NaN)', NaN], |
+ ['Test translate(Infinity)', Infinity], |
+]; |
+ |
+generate_tests(TestContextScale, testScenariosScale); |
+generate_tests(TestContextTranslate, testScenariosTranslate); |
+generate_tests(TestContextRotate, testScenariosRotate); |
+ |
+</script> |
</body> |
-</html> |