chromium/third_party/blink/web_tests/editing/selection/modify_move/move-by-character-brute-force.html

<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<meta charset="UTF-8">
<div id="sample"></div>
<div id="log"></div>
<script>
test(function(){
    function hasSimpleCaretMovement(charCode) {
        var testString = "aaaaa" + String.fromCharCode(charCode) + "bbbb";
        sample.textContent = testString;
        var selection = window.getSelection();
        selection.collapse(sample, 0);
        for (var i = 0; i < testString.length; ++i) {
            selection.modify("move", "forward", "character");
            if (selection.baseOffset != i + 1)
                return false;
        }
        return true;
    }

    function toHex(i) {
        var hex = i.toString(16);
        while (hex.length < 4)
            hex = "0" + hex;
        return hex;
    }


    assert_true(hasSimpleCaretMovement(0x0041));

    assert_false(hasSimpleCaretMovement(0x0300));

    for (var i = 1; i < 1024; ++i) {
        if (i >= 0x0300 && i <= 0x036F)
            assert_false(hasSimpleCaretMovement(i));
        else
            assert_true(hasSimpleCaretMovement(i));
    }
}, "This test checks that we have simple caret motion up to a certain limit");
</script>