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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/http_test.dart ('k') | pkg/http/test/multipart_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/test/mock_client_test.dart
diff --git a/pkg/http/test/mock_client_test.dart b/pkg/http/test/mock_client_test.dart
index 2dab7befc26a5f267f062632c1c30f843f2ecf78..01581a8197cea2381ec4ad0f6272f72098c7b0a2 100644
--- a/pkg/http/test/mock_client_test.dart
+++ b/pkg/http/test/mock_client_test.dart
@@ -4,8 +4,9 @@
library mock_client_test;
+import 'dart:async';
import 'dart:io';
-import 'dart:json';
+import 'dart:json' as json;
import 'dart:uri';
import 'package:unittest/unittest.dart';
@@ -18,14 +19,14 @@ void main() {
test('handles a request', () {
var client = new MockClient((request) {
return new Future.immediate(new http.Response(
- JSON.stringify(request.bodyFields), 200,
+ json.stringify(request.bodyFields), 200,
request: request, headers: {'content-type': 'application/json'}));
});
expect(client.post("http://example.com/foo", fields: {
'field1': 'value1',
'field2': 'value2'
- }).transform((response) => response.body), completion(parse(equals({
+ }).then((response) => response.body), completion(parse(equals({
'field1': 'value1',
'field2': 'value2'
}))));
@@ -33,7 +34,7 @@ void main() {
test('handles a streamed request', () {
var client = new MockClient.streaming((request, bodyStream) {
- return consumeInputStream(bodyStream).transform((body) {
+ return consumeInputStream(bodyStream).then((body) {
var stream = new ListInputStream();
async.then((_) {
var bodyString = new String.fromCharCodes(body);
@@ -49,8 +50,8 @@ void main() {
var request = new http.Request("POST", uri);
request.body = "hello, world";
var future = client.send(request)
- .chain(http.Response.fromStream)
- .transform((response) => response.body);
+ .then(http.Response.fromStream)
+ .then((response) => response.body);
expect(future, completion(equals('Request body was "hello, world"')));
});
« no previous file with comments | « pkg/http/test/http_test.dart ('k') | pkg/http/test/multipart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698