chromium/third_party/blink/web_tests/fast/canvas-api/gradient-addColorStop-with-invalid-color.html

<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function(){

    var gradient = document.createElement('canvas').getContext('2d').createLinearGradient(0, 0, 150, 0);

    assert_throws_dom("SYNTAX_ERR", function() {
      gradient.addColorStop(0, '');
    });
    assert_throws_dom("SYNTAX_ERR", function() {
      gradient.addColorStop(0, '#cc');
    });
    assert_throws_dom("SYNTAX_ERR", function() {
      gradient.addColorStop(0, 'rgb(257, 0)');
    });
    assert_throws_dom("SYNTAX_ERR", function() {
      gradient.addColorStop(0, 'rgb(257, 0, 5 / 0)');
    });
}, 'This test checks invalid colors on gradients.');
</script>