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

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

Issue 10919061: Fix flaky http test and reenable on buildbots. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_basic_test.dart
diff --git a/tests/standalone/io/http_basic_test.dart b/tests/standalone/io/http_basic_test.dart
index bae462ca298a44399b5d411de7b26f26be6d0f2b..c54d9b7aaf350d61d65e42e4ebdd76611793b5df 100644
--- a/tests/standalone/io/http_basic_test.dart
+++ b/tests/standalone/io/http_basic_test.dart
@@ -142,21 +142,10 @@ class TestServer {
void init() {
// Setup request handlers.
_requestHandlers = new Map();
- _requestHandlers["/echo"] = (HttpRequest request, HttpResponse response) {
- _echoHandler(request, response);
- };
- _requestHandlers["/0123456789"] =
- (HttpRequest request, HttpResponse response) {
- _zeroToTenHandler(request, response);
- };
- _requestHandlers["/reasonformoving"] =
- (HttpRequest request, HttpResponse response) {
- _reasonForMovingHandler(request, response);
- };
- _requestHandlers["/host"] =
- (HttpRequest request, HttpResponse response) {
- _hostHandler(request, response);
- };
+ _requestHandlers["/echo"] = _echoHandler;
+ _requestHandlers["/0123456789"] = _zeroToTenHandler;
+ _requestHandlers["/reasonformoving"] = _reasonForMovingHandler;
+ _requestHandlers["/host"] = _hostHandler;
}
void dispatch(var message, SendPort replyTo) {
@@ -164,9 +153,7 @@ class TestServer {
_server = new HttpServer();
try {
_server.listen("127.0.0.1", 0);
- _server.defaultRequestHandler = (HttpRequest req, HttpResponse rsp) {
- _requestReceivedHandler(req, rsp);
- };
+ _server.defaultRequestHandler = _requestReceivedHandler;
replyTo.send(new TestServerStatus.started(_server.port), null);
} catch (e) {
replyTo.send(new TestServerStatus.error(), null);
@@ -281,8 +268,14 @@ void test404() {
httpClient.get("127.0.0.1", port, "/thisisnotfound");
conn.onResponse = (HttpClientResponse response) {
Expect.equals(HttpStatus.NOT_FOUND, response.statusCode);
- httpClient.shutdown();
- testServerMain.shutdown();
+ var body = new StringBuffer();
+ var stream = response.inputStream;
+ stream.onData = () => body.add(new String.fromCharCodes(stream.read()));
+ stream.onClosed = () {
+ Expect.equals("Page not found", body.toString());
+ httpClient.shutdown();
+ testServerMain.shutdown();
+ };
};
});
testServerMain.start();
@@ -298,8 +291,12 @@ void testReasonPhrase() {
conn.onResponse = (HttpClientResponse response) {
Expect.equals(HttpStatus.MOVED_PERMANENTLY, response.statusCode);
Expect.equals("Don't come looking here any more", response.reasonPhrase);
- httpClient.shutdown();
- testServerMain.shutdown();
+ var stream = response.inputStream;
+ stream.onData = () => Expect.fail("No data expected");
+ stream.onClosed = () {
+ httpClient.shutdown();
+ testServerMain.shutdown();
+ };
};
});
testServerMain.start();
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698