Modified: trunk/LayoutTests/ChangeLog (156677 => 156678)
--- trunk/LayoutTests/ChangeLog 2013-09-30 20:38:46 UTC (rev 156677)
+++ trunk/LayoutTests/ChangeLog 2013-09-30 20:47:43 UTC (rev 156678)
@@ -1,3 +1,19 @@
+2013-09-30 Alexey Proskuryakov <a...@apple.com>
+
+ Remove timeout from shouldBecome* functions in js-test-pre
+ https://bugs.webkit.org/show_bug.cgi?id=122121
+
+ Reviewed by Ryosuke Niwa.
+
+ Removed timeout. A 0.5 sec timeout never makes sense, and if something is stuck,
+ a test should just time out normally.
+
+ * resources/js-test-pre.js:
+ (_waitForCondition):
+ (shouldBecomeEqual):
+ (shouldBecomeEqualToString):
+ (shouldBecomeDifferent):
+
2013-09-30 Jer Noble <jer.no...@apple.com>
Unreviewed, roll back in r156546 with rebaselined tests.
Modified: trunk/LayoutTests/resources/js-test-pre.js (156677 => 156678)
--- trunk/LayoutTests/resources/js-test-pre.js 2013-09-30 20:38:46 UTC (rev 156677)
+++ trunk/LayoutTests/resources/js-test-pre.js 2013-09-30 20:47:43 UTC (rev 156678)
@@ -264,27 +264,20 @@
return values.length;
}
-// Execute condition every 5 milliseconds until it succeed or failureTime is reached.
-// completionHandler is executed on success, failureHandler is executed on timeout.
-function _waitForCondition(condition, failureTime, completionHandler, failureHandler)
+// Execute condition every 5 milliseconds until it succeeds.
+function _waitForCondition(condition, completionHandler)
{
- if (condition()) {
+ if (condition())
completionHandler();
- } else if (Date.now() > failureTime) {
- failureHandler();
- } else {
- setTimeout(_waitForCondition, 5, condition, failureTime, completionHandler, failureHandler);
- }
+ else
+ setTimeout(_waitForCondition, 5, condition, completionHandler);
}
-function shouldBecomeEqual(_a, _b, completionHandler, timeout)
+function shouldBecomeEqual(_a, _b, completionHandler)
{
if (typeof _a != "string" || typeof _b != "string")
debug("WARN: shouldBecomeEqual() expects string arguments");
- if (timeout === undefined)
- timeout = 500;
-
var condition = function() {
var exception;
var _av;
@@ -302,20 +295,15 @@
}
return false;
};
- var failureTime = Date.now() + timeout;
- var failureHandler = function () {
- testFailed(_a + " failed to change to " + _b + " in " + (timeout / 1000) + " seconds.");
- completionHandler();
- };
- _waitForCondition(condition, failureTime, completionHandler, failureHandler);
+ _waitForCondition(condition, completionHandler);
}
-function shouldBecomeEqualToString(value, reference, completionHandler, timeout)
+function shouldBecomeEqualToString(value, reference, completionHandler)
{
if (typeof value !== "string" || typeof reference !== "string")
debug("WARN: shouldBecomeEqualToString() expects string arguments");
var unevaledString = JSON.stringify(reference);
- shouldBecomeEqual(value, unevaledString, completionHandler, timeout);
+ shouldBecomeEqual(value, unevaledString, completionHandler);
}
function shouldBeType(_a, _type) {
@@ -397,12 +385,10 @@
testFailed(_a + " should not be " + _bv + ".");
}
-function shouldBecomeDifferent(_a, _b, completionHandler, timeout)
+function shouldBecomeDifferent(_a, _b, completionHandler)
{
if (typeof _a != "string" || typeof _b != "string")
debug("WARN: shouldBecomeDifferent() expects string arguments");
- if (timeout === undefined)
- timeout = 500;
var condition = function() {
var exception;
@@ -421,12 +407,7 @@
}
return false;
};
- var failureTime = Date.now() + timeout;
- var failureHandler = function () {
- testFailed(_a + " did not become different from " + _b + " in " + (timeout / 1000) + " seconds.");
- completionHandler();
- };
- _waitForCondition(condition, failureTime, completionHandler, failureHandler);
+ _waitForCondition(condition, completionHandler);
}
function shouldBeTrue(_a) { shouldBe(_a, "true"); }