chromium/third_party/blink/web_tests/fast/canvas/canvas-with-illegal-args.html

<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body>
<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>