3 <style type=
"text/css">
6 border: 3px solid
#00cc00;
15 border: solid
3px #cc0000;
20 function $(id
) { return document
.getElementById(id
); }
22 function finishTest() {
23 eventSender
.mouseUp();
24 $('container').innerHTML
= '';
25 window
.testRunner
.notifyDone();
29 var draggable
= $('draggable');
30 var scrollable
= $('scrollable');
32 if (!window
.eventSender
)
35 eventSender
.dragMode
= false;
38 eventSender
.mouseMoveTo(draggable
.offsetLeft
+ 5, draggable
.offsetTop
+ 5);
39 eventSender
.mouseDown();
41 // Move mouse to autoscroll border belt.
42 eventSender
.mouseMoveTo(scrollable
.offsetLeft
+ 5, scrollable
.offsetTop
+ scrollable
.offsetHeight
- 10);
45 var lastScrollTop
= 0;
47 function checkScrolled()
49 if (scrollable
.scrollTop
> 0) {
50 testPassed('scrollable.scrollTop > 0');
51 lastScrollTop
= scrollable
.scrollTop
;
52 // Cancel drag and drop by ESC key.
53 eventSender
.keyDown('escape');
55 window
.setTimeout(checkStopped
, 50);
60 if (retryCount
> 10) {
61 testFailed('No autoscroll');
66 // Autoscroll is occurred evey 0.05 sec.
67 window
.setTimeout(checkScrolled
, 50);
70 function checkStopped()
72 if (lastScrollTop
== scrollable
.scrollTop
) {
73 testPassed('autoscroll stopped');
79 if (retryCount
> 10) {
80 testFailed('still autoscroll');
85 lastScrollTop
= scrollable
.scrollTop
;
86 window
.setTimeout(checkStopped
, 50);
94 var scrollable
= $('scrollable');
95 for (var i
= 0; i
< 100; ++i
) {
96 var line
= document
.createElement('div');
97 line
.innerHTML
= "line " + i
;
98 scrollable
.appendChild(line
);
101 if (!window
.eventSender
) {
102 console
.log('Please run within DumpRenderTree');
106 window
.jsTestIsAsync
= true;
107 window
.setTimeout(testIt
, 0);
112 For manual testing, drag and drop
"Drop Me" to
"Scrollable" area.
114 <div id=
"draggable" draggable=
"true">Drop Me
</div>
116 <div id=
"scrollable">
119 <div id=
"console"></div>
120 <script src=
"../../resources/js-test.js"></script>
122 description('Check autoscroll by drag-and-drop');