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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/panScroll-click-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/panScroll-click.html
diff --git a/LayoutTests/fast/events/panScroll-click.html b/LayoutTests/fast/events/panScroll-click.html
index a93823fc1170215ffafd7254028bec23a2e60022..c53c187cea445754813bbcb00b771bb461333dda 100644
--- a/LayoutTests/fast/events/panScroll-click.html
+++ b/LayoutTests/fast/events/panScroll-click.html
@@ -1,14 +1,6 @@
<html>
<head>
<style type="text/css">
-#draggable {
- padding: 5pt;
- border: 3px solid #00cc00;
- background: #00cccc;
- width: 80px;
- cursor: hand;
-}
-
#scrollable {
height: 200px;
overflow: auto;
@@ -16,108 +8,26 @@
font-size: 80px;
}
</style>
+<script src="../js/resources/js-test-pre.js"></script>
+<script src="./resources/panScroll.js"></script>
<script>
-function $(id) { return document.getElementById(id); }
-var MIDDLE_BUTTON = 1;
-var PAN_SCROLL_RADIUS = 15; // from WebCore/platform/ScrollView.h
-
-function finishTest() {
- $('container').innerHTML = '';
- window.testRunner.notifyDone();
-}
-
-function testIt() {
- var scrollable = $('scrollable');
-
- if (!window.eventSender)
- return;
-
- // Start pan scroll by click
- eventSender.mouseMoveTo(scrollable.offsetLeft + 5, scrollable.offsetTop + 5);
- eventSender.mouseDown(MIDDLE_BUTTON);
- eventSender.mouseUp(MIDDLE_BUTTON);
- eventSender.mouseMoveTo(scrollable.offsetLeft + 5, scrollable.offsetTop + PAN_SCROLL_RADIUS + 6);
-
- var retryCount = 0;
- var lastScrollTop = 0;
-
- function checkScrolled()
- {
- if (scrollable.scrollTop > 0) {
- testPassed('scrollable.scrollTop > 0');
- // Stop spring loaded pan scroll
- eventSender.mouseDown(MIDDLE_BUTTON);
- eventSender.mouseUp(MIDDLE_BUTTON);
- retryCount = 0;
- window.setTimeout(checkStopped, 50);
- return;
- }
-
- ++retryCount;
- if (retryCount > 10) {
- testFailed('No autoscroll');
- finishTest();
- return;
- }
-
- // Autoscroll is occurred evey 0.05 sec.
- window.setTimeout(checkScrolled, 50);
- }
-
- function checkStopped()
- {
- if (lastScrollTop == scrollable.scrollTop) {
- testPassed('autoscroll stopped');
- finishTest();
- return;
- }
-
- ++retryCount;
- if (retryCount > 10) {
- testFailed('still autoscroll');
- finishTest();
- return;
- }
-
- lastScrollTop = scrollable.scrollTop;
- window.setTimeout(checkStopped, 50);
- }
-
- checkScrolled();
-}
-
-function setUpTest()
+function start()
{
- var scrollable = $('scrollable');
- for (var i = 0; i < 100; ++i) {
- var line = document.createElement('div');
- line.innerHTML = "line " + i;
- scrollable.appendChild(line);
- }
-
- if (!window.eventSender) {
- console.log('Please run within DumpRenderTree');
- return;
- }
-
- window.jsTestIsAsync = true;
- window.setTimeout(testIt, 0);
+ description('Check pan scroll by click mouse');
+ testPanScroll({
+ 'clickOrDrag': 'click',
+ 'scrollable': $('scrollable'),
+ });
}
</script>
</head>
-<body>
-For manual testing, hold middle button in scrollable and move aroudn mouse pointer for scrolling, then release middle button to stop scrolling.
+<body onload="start()">
<div id="container">
-Scrollable
-<div id="scrollable">
-</div>
+<p id="description"></p>
+For manual testing, hold middle button in scrollable and move aroudn mouse pointer for scrolling, then release middle button to stop scrolling.
+<div id="scrollable"></div>
</div>
<div id="console"></div>
-<script src="../js/resources/js-test-pre.js"></script>
-<script>
-description('Check pan scroll by click mouse');
-setUpTest();
-</script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
« 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