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

Unified Diff: tests/standalone/io/http_server_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/http_server_test.dart
diff --git a/tests/standalone/io/http_server_test.dart b/tests/standalone/io/http_server_test.dart
index afdd819cbee4cf71323a88ca127ae7bf5e940f1e..b470b4d6ec0aa7a36799fae838500d39a3023bfb 100644
--- a/tests/standalone/io/http_server_test.dart
+++ b/tests/standalone/io/http_server_test.dart
@@ -2,20 +2,19 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-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";
void testListenOn() {
ServerSocket socket;
HttpServer server;
void test(void onDone()) {
-
Expect.equals(socket.port, server.port);
- ReceivePort clientPort = new ReceivePort();
HttpClient client = new HttpClient();
client.get("127.0.0.1", socket.port, "/")
.then((request) {
@@ -26,7 +25,6 @@ void testListenOn() {
(_) {},
onDone: () {
client.close();
- clientPort.close();
onDone();
});
})
@@ -39,17 +37,14 @@ void testListenOn() {
}
// Test two connection after each other.
+ asyncStart();
ServerSocket.bind("127.0.0.1", 0).then((s) {
socket = s;
server = new HttpServer.listenOn(socket);
- ReceivePort serverPort = new ReceivePort();
server.listen((HttpRequest request) {
request.listen(
(_) {},
- onDone: () {
- request.response.close();
- serverPort.close();
- });
+ onDone: () => request.response.close());
});
test(() {
@@ -57,6 +52,7 @@ void testListenOn() {
server.close();
Expect.throws(() => server.port);
socket.close();
+ asyncEnd();
});
});
});
« no previous file with comments | « tests/standalone/io/http_reuse_server_port_test.dart ('k') | tests/standalone/io/https_client_certificate_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698