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

Side by Side Diff: LayoutTests/fast/events/panScroll-drag.html

Issue 15653007: Introduce panScrollTest() for simplify pan-scroll test scripts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-06-03T12:33 Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <style type="text/css"> 3 <style type="text/css">
4 #draggable {
5 padding: 5pt;
6 border: 3px solid #00cc00;
7 background: #00cccc;
8 width: 80px;
9 cursor: hand;
10 }
11
12 #scrollable { 4 #scrollable {
13 height: 200px; 5 height: 200px;
14 overflow: auto; 6 overflow: auto;
15 border: solid 3px #cc0000; 7 border: solid 3px #cc0000;
16 font-size: 80px; 8 font-size: 80px;
17 } 9 }
18 </style> 10 </style>
11 <script src="../js/resources/js-test-pre.js"></script>
12 <script src="./resources/panScroll.js"></script>
19 <script> 13 <script>
20 function $(id) { return document.getElementById(id); } 14 function start()
21 var MIDDLE_BUTTON = 1;
22 var PAN_SCROLL_RADIUS = 15; // from WebCore/platform/ScrollView.h
23
24 function finishTest() {
25 $('container').innerHTML = '';
26 window.testRunner.notifyDone();
27 }
28
29 function testIt() {
30 var scrollable = $('scrollable');
31
32 if (!window.eventSender)
33 return;
34
35 // Start pan scroll by drag
36 eventSender.mouseMoveTo(scrollable.offsetLeft + 5, scrollable.offsetTop + 5) ;
37 eventSender.mouseDown(MIDDLE_BUTTON);
38 eventSender.mouseMoveTo(scrollable.offsetLeft + 5, scrollable.offsetTop + PA N_SCROLL_RADIUS + 6);
39
40 var retryCount = 0;
41 var lastScrollTop = 0;
42
43 function checkScrolled()
44 {
45 if (scrollable.scrollTop > 0) {
46 testPassed('scrollable.scrollTop > 0');
47 // Stop spring loaded pan scroll
48 eventSender.mouseUp(MIDDLE_BUTTON);
49 retryCount = 0;
50 window.setTimeout(checkStopped, 50);
51 return;
52 }
53
54 ++retryCount;
55 if (retryCount > 10) {
56 testFailed('No autoscroll');
57 finishTest();
58 return;
59 }
60
61 // Autoscroll is occurred evey 0.05 sec.
62 window.setTimeout(checkScrolled, 50);
63 }
64
65 function checkStopped()
66 {
67 if (lastScrollTop == scrollable.scrollTop) {
68 testPassed('autoscroll stopped');
69 finishTest();
70 return;
71 }
72
73 ++retryCount;
74 if (retryCount > 10) {
75 testFailed('still autoscroll');
76 finishTest();
77 return;
78 }
79
80 lastScrollTop = scrollable.scrollTop;
81 window.setTimeout(checkStopped, 50);
82 }
83
84 checkScrolled();
85 }
86
87 function setUpTest()
88 { 15 {
89 var scrollable = $('scrollable'); 16 description('Check pan scroll by drag mouse');
90 for (var i = 0; i < 100; ++i) { 17 testPanScroll({
91 var line = document.createElement('div'); 18 'clickOrDrag': 'drag',
92 line.innerHTML = "line " + i; 19 'scrollable': $('scrollable'),
93 scrollable.appendChild(line); 20 });
94 }
95
96 if (!window.eventSender) {
97 console.log('Please run within DumpRenderTree');
98 return;
99 }
100
101 window.jsTestIsAsync = true;
102 window.setTimeout(testIt, 0);
103 } 21 }
104 </script> 22 </script>
105 </head> 23 </head>
106 <body> 24 <body onload="start()">
25 <div id="container">
26 <p id="description"></p>
107 For manual testing, hold middle button in scrollable and move aroudn mouse point er for scrolling, then release middle button to stop scrolling. 27 For manual testing, hold middle button in scrollable and move aroudn mouse point er for scrolling, then release middle button to stop scrolling.
108 <div id="container"> 28 <div id="scrollable"></div>
109 Scrollable
110 <div id="scrollable">
111 </div>
112 </div> 29 </div>
113 <div id="console"></div> 30 <div id="console"></div>
114 <script src="../js/resources/js-test-pre.js"></script>
115 <script>
116 description('Check pan scroll by drag mouse');
117 setUpTest();
118 </script>
119 <script src="../js/resources/js-test-post.js"></script> 31 <script src="../js/resources/js-test-post.js"></script>
120 </body> 32 </body>
121 </html> 33 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/panScroll-click-expected.txt ('k') | LayoutTests/fast/events/panScroll-drag-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698