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

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

Issue 18684004: Fix error in standalone/io/secure_socket_bad_data_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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/secure_socket_bad_data_test.dart
diff --git a/tests/standalone/io/secure_socket_bad_data_test.dart b/tests/standalone/io/secure_socket_bad_data_test.dart
index a1ced5b8b28b758a8dac380e0f96b6c7f956d742..55499db4b471b456d232411f81bdbf6d985a4e4b 100644
--- a/tests/standalone/io/secure_socket_bad_data_test.dart
+++ b/tests/standalone/io/secure_socket_bad_data_test.dart
@@ -90,6 +90,13 @@ void test(bool hostnameInConnect) {
RawSocket baseSocket = sockets[0];
RawSecureSocket socket = sockets[1];
final completer = new Completer();
Anders Johnsen 2013/07/04 11:36:56 Make completer var and test for null?
+ bool completed = false;
+ void tryComplete() {
+ if (!completed) {
+ completed = true;
+ completer.complete(null);
+ }
+ }
final data = createTestData();
int bytesWritten = 0;
socket.listen((event) {
@@ -110,14 +117,14 @@ void test(bool hostnameInConnect) {
}
break;
case RawSocketEvent.READ_CLOSED:
- completer.complete(null);
+ tryComplete();
break;
default: throw "Unexpected event $event";
}
},
onError: (e) {
Expect.isTrue(e is IOException);
- completer.complete(null);
+ tryComplete();
});
return completer.future;
}
« 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