Index: tests/standalone/src/HttpTest.dart |
diff --git a/tests/standalone/src/HttpTest.dart b/tests/standalone/src/HttpTest.dart |
index df2c2c38385b2ea12ad5fd42d7364acab85d83f6..bd41dc0b24b6448fa5fe6bab47d9e6fc256f44ff 100644 |
--- a/tests/standalone/src/HttpTest.dart |
+++ b/tests/standalone/src/HttpTest.dart |
@@ -102,8 +102,8 @@ class TestServer extends Isolate { |
// Echo the request content back to the response. |
void _zeroToTenHandler(HttpRequest request, HttpResponse response) { |
Expect.equals("GET", request.method); |
- request.inputStream.dataHandler = () {}; |
- request.inputStream.closeHandler = () { |
+ request.inputStream.onData = () {}; |
+ request.inputStream.onClose = () { |
response.writeString("01234567890"); |
response.outputStream.close(); |
}; |
@@ -133,7 +133,7 @@ class TestServer extends Isolate { |
_server = new HttpServer(); |
try { |
_server.listen("127.0.0.1", 0); |
- _server.requestHandler = (HttpRequest req, HttpResponse rsp) { |
+ _server.onRequest = (HttpRequest req, HttpResponse rsp) { |
_requestReceivedHandler(req, rsp); |
}; |
replyTo.send(new TestServerStatus.started(_server.port), null); |
@@ -180,12 +180,12 @@ void testGET() { |
HttpClient httpClient = new HttpClient(); |
HttpClientConnection conn = |
httpClient.get("127.0.0.1", port, "/0123456789"); |
- conn.responseHandler = (HttpClientResponse response) { |
+ conn.onResponse = (HttpClientResponse response) { |
Expect.equals(HttpStatus.OK, response.statusCode); |
StringInputStream stream = new StringInputStream(response.inputStream); |
StringBuffer body = new StringBuffer(); |
- stream.dataHandler = () => body.add(stream.read()); |
- stream.closeHandler = () { |
+ stream.onData = () => body.add(stream.read()); |
+ stream.onClose = () { |
Expect.equals("01234567890", body.toString()); |
httpClient.shutdown(); |
testServerMain.shutdown(); |
@@ -208,7 +208,7 @@ void testPOST(bool chunkedEncoding) { |
void sendRequest() { |
HttpClientConnection conn = |
httpClient.post("127.0.0.1", port, "/echo"); |
- conn.requestHandler = (HttpClientRequest request) { |
+ conn.onRequest = (HttpClientRequest request) { |
if (chunkedEncoding) { |
request.writeString(data.substring(0, 10)); |
request.writeString(data.substring(10, data.length)); |
@@ -218,12 +218,12 @@ void testPOST(bool chunkedEncoding) { |
} |
request.outputStream.close(); |
}; |
- conn.responseHandler = (HttpClientResponse response) { |
+ conn.onResponse = (HttpClientResponse response) { |
Expect.equals(HttpStatus.OK, response.statusCode); |
StringInputStream stream = new StringInputStream(response.inputStream); |
StringBuffer body = new StringBuffer(); |
- stream.dataHandler = () => body.add(stream.read()); |
- stream.closeHandler = () { |
+ stream.onData = () => body.add(stream.read()); |
+ stream.onClose = () { |
Expect.equals(data, body.toString()); |
count++; |
if (count < kMessageCount) { |
@@ -259,7 +259,7 @@ void testReadInto(bool chunkedEncoding) { |
void sendRequest() { |
HttpClientConnection conn = |
httpClient.post("127.0.0.1", port, "/echo"); |
- conn.requestHandler = (HttpClientRequest request) { |
+ conn.onRequest = (HttpClientRequest request) { |
if (chunkedEncoding) { |
request.writeString(data.substring(0, 10)); |
request.writeString(data.substring(10, data.length)); |
@@ -269,16 +269,16 @@ void testReadInto(bool chunkedEncoding) { |
} |
request.outputStream.close(); |
}; |
- conn.responseHandler = (HttpClientResponse response) { |
+ conn.onResponse = (HttpClientResponse response) { |
Expect.equals(HttpStatus.OK, response.statusCode); |
InputStream stream = response.inputStream; |
List<int> body = new List<int>(); |
- stream.dataHandler = () { |
+ stream.onData = () { |
List tmp = new List(3); |
int bytes = stream.readInto(tmp); |
body.addAll(tmp.getRange(0, bytes)); |
}; |
- stream.closeHandler = () { |
+ stream.onClose = () { |
Expect.equals(data, new String.fromCharCodes(body)); |
count++; |
if (count < kMessageCount) { |
@@ -314,7 +314,7 @@ void testReadShort(bool chunkedEncoding) { |
void sendRequest() { |
HttpClientConnection conn = |
httpClient.post("127.0.0.1", port, "/echo"); |
- conn.requestHandler = (HttpClientRequest request) { |
+ conn.onRequest = (HttpClientRequest request) { |
if (chunkedEncoding) { |
request.writeString(data.substring(0, 10)); |
request.writeString(data.substring(10, data.length)); |
@@ -324,15 +324,15 @@ void testReadShort(bool chunkedEncoding) { |
} |
request.outputStream.close(); |
}; |
- conn.responseHandler = (HttpClientResponse response) { |
+ conn.onResponse = (HttpClientResponse response) { |
Expect.equals(HttpStatus.OK, response.statusCode); |
InputStream stream = response.inputStream; |
List<int> body = new List<int>(); |
- stream.dataHandler = () { |
+ stream.onData = () { |
List tmp = stream.read(2); |
body.addAll(tmp); |
}; |
- stream.closeHandler = () { |
+ stream.onClose = () { |
Expect.equals(data, new String.fromCharCodes(body)); |
count++; |
if (count < kMessageCount) { |
@@ -362,7 +362,7 @@ void test404() { |
HttpClient httpClient = new HttpClient(); |
HttpClientConnection conn = |
httpClient.get("127.0.0.1", port, "/thisisnotfound"); |
- conn.responseHandler = (HttpClientResponse response) { |
+ conn.onResponse = (HttpClientResponse response) { |
Expect.equals(HttpStatus.NOT_FOUND, response.statusCode); |
httpClient.shutdown(); |
testServerMain.shutdown(); |