Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: LayoutTests/fast/events/drag-and-drop-autoscroll-inner-frame.html

Issue 24074002: Drag'n drop Autoscroll does not work properly on inner frames (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <head>
3 <style type="text/css">
4 #scrollable {
5 height: 200px;
6 overflow: auto;
7 border: solid 3px #cc0000;
8 font-size: 80px;
9 }
10 </style>
11 <script>
12
13 function finishTest()
14 {
15 eventSender.mouseUp();
16 window.testRunner.notifyDone();
17 }
18
19 var x, y, middleTermScrollOffset;
20 var iframe, iframeDocument, draggable;
21
22 function log(msg)
23 {
24 document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
25 }
26
27 function testIt()
28 {
29 if (!window.eventSender)
Julien - ping for review 2013/09/09 23:13:14 We don't get here if !window.eventSender as setTim
30 return;
31
32 eventSender.dragMode = false;
33
34 iframe = document.getElementById('scrollable');
35 iframeDocument = iframe.contentDocument;
36 draggable = iframeDocument.getElementById('draggable');
37
38 iframeDocument.addEventListener("scroll", recordScroll);
39
40 // Grab draggable.
41 x = iframe.offsetLeft + draggable.offsetLeft + 7;
42 y = iframe.offsetTop + draggable.offsetTop + 7;
43
44 eventSender.mouseMoveTo(x, y);
45 eventSender.mouseDown();
46
47 // Move mouse to the bottom autoscroll border belt.
48 y = iframe.offsetTop + iframe.offsetHeight - 10;
49 eventSender.mouseMoveTo(x, y);
50 }
51
52 function recordScroll(e)
53 {
54 autoscrollTestPart1();
55 iframeDocument.removeEventListener("scroll", recordScroll);
56 }
57
58 function recordScroll2(e)
59 {
60 autoscrollTestPart2();
61 iframeDocument.removeEventListener("scroll", recordScroll);
62 }
63
64 function autoscrollTestPart1()
65 {
66 if (iframe.contentDocument.body.scrollTop > 0) {
Julien - ping for review 2013/09/09 23:13:14 Nit: I would flip the logic to do the failing case
67 middleTermScrollOffset = iframe.contentDocument.body.scrollTop;
68
69 iframeDocument.addEventListener("scroll", recordScroll2);
70
71 // Move mouse to the upper autoscroll border belt.
72 y = iframe.offsetTop + 10;
73 eventSender.mouseMoveTo(x, y);
74
75 log("Passed: Autoscroll should have scrolled the iframe downwards, and d id.");
yosin_UTC9 2013/09/10 02:09:38 We should use testPassed(), e.g. testPassed('Autos
76 return;
77 }
78
79 log("Failed: Autoscroll should have scrolled the iframe downwards, but did n ot.");
yosin_UTC9 2013/09/10 02:09:38 We should use testFailed(), e.g. testFailed('Autos
80 finishTest();
81 }
82
83 function autoscrollTestPart2()
84 {
85 if (iframe.contentDocument.body.scrollTop < middleTermScrollOffset)
yosin_UTC9 2013/09/10 02:09:38 We should use shouldBeTrue(), e.g. shouldBeTrue('i
86 log("Passed: Autoscroll should have scrolled the iframe upwards, and did .");
87 else
88 log("Failed: Autoscroll should have scrolled the iframe upwards, but did not.");
89
90 finishTest();
91 }
92
93 function setUpTest()
94 {
95 if (!window.eventSender) {
96 console.log('Please run within DumpRenderTree');
97 return;
98 }
99
100 window.jsTestIsAsync = true;
101 setTimeout(testIt, 0);
yosin_UTC9 2013/09/10 02:09:38 We should start test window.onload rather than tim
102 }
103 </script>
104 </head>
105 <body>
106 For manual testing, drag and drop "Drop Me" to downwards and then upwards.
107 <iframe id="scrollable" src="data:text/html,
108 <p id='draggable' draggable='true' style='cursor: hand;'>
109 <b>Drag me!</b>
110 </p>
111 Try to drag and drop the text above in the input element at the bottom of this i frame. It should scroll. Then, try the way back.
112 <br><br>more<br>more<br>more<br>more<br>more<br>more<br>more<br>more<br>more<br> more<br>more<br>more<br><input>
113 "></iframe><br>
114 </div>
115 <div id="console"></div>
116 <script src="../js/resources/js-test-pre.js"></script>
117 <script>
118 description('Check autoscroll within an inner frame by drag-and-drop');
119 setUpTest();
120 </script>
121 <script src="../js/resources/js-test-post.js"></script>
122 </body>
123 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698