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

Unified Diff: pkg/http/test/request_test.dart

Issue 11825010: Update pkg/http to use the new async APIs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 years, 11 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 | « pkg/http/test/multipart_test.dart ('k') | pkg/http/test/response_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/test/request_test.dart
diff --git a/pkg/http/test/request_test.dart b/pkg/http/test/request_test.dart
index 14b596bb658257cd6e5e22d72df57182bc5ce267..843cdabb40470a9b81149167352d323a3cd76f26 100644
--- a/pkg/http/test/request_test.dart
+++ b/pkg/http/test/request_test.dart
@@ -17,15 +17,11 @@ void main() {
var request = new http.Request('POST', serverUrl);
request.body = "hello";
- var future = request.send().then((response) {
- expect(response.statusCode, equals(200));
- return consumeInputStream(response.stream);
- }).then((bytes) => new String.fromCharCodes(bytes));
- future.catchError((_) {}).then(expectAsync1((_) {
- stopServer();
- }));
- expect(future, completion(parse(equals({
+ expect(request.send().then((response) {
+ expect(response.statusCode, equals(200));
+ return response.stream.bytesToString();
+ }).whenComplete(stopServer), completion(parse(equals({
'method': 'POST',
'path': '/',
'headers': {
@@ -316,9 +312,7 @@ void main() {
test('returns a stream that emits the request body', () {
var request = new http.Request('POST', dummyUrl);
request.body = "Hello, world!";
- expect(
- consumeInputStream(request.finalize())
- .then((bytes) => new String.fromCharCodes(bytes)),
+ expect(request.finalize().bytesToString(),
completion(equals("Hello, world!")));
});
« no previous file with comments | « pkg/http/test/multipart_test.dart ('k') | pkg/http/test/response_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698