Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / mouse-cursor-change.html
blobe7e40ba3dd49138095cd3cf5b9edc6eeb9ee2c3b
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <style type="text/css">
6 </style>
7 </head>
8 <body>
9 <p id="description"></p>
10 <p><a href="https://bugs.webkit.org/show_bug.cgi?id=53341">Bug 53341</a></p>
11 <div id="test-container">
12 <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>
13 </div>
14 <br/>
15 <div id="console"></div>
16 <script>
17 // This appears to be just to accomodate style update (cursor is updated immediately on mouse events).
18 // TODO(rbyers): replace with updateAfterDisplay or requestAnimationFrame
19 var CURSOR_UPDATE_DELAY = 50;
21 description("Test that mouse cursors are changed correctly on mouse events.");
23 if (!window.eventSender) {
24 testFailed('This test requires DumpRenderTree');
27 if (window.testRunner) {
28 testRunner.dumpAsText();
29 testRunner.waitUntilDone();
30 window.jsTestIsAsync = true;
33 function runTest(prepare, next) {
34 prepare();
35 setTimeout(function() {
36 debug('Cursor Info: ' + window.internals.getCurrentCursorInfo());
37 debug('');
38 next();
39 }, CURSOR_UPDATE_DELAY);
42 function testsDone() {
43 // This text is redundant with the test output - hide it
44 document.getElementById('test-container').style.display = 'none';
45 finishJSTest();
48 // Can't do anything useful here without eventSender
49 if (window.eventSender) {
50 var target = document.getElementById('target');
51 eventSender.dragMode = false;
52 var tests = [
53 function() {
54 debug('Mouse move');
55 eventSender.mouseMoveTo(target.offsetLeft + 3, target.offsetTop + 3);
56 }, function() {
57 debug('Mouse down');
58 eventSender.mouseDown();
59 }, function() {
60 debug('Mouse hold down, move');
61 eventSender.mouseMoveTo(target.offsetLeft + 13, target.offsetTop + 3);
62 }, function() {
63 debug('Mouse up');
64 eventSender.mouseUp();
68 var i = 0;
69 function nextTest() {
70 if (i < tests.length) {
71 runTest(tests[i++], nextTest);
72 } else {
73 testsDone();
76 nextTest();
79 </script>
80 </body>
81 </html>