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

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

Issue 915523004: Fix timeout in test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/socket_source_address_test.dart
diff --git a/tests/standalone/io/socket_source_address_test.dart b/tests/standalone/io/socket_source_address_test.dart
index b3c4289b992ec7c01c3dcd28a71f7e2acf1b0fac..d0ead81d1556caf30bb31793a97f36e56b3c8a19 100644
--- a/tests/standalone/io/socket_source_address_test.dart
+++ b/tests/standalone/io/socket_source_address_test.dart
@@ -70,11 +70,21 @@ Future testConnect(InternetAddress bindAddress,
bool v6Only,
Function connectFunction,
Function closeDestroyFunction) async {
+ var successCount = 0;
+ if (!v6Only) successCount += ipV4SourceAddresses.length;
+ if (bindAddress.type == InternetAddressType.IP_V6) {
+ successCount += ipV6SourceAddresses.length;
+ }
+ var count = 0;
+ var allConnected = new Completer();
+ if (successCount == 0) allConnected.complete();
+
asyncStart();
var server = await ServerSocket.bind(bindAddress, 0, v6Only: v6Only);
server.listen((s) {
s.destroy();
- asyncEnd();
+ count++;
+ if (count == successCount) allConnected.complete();
}, onDone: () => asyncEnd());
asyncStart();
@@ -82,7 +92,6 @@ Future testConnect(InternetAddress bindAddress,
// Connect with IPv4 source addesses.
for (var sourceAddress in ipV4SourceAddresses) {
if (!v6Only) {
- asyncStart(); // Matching asyncEnd in server.listen above.
var s = await connectFunction(InternetAddress.LOOPBACK_IP_V4,
server.port,
sourceAddress: sourceAddress);
@@ -100,7 +109,6 @@ Future testConnect(InternetAddress bindAddress,
// Connect with IPv6 source addesses.
for (var sourceAddress in ipV6SourceAddresses) {
if (bindAddress.type == InternetAddressType.IP_V6) {
- asyncStart(); // Matching asyncEnd in server.listen above.
var s = await connectFunction(InternetAddress.LOOPBACK_IP_V6,
server.port,
sourceAddress: sourceAddress);
@@ -114,6 +122,7 @@ Future testConnect(InternetAddress bindAddress,
}
}
+ await allConnected.future;
server.close();
kustermann 2015/02/10 14:20:17 -> await server.close() ?
Søren Gjesse 2015/02/10 14:29:10 Done.
asyncEnd();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698