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

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

Issue 12608007: Reapply "Update the test runner to use the new dart:io API" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fixes Created 7 years, 9 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 | « tools/testing/dart/test_options.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_progress.dart
diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart
index ca6e1112c22cfe14974a64b362c40f9c50d4896a..20a6646285df63d51dd3690deaed6af4f125c88e 100644
--- a/tools/testing/dart/test_progress.dart
+++ b/tools/testing/dart/test_progress.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -15,9 +15,9 @@ import "utils.dart";
String _pad(String s, int length) {
StringBuffer buffer = new StringBuffer();
for (int i = s.length; i < length; i++) {
- buffer.add(' ');
+ buffer.write(' ');
}
- buffer.add(s);
+ buffer.write(s);
return buffer.toString();
}
@@ -66,9 +66,9 @@ List<String> _buildFailureOutput(TestCase test,
output.add(formatter.failed('FAILED: ${test.configurationString}'
' ${test.displayName}'));
StringBuffer expected = new StringBuffer();
- expected.add('Expected: ');
+ expected.write('Expected: ');
for (var expectation in test.expectedOutcomes) {
- expected.add('$expectation ');
+ expected.write('$expectation ');
}
output.add(expected.toString());
output.add('Actual: ${test.lastCommandOutput.result}');
@@ -143,7 +143,7 @@ class FlakyLogWriter extends EventListener {
if (test.isFlaky && test.lastCommandOutput.result != PASS) {
var buf = new StringBuffer();
for (var l in _buildFailureOutput(test)) {
- buf.add("$l\n");
+ buf.write("$l\n");
}
_appendToFlakyFile(buf.toString());
}
@@ -167,7 +167,7 @@ class SummaryPrinter extends EventListener {
class TimingPrinter extends EventListener {
List<TestCase> _tests = <TestCase>[];
- Date _startTime;
+ DateTime _startTime;
TimingPrinter(this._startTime);
@@ -177,7 +177,7 @@ class TimingPrinter extends EventListener {
void allDone() {
// TODO: We should take all the commands into account
- Duration d = (new Date.now()).difference(_startTime);
+ Duration d = (new DateTime.now()).difference(_startTime);
print('\n--- Total time: ${_timeString(d)} ---');
_tests.sort((a, b) {
Duration aDuration = a.lastCommandOutput.time;
@@ -287,17 +287,19 @@ class LeftOverTempDirPrinter extends EventListener {
}
void allDone() {
- var tempDirs = [];
+ var count = 0;
var systemTempDir = _tempDir();
- var lister = new Directory.fromPath(systemTempDir).list();
- lister.onDir = (path) => tempDirs.add(path);
- lister.onDone = (_) {
- if (tempDirs.length > MIN_NUMBER_OF_TEMP_DIRS) {
- DebugLogger.warning("There are ${tempDirs.length} directories "
- "in the system tempdir ('$systemTempDir')! "
- "Maybe left over directories?\n");
+ var lister = new Directory.fromPath(systemTempDir).list().listen(
+ (FileSystemEntity fse) {
+ if (fse is Directory) count++;
+ },
+ onDone: () {
+ if (count > MIN_NUMBER_OF_TEMP_DIRS) {
+ DebugLogger.warning("There are ${count} directories "
+ "in the system tempdir ('$systemTempDir')! "
+ "Maybe left over directories?\n");
}
- };
+ });
}
}
@@ -330,7 +332,7 @@ class ProgressIndicator extends EventListener {
ProgressIndicator(this._startTime);
factory ProgressIndicator.fromName(String name,
- Date startTime,
+ DateTime startTime,
Formatter formatter) {
switch (name) {
case 'compact':
@@ -396,15 +398,15 @@ class ProgressIndicator extends EventListener {
int _passedTests = 0;
int _failedTests = 0;
bool _allTestsKnown = false;
- Date _startTime;
+ DateTime _startTime;
}
abstract class CompactIndicator extends ProgressIndicator {
- CompactIndicator(Date startTime)
+ CompactIndicator(DateTime startTime)
: super(startTime);
void allDone() {
- stdout.write('\n'.charCodes);
+ stdout.writeln('');
if (_failedTests > 0) {
// We may have printed many failure logs, so reprint the summary data.
_printProgress();
@@ -424,7 +426,7 @@ abstract class CompactIndicator extends ProgressIndicator {
class CompactProgressIndicator extends CompactIndicator {
Formatter _formatter;
- CompactProgressIndicator(Date startTime, this._formatter)
+ CompactProgressIndicator(DateTime startTime, this._formatter)
: super(startTime);
void _printProgress() {
@@ -432,18 +434,18 @@ class CompactProgressIndicator extends CompactIndicator {
var progressPadded = _pad(_allTestsKnown ? percent : '--', 3);
var passedPadded = _pad(_passedTests.toString(), 5);
var failedPadded = _pad(_failedTests.toString(), 5);
- Duration d = (new Date.now()).difference(_startTime);
+ Duration d = (new DateTime.now()).difference(_startTime);
var progressLine =
'\r[${_timeString(d)} | $progressPadded% | '
'+${_formatter.passed(passedPadded)} | '
'-${_formatter.failed(failedPadded)}]';
- stdout.write(progressLine.charCodes);
+ stdout.write(progressLine);
}
}
class VerboseProgressIndicator extends ProgressIndicator {
- VerboseProgressIndicator(Date startTime)
+ VerboseProgressIndicator(DateTime startTime)
: super(startTime);
void _printStartProgress(TestCase test) {
@@ -464,7 +466,7 @@ class BuildbotProgressIndicator extends ProgressIndicator {
static String stepName;
var _failureSummary = <String>[];
- BuildbotProgressIndicator(Date startTime) : super(startTime);
+ BuildbotProgressIndicator(DateTime startTime) : super(startTime);
void done(TestCase test) {
super.done(test);
@@ -496,4 +498,3 @@ class BuildbotProgressIndicator extends ProgressIndicator {
super.allDone();
}
}
-
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698