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

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

Issue 93973002: Add test of Zones for HttpServer and RawSocketServer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Stay in zone in raw socket/serversocket. Created 7 years, 1 month 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/http_server_test.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/raw_socket_test.dart
diff --git a/tests/standalone/io/raw_socket_test.dart b/tests/standalone/io/raw_socket_test.dart
index 53a5e026d3a355c75414d6f28fce58af10e68520..a469084cf7ce10798a6284138c80aa086499d215 100644
--- a/tests/standalone/io/raw_socket_test.dart
+++ b/tests/standalone/io/raw_socket_test.dart
@@ -376,6 +376,57 @@ void testPauseSocket() {
});
}
+void testSocketZone() {
+ asyncStart();
+ Expect.equals(Zone.ROOT, Zone.current);
+ runZoned(() {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ server.listen((socket) {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ socket.close();
+ server.close();
+ });
+ RawSocket.connect("127.0.0.1", server.port).then((socket) {
+ socket.listen((event) {
+ if (event == RawSocketEvent.READ_CLOSED) {
+ socket.close();
+ asyncEnd();
+ }
+ });
+ });
+ });
+ });
+}
+
+void testSocketZoneError() {
+ asyncStart();
+ Expect.equals(Zone.ROOT, Zone.current);
+ runZoned(() {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ server.listen((socket) {
+ socket.listen((_) {
+ }, onError: (error) {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ socket.close();
+ server.close();
+ throw error;
+ });
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ socket.write(const [0]);
+ });
+ RawSocket.connect("127.0.0.1", server.port).then((socket) {
+ socket.close();
+ });
+ });
+ }, onError: (e) {
+ asyncEnd();
+ });
+}
+
main() {
asyncStart();
testArguments();
@@ -389,5 +440,7 @@ main() {
testSimpleReadWrite(dropReads: true);
testPauseServerSocket();
testPauseSocket();
+ testSocketZone();
+ testSocketZoneError();
asyncEnd();
}
« no previous file with comments | « tests/standalone/io/http_server_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698