Revision: 7648
Author: [email protected]
Date: Wed Mar 3 10:18:02 2010
Log: Added the ability to customize the timeout to begin the tests.
http://gwt-code-reviews.appspot.com/153819/show
http://code.google.com/p/google-web-toolkit/source/detail?r=7648
Modified:
/trunk/user/src/com/google/gwt/junit/JUnitShell.java
=======================================
--- /trunk/user/src/com/google/gwt/junit/JUnitShell.java Thu Feb 25
06:57:14 2010
+++ /trunk/user/src/com/google/gwt/junit/JUnitShell.java Wed Mar 3
10:18:02 2010
@@ -260,6 +260,39 @@
}
});
+ registerHandler(new ArgHandlerInt() {
+ @Override
+ public String[] getDefaultArgs() {
+ return new String[] {getTag(), "1"};
+ }
+
+ @Override
+ public String getPurpose() {
+ return "Set the test begin timeout (time for clients to contact "
+ + "server), in minutes";
+ }
+
+ @Override
+ public String getTag() {
+ return "-testBeginTimeout";
+ }
+
+ @Override
+ public String[] getTagArgs() {
+ return new String[] {"minutes"};
+ }
+
+ @Override
+ public boolean isUndocumented() {
+ return false;
+ }
+
+ @Override
+ public void setInt(int minutes) {
+ baseTestBeginTimeoutMillis = minutes * 60 * 1000;
+ }
+ });
+
registerHandler(new ArgHandlerString() {
@Override
public String getPurpose() {
@@ -460,13 +493,6 @@
});
}
}
-
- /**
- * The amount of time to wait for all clients to have contacted the
server and
- * begin running the test. "Contacted" does not necessarily mean "the
test has
- * begun," e.g. for linker errors stopping the test initialization.
- */
- static final int TEST_BEGIN_TIMEOUT_MILLIS = 60 * 1000;
/**
* This is a system property that, when set, emulates command line
arguments.
@@ -675,6 +701,13 @@
*/
private long baseTestMethodTimeoutMillis;
+ /**
+ * The amount of time to wait for all clients to have contacted the
server and
+ * begin running the test. "Contacted" does not necessarily mean "the
test has
+ * begun," e.g. for linker errors stopping the test initialization.
+ */
+ private long baseTestBeginTimeoutMillis;
+
/**
* Determines how to batch up tests for execution.
*/
@@ -925,7 +958,7 @@
double elapsed = (currentTimeMillis - testBeginTime) / 1000.0;
throw new TimeoutException(
"The browser did not contact the server within "
- + TEST_BEGIN_TIMEOUT_MILLIS + "ms.\n"
+ + baseTestBeginTimeoutMillis + "ms.\n"
+ messageQueue.getUnretrievedClients(currentTestInfo)
+ "\n Actual time elapsed: " + elapsed + " seconds.\n");
}
@@ -1220,7 +1253,7 @@
// Set a timeout period to automatically fail if the servlet hasn't
been
// contacted; something probably went wrong (the module failed to
load?)
testBeginTime = System.currentTimeMillis();
- testBeginTimeout = testBeginTime + TEST_BEGIN_TIMEOUT_MILLIS;
+ testBeginTimeout = testBeginTime + baseTestBeginTimeoutMillis;
testMethodTimeout = 0; // wait until test execution begins
while (notDone()) {
messageQueue.waitForResults(1000);
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors