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

Unified Diff: tests/standalone/io/socket_close_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
Index: tests/standalone/io/socket_close_test.dart
diff --git a/tests/standalone/io/socket_close_test.dart b/tests/standalone/io/socket_close_test.dart
index d89c7981d966adef23f23f6670c3553287fd24a5..39905e363456a2390ad8d5018f9837b5aa1dfc80 100644
--- a/tests/standalone/io/socket_close_test.dart
+++ b/tests/standalone/io/socket_close_test.dart
@@ -9,18 +9,20 @@
//
// Test socket close events.
-import "package:expect/expect.dart";
import 'dart:async';
import 'dart:io';
import 'dart:isolate';
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
const SERVERSHUTDOWN = -1;
const ITERATIONS = 10;
class SocketClose {
- SocketClose.start(this._mode, this._donePort)
+ SocketClose.start(this._mode, this._done)
: _receivePort = new ReceivePort(),
_sendPort = null,
_readBytes = 0,
@@ -150,7 +152,7 @@ class SocketClose {
void shutdown() {
_sendPort.send(SERVERSHUTDOWN, _receivePort.toSendPort());
_receivePort.receive((message, ignore) {
- _donePort.send(null);
+ _done();
_receivePort.close();
});
@@ -191,7 +193,7 @@ class SocketClose {
int _errorEvents;
int _iterations;
int _mode;
- SendPort _donePort;
+ Function _done;
}
@@ -376,12 +378,8 @@ main() {
// 5: Client sends. Server responds and half closes.
// 6: Client sends and half-closes. Server responds and half closes.
var tests = 7;
- var port = new ReceivePort();
- var completed = 0;
- port.receive((message, ignore) {
- if (++completed == tests) port.close();
- });
for (var i = 0; i < tests; i++) {
- new SocketClose.start(i, port.toSendPort());
+ asyncStart();
+ new SocketClose.start(i, asyncEnd);
}
}
« no previous file with comments | « tests/standalone/io/secure_socket_bad_data_test.dart ('k') | tests/standalone/io/socket_exception_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698