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

Unified Diff: tests/standalone/io/http_server_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 | « runtime/bin/socket_patch.dart ('k') | tests/standalone/io/raw_socket_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_server_test.dart
diff --git a/tests/standalone/io/http_server_test.dart b/tests/standalone/io/http_server_test.dart
index 00dc5cd9f068032eba98947b69fc8f29e34c1552..b406f7f58d7a367f58c31ac74d5cdd15c30d9527 100644
--- a/tests/standalone/io/http_server_test.dart
+++ b/tests/standalone/io/http_server_test.dart
@@ -60,6 +60,57 @@ void testListenOn() {
});
}
+
+void testHttpServerZone() {
+ asyncStart();
+ Expect.equals(Zone.ROOT, Zone.current);
+ runZoned(() {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ HttpServer.bind("127.0.0.1", 0).then((server) {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ server.listen((request) {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ request.response.close();
+ server.close();
+ });
+ new HttpClient().get("127.0.0.1", server.port, '/')
+ .then((request) => request.close())
+ .then((response) => response.drain())
+ .then((_) => asyncEnd());
+ });
+ });
+}
+
+
+void testHttpServerZoneError() {
+ asyncStart();
+ Expect.equals(Zone.ROOT, Zone.current);
+ runZoned(() {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ HttpServer.bind("127.0.0.1", 0).then((server) {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ server.listen((request) {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ request.listen((_) {}, onError: (error) {
+ Expect.notEquals(Zone.ROOT, Zone.current);
+ server.close();
+ throw error;
+ });
+ });
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ socket.write('GET / HTTP/1.1\r\nContent-Length: 100\r\n\r\n');
+ socket.write('some body');
+ socket.close();
+ });
+ });
+ }, onError: (e) {
+ asyncEnd();
+ });
+}
+
+
void main() {
testListenOn();
+ testHttpServerZone();
+ testHttpServerZoneError();
}
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | tests/standalone/io/raw_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698