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

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

Issue 259353003: Make Socket::connect try all addresses given. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
« sdk/lib/io/socket.dart ('K') | « sdk/lib/io/socket.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/socket_test.dart
diff --git a/tests/standalone/io/socket_test.dart b/tests/standalone/io/socket_test.dart
index 3ebadf8043ea4fc2d914123ba8795927ac30dfdc..5f7253a8d0f81ad1cc27462a8069be051aa74a70 100644
--- a/tests/standalone/io/socket_test.dart
+++ b/tests/standalone/io/socket_test.dart
@@ -199,6 +199,35 @@ void testConnectStreamDataCloseCancel(bool useDestroy) {
});
}
+
+void testConnectMultipleInternetAddress() {
+ // Ip addresses are invalid, if they start with '0'. We use this fact, to
+ // avoid waiting for timeout.
+ asyncStart();
+ ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
+ server.listen(
+ (client) {
+ client.destroy();
+ server.close();
+ asyncEnd();
+ });
+ var addresses = [new InternetAddress("0.42.42.42"),
+ new InternetAddress("127.0.0.1")];
+ Socket.connect(addresses, server.port).then((socket) {
+ socket.destroy();
+ });
+ });
+
+ var addresses = [new InternetAddress("0.42.42.42"),
+ new InternetAddress("0.42.42.43")];
+ asyncStart();
+ Socket.connect(addresses, 3213)
+ .catchError((error) {
+ Expect.equals("0.42.42.43", error.address.host);
+ asyncEnd();
+ });
+}
+
main() {
testArguments();
testSimpleBind();
@@ -211,4 +240,5 @@ main() {
testConnectStreamDataClose(false);
testConnectStreamDataCloseCancel(true);
testConnectStreamDataCloseCancel(false);
+ testConnectMultipleInternetAddress();
}
« sdk/lib/io/socket.dart ('K') | « sdk/lib/io/socket.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698