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

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

Issue 23886004: Update dart:io tests to use asyncStart/asyncEnd (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 3 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 | « tests/standalone/io/directory_non_ascii_test.dart ('k') | tests/standalone/io/file_error_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/directory_test.dart
diff --git a/tests/standalone/io/directory_test.dart b/tests/standalone/io/directory_test.dart
index 33c66620c4e6140c70cfb88622317e18b5a28a0c..aaedf1cb73970c4a90b890f3938afd432f4ea6b4 100644
--- a/tests/standalone/io/directory_test.dart
+++ b/tests/standalone/io/directory_test.dart
@@ -4,10 +4,11 @@
//
// Directory listing test.
-import "package:expect/expect.dart";
import "dart:async";
import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
class DirectoryTest {
static void testListing() {
@@ -51,7 +52,7 @@ class DirectoryTest {
testSyncListing(false);
Expect.equals(f.fullPathSync(), fLong.fullPathSync());
- var listingDonePort = new ReceivePort();
+ asyncStart();
directory.list(recursive: true).listen(
(FileSystemEntity entity) {
if (entity is File) {
@@ -75,7 +76,7 @@ class DirectoryTest {
f.exists().then((exists) => Expect.isFalse(exists));
directory.exists().then((exists) => Expect.isFalse(exists));
subDirectory.exists().then((exists) => Expect.isFalse(exists));
- listingDonePort.close();
+ asyncEnd();
});
});
@@ -122,7 +123,7 @@ class DirectoryTest {
static void testListTooLongName() {
new Directory("").createTemp().then((d) {
var errors = 0;
- var port = new ReceivePort();
+ asyncStart();
setupListHandlers(Stream<FileSystemEntity> stream) {
stream.listen(
(_) => Expect.fail("Listing of non-existing directory should fail"),
@@ -130,7 +131,7 @@ class DirectoryTest {
Expect.isTrue(error is DirectoryException);
if (++errors == 2) {
d.delete(recursive: true).then((_) {
- port.close();
+ asyncEnd();
});
}
});
@@ -171,7 +172,7 @@ class DirectoryTest {
}
static void testDeleteTooLongName() {
- var port = new ReceivePort();
+ asyncStart();
new Directory("").createTemp().then((d) {
var subDirName = 'subdir';
var subDir = new Directory("${d.path}/$subDirName");
@@ -188,7 +189,7 @@ class DirectoryTest {
onError(error) {
Expect.isTrue(error is DirectoryException);
if (++errors == 2) {
- d.delete(recursive: true).then((ignore) => port.close());
+ d.delete(recursive: true).then((_) => asyncEnd());
}
return true;
}
@@ -354,7 +355,7 @@ class DirectoryTest {
}
static void testCreateTemp([String template = ""]) {
- var port = new ReceivePort();
+ asyncStart();
Directory dir = new Directory(template);
Future.wait([dir.createTemp(), dir.createTemp()])
.then((tempDirs) {
@@ -364,7 +365,7 @@ class DirectoryTest {
t.deleteSync();
Expect.isFalse(t.existsSync());
}
- port.close();
+ asyncEnd();
});
}
@@ -500,9 +501,9 @@ testCreateTempError() {
var location = illegalTempDirectoryLocation();
if (location == null) return;
- var port = new ReceivePort();
+ asyncStart();
var future = new Directory(location).createTemp();
- future.catchError((e) => port.close());
+ future.catchError((_) => asyncEnd());
}
@@ -522,7 +523,7 @@ testCreateExistingSync() {
testCreateExisting() {
// Test that creating an existing directory succeeds.
- var port = new ReceivePort();
+ asyncStart();
var d = new Directory('');
d.createTemp().then((temp) {
var subDir = new Directory('${temp.path}/flaf');
@@ -535,7 +536,7 @@ testCreateExisting() {
subDir.exists().then((dirExists) {
Expect.isTrue(dirExists);
temp.delete(recursive: true).then((_) {
- port.close();
+ asyncEnd();
});
});
});
@@ -562,7 +563,7 @@ testCreateDirExistingFileSync() {
testCreateDirExistingFile() {
// Test that creating an existing directory succeeds.
- var port = new ReceivePort();
+ asyncStart();
var d = new Directory('');
d.createTemp().then((temp) {
var path = '${temp.path}/flaf';
@@ -574,7 +575,7 @@ testCreateDirExistingFile() {
.catchError((error) {
Expect.isTrue(error is DirectoryException);
temp.delete(recursive: true).then((_) {
- port.close();
+ asyncEnd();
});
});
});
@@ -594,7 +595,7 @@ testCreateRecursiveSync() {
testCreateRecursive() {
- var port = new ReceivePort();
+ asyncStart();
new Directory('').createTemp().then((temp) {
var d = new Directory('${temp.path}/a/b/c');
d.create(recursive: true).then((_) {
@@ -602,7 +603,7 @@ testCreateRecursive() {
Expect.isTrue(new Directory('${temp.path}/a/b').existsSync());
Expect.isTrue(new Directory('${temp.path}/a/b/c').existsSync());
temp.deleteSync(recursive: true);
- port.close();
+ asyncEnd();
});
});
}
« no previous file with comments | « tests/standalone/io/directory_non_ascii_test.dart ('k') | tests/standalone/io/file_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698