Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / scrolling / scrollbar-mousedown-move-mouseup.html
blobbd2b7acddb3821260eedd32f018f6643850a3b27
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script>
6 window.jsTestIsAsync = true;
8 function initEventHandlers(element) {
9 element.addEventListener('mousedown', handleEvent);
10 element.addEventListener('mouseup', handleEvent);
13 window.events = {
14 'scrollme': [],
15 'notscrollme': []
17 function handleEvent(e) {
18 window.events[e.target.id].push(e);
21 function finish() {
22 shouldBe("events['scrollme'].length", "4");
23 shouldBe("events['notscrollme'].length", "0");
24 shouldBeEqualToString("events['scrollme'][0].type", "mousedown");
25 shouldBe("events['scrollme'][0].which", "1");
26 shouldBeEqualToString("events['scrollme'][1].type", "mouseup");
27 shouldBe("events['scrollme'][1].which", "1");
28 shouldBeEqualToString("events['scrollme'][2].type", "mousedown");
29 shouldBe("events['scrollme'][2].which", "2");
30 shouldBeEqualToString("events['scrollme'][3].type", "mouseup");
31 shouldBe("events['scrollme'][3].which", "2");
32 finishJSTest();
35 window.onload = function () {
36 var d1 = document.querySelector('#scrollme');
37 var d2 = document.querySelector('#notscrollme');
38 initEventHandlers(d1);
39 initEventHandlers(d2);
41 if (window.eventSender) {
42 eventSender.mouseMoveTo(d1.offsetLeft + d1.offsetWidth - 4, d1.offsetTop + 4);
43 eventSender.mouseDown();
44 eventSender.mouseMoveTo(d2.offsetLeft + d2.offsetWidth - 4, d2.offsetTop + 4);
45 eventSender.mouseUp();
46 eventSender.mouseMoveTo(d1.offsetLeft + d1.offsetWidth - 4, d1.offsetTop + 4);
47 eventSender.mouseDown(1);
48 eventSender.mouseMoveTo(d2.offsetLeft + d2.offsetWidth - 4, d2.offsetTop + 4);
49 eventSender.mouseUp(1);
50 finish();
51 } else
52 debug('This test requires eventSender. Click the scrollbar to play manually.');
54 </script>
55 <style>
56 #scrollme, #notscrollme {
57 width: 100px;
58 height: 100px;
59 overflow: auto;
61 #scrollme p {
62 height: 1000px;
64 </style>
65 </head>
66 <body>
67 <div id="scrollme"><p>This is a scrollable div.</p></div>
68 <div id="notscrollme"></div>
69 <pre id="console"></pre>
70 </body>
71 </html>