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

Unified Diff: tests/standalone/io/directory_error_test.dart

Issue 10392023: Change dart:io to use Future for one-shot operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding stable test binaries Created 8 years, 7 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
Index: tests/standalone/io/directory_error_test.dart
diff --git a/tests/standalone/io/directory_error_test.dart b/tests/standalone/io/directory_error_test.dart
index 27d001b38709ff80b160ad695974e51b99f4cf38..5c978cce88ef274aae37a890b5063390064f8e92 100644
--- a/tests/standalone/io/directory_error_test.dart
+++ b/tests/standalone/io/directory_error_test.dart
@@ -8,9 +8,7 @@
#import("dart:isolate");
Directory tempDir() {
- var d = new Directory('');
- d.createTempSync();
- return d;
+ return new Directory('').createTempSync();
}
@@ -40,11 +38,11 @@ void testCreateInNonExistent(Directory temp, Function done) {
Expect.throws(() => inNonExistent.createSync(),
(e) => checkCreateInNonExistentFileException(e));
- inNonExistent.create(() => Expect.fail("Unreachable code"));
- inNonExistent.onError = (e) {
+ inNonExistent.create().handleException((e) {
checkCreateInNonExistentFileException(e);
done();
- };
+ return true;
+ });
}
@@ -75,11 +73,11 @@ void testCreateTempInNonExistent(Directory temp, Function done) {
Expect.throws(() => nonExistent.createTempSync(),
(e) => checkCreateTempInNonExistentFileException(e));
- nonExistent.createTemp(() => Expect.fail("Unreachable code"));
- nonExistent.onError = (e) {
+ nonExistent.createTemp().handleException((e) {
checkCreateTempInNonExistentFileException(e);
done();
- };
+ return true;
+ });
}
@@ -108,11 +106,11 @@ void testDeleteNonExistent(Directory temp, Function done) {
Expect.throws(() => nonExistent.deleteSync(),
(e) => checkDeleteNonExistentFileException(e));
- nonExistent.delete(() => Expect.fail("Unreachable code"));
- nonExistent.onError = (e) {
+ nonExistent.delete().handleException((e) {
checkDeleteNonExistentFileException(e);
done();
- };
+ return true;
+ });
}
@@ -142,11 +140,11 @@ void testDeleteRecursivelyNonExistent(Directory temp, Function done) {
Expect.throws(() => nonExistent.deleteRecursivelySync(),
(e) => checkDeleteRecursivelyNonExistentFileException(e));
- nonExistent.deleteRecursively(() => Expect.fail("Unreachable code"));
- nonExistent.onError = (e) {
+ nonExistent.deleteRecursively().handleException((e) {
checkDeleteRecursivelyNonExistentFileException(e);
done();
- };
+ return true;
+ });
}
@@ -173,8 +171,8 @@ bool checkListNonExistentFileException(e) {
void testListNonExistent(Directory temp, Function done) {
Directory nonExistent = new Directory("${temp.path}/nonExistent");
- nonExistent.list();
- nonExistent.onError = (e) {
+ var lister = nonExistent.list();
+ lister.onError = (e) {
checkListNonExistentFileException(e);
done();
};
@@ -183,8 +181,7 @@ void testListNonExistent(Directory temp, Function done) {
void runTest(Function test) {
// Create a temporary directory for the test.
- var temp = new Directory('');
- temp.createTempSync();
+ var temp = new Directory('').createTempSync();
// Wait for the test to finish and delete the temporary directory.
ReceivePort p = new ReceivePort();
« no previous file with comments | « tests/standalone/io/dart_std_io_pipe_test.dart ('k') | tests/standalone/io/directory_invalid_arguments_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698