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

Unified Diff: LayoutTests/fast/events/panScroll-in-iframe.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
Index: LayoutTests/fast/events/panScroll-in-iframe.html
diff --git a/LayoutTests/fast/events/panScroll-in-iframe.html b/LayoutTests/fast/events/panScroll-in-iframe.html
index 68d8633cb9da55872cf4bd798e4ff109a01fbada..4ed97cf93cf3adbb2e5dec63b4e71961c503c6c4 100644
--- a/LayoutTests/fast/events/panScroll-in-iframe.html
+++ b/LayoutTests/fast/events/panScroll-in-iframe.html
@@ -1,75 +1,32 @@
<html>
<head>
+<script src="../js/resources/js-test-pre.js"></script>
+<script src="./resources/panScroll.js"></script>
<script>
-var MIDDLE_BUTTON = 1;
-
-function $(id) { return document.getElementById(id); }
-
-function doTest() {
- var scrollable = document.body;
- for (var i = 0; i < 20; ++i) {
- var line = document.createElement('div');
- line.innerHTML = "line " + i;
- scrollable.appendChild(line);
- }
-
- if (!window.eventSender)
- return;
+function start() {
- var iframe = window.parent.document.getElementById('iframe');
+ description('Check pan scroll in iframe');
+ var iframe = $('iframe');
var offsetLeft = iframe.offsetLeft;
var offsetTop = iframe.offsetTop;
- eventSender.mouseMoveTo(offsetLeft + 5, offsetTop + 5);
- eventSender.mouseDown(MIDDLE_BUTTON);
- eventSender.mouseUp(MIDDLE_BUTTON);
- eventSender.mouseMoveTo(offsetLeft + 5, offsetTop + 50);
-
- var retryCount = 0;
- function checkScrolled() {
- if (scrollable.scrollTop > 0) {
- window.parent.testDone('SUCCEEDED');
- return;
- }
- ++retryCount;
- if (retryCount > 10) {
- window.parent.testDone('FAILED');
- return;
- }
- window.setTimeout(checkScrolled, 50);
- }
- checkScrolled();
-}
-
-function prepare() {
- var iframe = document.createElement('iframe');
- iframe.id = 'iframe';
- iframe.width = 640;
- iframe.height = 100;
- iframe.src = location.href + '?test';
- document.body.appendChild(iframe);
-
- if (!window.testRunner)
- return;
-
- testRunner.dumpAsText(false);
- testRunner.waitUntilDone();
-}
-
-function start() {
- if (location.href.indexOf('?') < 0)
- prepare();
- else
- doTest();
-}
-
-function testDone(message) {
- $('result').textContent = message;
- testRunner.notifyDone();
+ testPanScroll({
+ 'clickOrDrag': 'click',
+ 'endX': offsetLeft + 5,
+ 'endY': offsetTop + 50,
+ 'scrollable': iframe.contentDocument.body,
+ 'scrolledObject': iframe.contentWindow,
+ 'startX': offsetLeft + 5,
+ 'startY': offsetTop + 5,
+ });
}
</script>
</head>
<body onload="start()">
-<div id="result">You should run this test in DRT.</div>
+<div id="container">
+<p id="description"></p>
+<iframe id="iframe" width="640" height="100"></iframe>
+</div>
+<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
« no previous file with comments | « LayoutTests/fast/events/panScroll-event-fired-expected.txt ('k') | LayoutTests/fast/events/panScroll-in-iframe-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698