chromium/third_party/blink/web_tests/fast/canvas-api/canvas-lowlatency-getContext.html

<!DOCTYPE html>
<title>Tests that desynchronized Canvas getContext() calls are idempotent.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function() {
    canvas = document.createElement('canvas');
    var ctx_2d = canvas.getContext('2d', {desynchronized : true});
    assert_true(ctx_2d instanceof CanvasRenderingContext2D);
    assert_true(ctx_2d.getContextAttributes().desynchronized);

    var ctx_2d_second = canvas.getContext('2d', {desynchronized : true});
    assert_equals(ctx_2d, ctx_2d_second);

    var ctx_2d_third = canvas.getContext('2d');
    assert_equals(ctx_2d, ctx_2d_third);
}, '2D Canvas getContext() is idempotent');

test(function() {
    canvas = document.createElement('canvas');
    var ctx_3d = canvas.getContext('webgl', {desynchronized : true});
    assert_true(ctx_3d instanceof WebGLRenderingContext);
    assert_true(ctx_3d.getContextAttributes().desynchronized);

    var ctx_3d_second = canvas.getContext('webgl', {desynchronized : true});
    assert_equals(ctx_3d, ctx_3d_second);

    var ctx_3d_third = canvas.getContext('webgl');
    assert_equals(ctx_3d, ctx_3d_third);
}, 'WebGL Canvas getContext() is idempotent');
</script>