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

Unified Diff: tests/standalone/io/socket_exception_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/socket_close_test.dart ('k') | tests/standalone/io/socket_invalid_arguments_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/socket_exception_test.dart
diff --git a/tests/standalone/io/socket_exception_test.dart b/tests/standalone/io/socket_exception_test.dart
index caa771a322fec589414a3db17de71da5ad3c7dd3..2966e851610b0abffe4e4b172cda65af1889705c 100644
--- a/tests/standalone/io/socket_exception_test.dart
+++ b/tests/standalone/io/socket_exception_test.dart
@@ -4,11 +4,12 @@
//
// Tests socket exceptions.
-import "package:expect/expect.dart";
import "dart:async";
-import "dart:isolate";
import "dart:io";
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
class SocketExceptionTest {
static void serverSocketExceptionTest() {
@@ -36,24 +37,24 @@ class SocketExceptionTest {
}
static void serverSocketCloseListenTest() {
- var port = new ReceivePort();
+ asyncStart();
ServerSocket.bind("127.0.0.1", 0).then((server) {
Socket.connect("127.0.0.1", server.port).then((socket) {
server.close();
server.listen(
(incoming) => Expect.fail("Unexpected socket"),
- onDone: port.close);
+ onDone: asyncEnd);
});
});
}
static void serverSocketListenCloseTest() {
- var port = new ReceivePort();
+ asyncStart();
ServerSocket.bind("127.0.0.1", 0).then((server) {
Socket.connect("127.0.0.1", server.port).then((socket) {
server.listen(
(incoming) => server.close(),
- onDone: port.close);
+ onDone: asyncEnd);
});
});
}
@@ -178,14 +179,14 @@ class SocketExceptionTest {
client.add(new List.filled(SIZE, 0));
// Destroy other socket now.
completer.complete(null);
- var port = new ReceivePort();
+ asyncStart();
client.done.then(
(_) {
Expect.fail("Expected error");
},
onError: (error) {
Expect.isTrue(error is SocketException);
- port.close();
+ asyncEnd();
});
});
});
@@ -212,13 +213,10 @@ class SocketExceptionTest {
}
static void unknownHostTest() {
- // Port to verify that the test completes.
- var port = new ReceivePort();
- port.receive((message, replyTo) => null);
-
+ asyncStart();
Socket.connect("hede.hule.hest", 1234)
.then((socket) => Expect.fail("Connection completed"))
- .catchError((e) => port.close(), test: (e) => e is SocketException);
+ .catchError((e) => asyncEnd(), test: (e) => e is SocketException);
}
@@ -237,6 +235,8 @@ class SocketExceptionTest {
}
main() {
+ asyncStart();
SocketExceptionTest.testMain();
+ asyncEnd();
}
« no previous file with comments | « tests/standalone/io/socket_close_test.dart ('k') | tests/standalone/io/socket_invalid_arguments_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698