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

Unified Diff: tools/testing/dart/test_runner.dart

Issue 11293019: Run large html tests individually. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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: tools/testing/dart/test_runner.dart
===================================================================
--- tools/testing/dart/test_runner.dart (revision 14500)
+++ tools/testing/dart/test_runner.dart (working copy)
@@ -182,11 +182,25 @@
*/
int numRetries;
+ /**
+ * True if this test is dependent on another test completing before it can
+ * star (for example, we might need to depend on some other test completing
+ * first).
+ */
+ bool waitingForOtherTest;
+
+ /**
+ * The set of test cases that wish to be notified when this test has
+ * completed.
+ */
+ List<BrowserTestCase> observers;
+
BrowserTestCase(displayName, commands, configuration, completedHandler,
- expectedOutcomes, info, isNegative)
+ expectedOutcomes, info, isNegative, [this.waitingForOtherTest = false])
: super(displayName, commands, configuration, completedHandler,
expectedOutcomes, isNegative: isNegative, info: info) {
numRetries = 2; // Allow two retries to compensate for flaky browser tests.
+ observers = [];
}
List<String> get _lastArguments => commands.last.arguments;
@@ -195,6 +209,21 @@
List<String> get batchTestArguments =>
_lastArguments.getRange(1, _lastArguments.length - 1);
+
+ /** Add a test case to listen for when this current test has completed. */
+ void addObserver(BrowserTestCase testCase) {
+ observers.add(testCase);
+ }
+
+ /**
+ * Notify all of the test cases that are dependent on this one that they can
+ * proceed.
+ */
+ void notifyObservers() {
+ for (BrowserTestCase testCase in observers) {
+ testCase.waitingForOtherTest = false;
+ }
+ }
}
@@ -662,7 +691,14 @@
stderr = new List<String>();
currentStep = 0;
startTime = new Date.now();
- runCommand(testCase.commands[currentStep++], stepExitHandler);
+ if (testCase.commands.length == 1 && testCase.usesWebDriver &&
+ !testCase.configuration['noBatch']) {
+ // Browser test cases that do not require a precompilation step, start
+ // with the batch runner right away.
+ processQueue._getBatchRunner(testCase).startTest(testCase);
+ } else {
+ runCommand(testCase.commands[currentStep++], stepExitHandler);
+ }
}
void runCommand(Command command, void exitHandler(int exitCode)) {
@@ -1076,8 +1112,8 @@
* True if we are using a browser + platform combination that needs the
* Selenium server jar.
*/
- bool get _needsSelenium => Platform.operatingSystem == 'macos' &&
- browserUsed == 'safari';
+ bool get _needsSelenium => (Platform.operatingSystem == 'macos' &&
+ browserUsed == 'safari') || browserUsed == 'opera';
/** True if the Selenium Server is ready to be used. */
bool get _isSeleniumAvailable => _seleniumServer != null ||
@@ -1249,11 +1285,12 @@
print(Strings.join(fields, '\t'));
return;
}
- if (test.usesWebDriver && _needsSelenium && !_isSeleniumAvailable) {
- // The server is not ready to run Selenium tests. Put the test back in
+ if (test.usesWebDriver && _needsSelenium && !_isSeleniumAvailable || (test
+ is BrowserTestCase && test.waitingForOtherTest)) {
+ // The test is not yet ready to run. Put the test back in
// the queue. Avoid spin-polling by using a timeout.
_tests.add(test);
- new Timer(1000, (timer) {_tryRunTest();}); // Don't lose a process.
+ new Timer(100, (timer) {_tryRunTest();}); // Don't lose a process.
return;
}
if (_verbose) {
@@ -1266,6 +1303,7 @@
_progress.start(test);
TestCaseEvent oldCallback = test.completedHandler;
void wrapper(TestCase test_arg) {
+ if (test_arg is BrowserTestCase) test_arg.notifyObservers();
_numProcesses--;
_progress.done(test_arg);
_tryRunTest();

Powered by Google App Engine
This is Rietveld 408576698