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

Unified Diff: LayoutTests/fast/scroll-behavior/resources/scroll-behavior-test.js

Issue 387553003: Fix use of wrong variable in ScrollBehaviorTest (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/scroll-behavior/resources/scroll-behavior-test.js
diff --git a/LayoutTests/fast/scroll-behavior/resources/scroll-behavior-test.js b/LayoutTests/fast/scroll-behavior/resources/scroll-behavior-test.js
index 3f3be56d4546490d0294d72b52f4d6af91ccdb6c..2649ddec0da575fac640c0ee17b1fbefe30a665b 100644
--- a/LayoutTests/fast/scroll-behavior/resources/scroll-behavior-test.js
+++ b/LayoutTests/fast/scroll-behavior/resources/scroll-behavior-test.js
@@ -34,8 +34,8 @@ ScrollBehaviorTest.prototype.scrollListener = function(testCase) {
}
// Wait for an intermediate frame, then instant-scroll to the end state.
- if ((this.scrollElement.scrollLeft != testCase.startX || this.scrollElement.scrollTop != this.scrollElement.startY) &&
- (this.scrollElement.scrollLeft != testCase.endX || this.scrollElement.scrollTop != this.scrollElement.endY)) {
+ if ((this.scrollElement.scrollLeft != testCase.startX || this.scrollElement.scrollTop != testCase.startY) &&
+ (this.scrollElement.scrollLeft != testCase.endX || this.scrollElement.scrollTop != testCase.endY)) {
this.scrollElement.scrollLeft = {x: testCase.endX, behavior: "instant"};
this.scrollElement.scrollTop = {y: testCase.endY, behavior: "instant"};
this.testCaseComplete();
@@ -68,8 +68,15 @@ ScrollBehaviorTest.prototype.startNextTestCase = function() {
this.asyncTest.step(function() {
assert_equals(scrollElement.scrollLeft + ", " + scrollElement.scrollTop, testCase.startX + ", " + testCase.startY);
});
- testCase.scrollListener = this.scrollListener.bind(this, testCase);
- this.scrollEventTarget.addEventListener("scroll", testCase.scrollListener);
+ if (scrollElement.scrollLeft == testCase.endX && scrollElement.scrollTop == testCase.endY) {
+ // We've instant-scrolled. This means we've already failed the assert above, and will never
+ // reach an intermediate frame. End the test case now to avoid hanging while waiting for an
+ // intermediate frame.
+ this.testCaseComplete();
+ } else {
+ testCase.scrollListener = this.scrollListener.bind(this, testCase);
+ this.scrollEventTarget.addEventListener("scroll", testCase.scrollListener);
+ }
} else {
this.asyncTest.step(function() {
assert_equals(scrollElement.scrollLeft + ", " + scrollElement.scrollTop, testCase.endX + ", " + testCase.endY);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698