chromium/third_party/blink/web_tests/fast/forms/label/continous-click-on-label.html

<!DOCTYPE html>
<html>
<script src="../../../resources/js-test.js"></script>
<style>
span {
    display: inline-block;
    width: 15px;
    height: 15px;
    vertical-align: bottom;
    border: 1px solid #ccc;
    margin-right: 5px;
    background-color: #fff;
}
</style>

<label><input type="checkbox" id="checkbox"><span id="span"></span></label>

<script>
description('Test the continuous checking and unchecking of checkbox when ' +
    'clicking on associated label');

var checkbox = document.getElementById('checkbox');
var span = document.getElementById('span');

shouldBeFalse('checkbox.checked');
debug('The checkbox should be checked after three clicks');
testWithContinuousClick(span, 3);
shouldBeTrue('checkbox.checked');

debug('Checkbox should still be checked after ten clicks');
testWithContinuousClick(span, 10);
shouldBeTrue('checkbox.checked');

checkbox.style.display = 'none';

function testWithContinuousClick(element, number)
{
    eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop);
    for (n = 0; n < number; ++n) {
        eventSender.mouseDown();
        eventSender.mouseUp();
    }
}
</script>
</html>