chromium/third_party/blink/web_tests/fast/events/mouse-cursor-change.html

<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<style type="text/css">
</style>
</head>
<body>
<p id="description"></p>
<p><a href="https://bugs.webkit.org/show_bug.cgi?id=53341">Bug 53341</a></p>
<div id="test-container">
    <div id="target" onMouseDown="style.cursor='progress';event.preventDefault();" onMouseMove="style.cursor='pointer';" onMouseUp="style.cursor='help';" style="cursor:pointer;">Play with mouse on this element. Cursors change on events - mousemove: pointer(hand), mousedown: progress, mouseup: help.</div>
</div>
<br/>
<div id="console"></div>
<script>
// This appears to be just to accommodate style update (cursor is updated immediately on mouse events).
// TODO(rbyers): replace with updateAfterDisplay or requestAnimationFrame
var CURSOR_UPDATE_DELAY = 50;

description("Test that mouse cursors are changed correctly on mouse events.");

if (!window.eventSender) {
    testFailed('This test requires DumpRenderTree');
}

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
    window.jsTestIsAsync = true;
}

function runTest(prepare, next) {
    prepare();
    setTimeout(function() {
        debug('Cursor Info: ' + internals.getCurrentCursorInfo());
        debug('');
        next();
    }, CURSOR_UPDATE_DELAY);
}

function testsDone() {
    // This text is redundant with the test output - hide it
    document.getElementById('test-container').style.display = 'none';
    finishJSTest();
}

// Can't do anything useful here without eventSender
if (window.eventSender) {
    var target = document.getElementById('target');
    eventSender.dragMode = false;
    var tests = [
        function() {
            debug('Mouse move');
            eventSender.mouseMoveTo(target.offsetLeft + 3, target.offsetTop + 3);
        }, function() {
            debug('Mouse down');
            eventSender.mouseDown();
        }, function() {
            debug('Mouse hold down, move');
            eventSender.mouseMoveTo(target.offsetLeft + 13, target.offsetTop + 3);
        }, function() {
            debug('Mouse up');
            eventSender.mouseUp();
        }
    ];

    var i = 0;
    function nextTest() {
        if (i < tests.length) {
            runTest(tests[i++], nextTest);
        } else {
            testsDone();
        }
    }
    nextTest();
}

</script>
</body>
</html>