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

Unified Diff: tests/standalone/io/socket_invalid_arguments_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_exception_test.dart ('k') | tests/standalone/io/socket_ipv6_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/socket_invalid_arguments_test.dart
diff --git a/tests/standalone/io/socket_invalid_arguments_test.dart b/tests/standalone/io/socket_invalid_arguments_test.dart
index 24025aeb87db7e380e054255b348c1185d4cffb7..e928cafd483495591e9d2faee37f8394935d5e6c 100644
--- a/tests/standalone/io/socket_invalid_arguments_test.dart
+++ b/tests/standalone/io/socket_invalid_arguments_test.dart
@@ -2,9 +2,10 @@
// 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.
-import "package:expect/expect.dart";
import "dart:io";
-import "dart:isolate";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
class NotAnInteger {
operator==(other) => other == 1;
@@ -18,13 +19,17 @@ class NotAList {
}
testSocketCreation(host, port) {
+ asyncStart();
Socket.connect(host, port)
.then((socket) => Expect.fail("Shouldn't get connected"))
- .catchError((e) => null, test: (e) => e is SocketException)
- .catchError((e) => null, test: (e) => e is ArgumentError);
+ .catchError((e) {
+ Expect.isTrue(e is ArgumentError || e is SocketException);
+ asyncEnd();
+ });
}
testAdd(buffer) {
+ asyncStart();
ServerSocket.bind("127.0.0.1", 0).then((server) {
server.listen((socket) => socket.destroy());
Socket.connect("127.0.0.1", server.port).then((socket) {
@@ -39,6 +44,7 @@ testAdd(buffer) {
Expect.equals(1, errors);
socket.destroy();
server.close();
+ asyncEnd();
});
socket.add(buffer);
});
@@ -46,13 +52,14 @@ testAdd(buffer) {
}
testServerSocketCreation(address, port, backlog) {
+ asyncStart();
var server;
- var port = new ReceivePort();
try {
ServerSocket.bind(address, port, backlog: backlog)
- .then((_) { Expect.fail("ServerSocket bound"); });
+ .then((_) { Expect.fail("ServerSocket bound"); })
+ .catchError((e) => asyncEnd());
} catch (e) {
- port.close();
+ asyncEnd();
}
}
« no previous file with comments | « tests/standalone/io/socket_exception_test.dart ('k') | tests/standalone/io/socket_ipv6_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698