Index: tools/testing/dart/test_runner.dart |
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart |
index 1680066f6a7c925f9256b86ee68383bb108f5f1b..0641fbe3065c96f0de34edc9c84447f1c5eb0f94 100644 |
--- a/tools/testing/dart/test_runner.dart |
+++ b/tools/testing/dart/test_runner.dart |
@@ -525,6 +525,38 @@ class CleanDirectoryCopyCommand extends ScriptCommand { |
_destinationDirectory == other._destinationDirectory; |
} |
+class DeleteCommand extends ScriptCommand { |
+ final String _filename; |
+ |
+ DeleteCommand._(this._filename) : super._('delete'); |
+ |
+ String get reproductionCommand => |
+ "Deleting $_filename"; |
+ |
+ Future<ScriptCommandOutputImpl> run() { |
+ var watch = new Stopwatch()..start(); |
+ |
+ var file = new io.File(_filename); |
+ |
+ return file.delete(recursive: true).then((io.File file) { |
+ return new ScriptCommandOutputImpl( |
+ this, Expectation.PASS, "", watch.elapsed); |
+ }).catchError((error) { |
+ return new ScriptCommandOutputImpl( |
+ this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); |
+ }); |
+ } |
+ |
+ void _buildHashCode(HashCodeBuilder builder) { |
+ super._buildHashCode(builder); |
+ builder.addJson(_filename); |
+ } |
+ |
+ bool _equal(DeleteCommand other) => |
+ super._equal(other) && |
+ _filename == other._filename; |
+} |
+ |
class ModifyPubspecYamlCommand extends ScriptCommand { |
String _pubspecYamlFile; |
String _destinationFile; |
@@ -788,6 +820,11 @@ class CommandBuilder { |
return _getUniqueCommand(command); |
} |
+ Command getDeleteCommand(String filename) { |
+ var command = new DeleteCommand._(filename); |
+ return _getUniqueCommand(command); |
+ } |
+ |
Command getPubCommand(String pubCommand, String pubExecutable, |
String pubspecYamlDirectory, String pubCacheDirectory) { |
var command = new PubCommand._( |