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

Side by Side Diff: LayoutTests/fast/events/panScroll-click.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
« no previous file with comments | « no previous file | LayoutTests/fast/events/panScroll-click-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 click
36 eventSender.mouseMoveTo(scrollable.offsetLeft + 5, scrollable.offsetTop + 5) ;
37 eventSender.mouseDown(MIDDLE_BUTTON);
38 eventSender.mouseUp(MIDDLE_BUTTON);
39 eventSender.mouseMoveTo(scrollable.offsetLeft + 5, scrollable.offsetTop + PA N_SCROLL_RADIUS + 6);
40
41 var retryCount = 0;
42 var lastScrollTop = 0;
43
44 function checkScrolled()
45 {
46 if (scrollable.scrollTop > 0) {
47 testPassed('scrollable.scrollTop > 0');
48 // Stop spring loaded pan scroll
49 eventSender.mouseDown(MIDDLE_BUTTON);
50 eventSender.mouseUp(MIDDLE_BUTTON);
51 retryCount = 0;
52 window.setTimeout(checkStopped, 50);
53 return;
54 }
55
56 ++retryCount;
57 if (retryCount > 10) {
58 testFailed('No autoscroll');
59 finishTest();
60 return;
61 }
62
63 // Autoscroll is occurred evey 0.05 sec.
64 window.setTimeout(checkScrolled, 50);
65 }
66
67 function checkStopped()
68 {
69 if (lastScrollTop == scrollable.scrollTop) {
70 testPassed('autoscroll stopped');
71 finishTest();
72 return;
73 }
74
75 ++retryCount;
76 if (retryCount > 10) {
77 testFailed('still autoscroll');
78 finishTest();
79 return;
80 }
81
82 lastScrollTop = scrollable.scrollTop;
83 window.setTimeout(checkStopped, 50);
84 }
85
86 checkScrolled();
87 }
88
89 function setUpTest()
90 { 15 {
91 var scrollable = $('scrollable'); 16 description('Check pan scroll by click mouse');
92 for (var i = 0; i < 100; ++i) { 17 testPanScroll({
93 var line = document.createElement('div'); 18 'clickOrDrag': 'click',
94 line.innerHTML = "line " + i; 19 'scrollable': $('scrollable'),
95 scrollable.appendChild(line); 20 });
96 }
97
98 if (!window.eventSender) {
99 console.log('Please run within DumpRenderTree');
100 return;
101 }
102
103 window.jsTestIsAsync = true;
104 window.setTimeout(testIt, 0);
105 } 21 }
106 </script> 22 </script>
107 </head> 23 </head>
108 <body> 24 <body onload="start()">
25 <div id="container">
26 <p id="description"></p>
109 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.
110 <div id="container"> 28 <div id="scrollable"></div>
111 Scrollable
112 <div id="scrollable">
113 </div>
114 </div> 29 </div>
115 <div id="console"></div> 30 <div id="console"></div>
116 <script src="../js/resources/js-test-pre.js"></script>
117 <script>
118 description('Check pan scroll by click mouse');
119 setUpTest();
120 </script>
121 <script src="../js/resources/js-test-post.js"></script> 31 <script src="../js/resources/js-test-post.js"></script>
122 </body> 32 </body>
123 </html> 33 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/panScroll-click-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698