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

Unified Diff: pkg/http/test/http_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/client_test.dart ('k') | pkg/http/test/mock_client_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/test/http_test.dart
diff --git a/pkg/http/test/http_test.dart b/pkg/http/test/http_test.dart
index d9ffa7d4ac0bd85f59f975600632d79c2c77a2f9..64e06d31a85cc9d9c7ac8a6df6cd2bf9afdd8c27 100644
--- a/pkg/http/test/http_test.dart
+++ b/pkg/http/test/http_test.dart
@@ -16,17 +16,17 @@ main() {
tearDown(stopServer);
test('head', () {
- expect(http.head(serverUrl).transform((response) {
+ expect(http.head(serverUrl).then(expectAsync1((response) {
expect(response.statusCode, equals(200));
expect(response.body, equals(''));
- }), completes);
+ })), completes);
});
test('get', () {
expect(http.get(serverUrl, headers: {
'X-Random-Header': 'Value',
'X-Other-Header': 'Other Value'
- }).transform((response) {
+ }).then(expectAsync1((response) {
expect(response.statusCode, equals(200));
expect(response.body, parse(equals({
'method': 'GET',
@@ -37,7 +37,7 @@ main() {
'x-other-header': ['Other Value']
},
})));
- }), completes);
+ })), completes);
});
test('post', () {
@@ -47,7 +47,7 @@ main() {
}, fields: {
'some-field': 'value',
'other-field': 'other value'
- }).transform((response) {
+ }).then(expectAsync1((response) {
expect(response.statusCode, equals(200));
expect(response.body, parse(equals({
'method': 'POST',
@@ -62,7 +62,7 @@ main() {
},
'body': 'some-field=value&other-field=other+value'
})));
- }), completes);
+ })), completes);
});
test('post without fields', () {
@@ -70,7 +70,7 @@ main() {
'X-Random-Header': 'Value',
'X-Other-Header': 'Other Value',
'Content-Type': 'text/plain'
- }).transform((response) {
+ }).then(expectAsync1((response) {
expect(response.statusCode, equals(200));
expect(response.body, parse(equals({
'method': 'POST',
@@ -82,7 +82,7 @@ main() {
'x-other-header': ['Other Value']
}
})));
- }), completes);
+ })), completes);
});
test('put', () {
@@ -92,7 +92,7 @@ main() {
}, fields: {
'some-field': 'value',
'other-field': 'other value'
- }).transform((response) {
+ }).then(expectAsync1((response) {
expect(response.statusCode, equals(200));
expect(response.body, parse(equals({
'method': 'PUT',
@@ -107,7 +107,7 @@ main() {
},
'body': 'some-field=value&other-field=other+value'
})));
- }), completes);
+ })), completes);
});
test('put without fields', () {
@@ -115,7 +115,7 @@ main() {
'X-Random-Header': 'Value',
'X-Other-Header': 'Other Value',
'Content-Type': 'text/plain'
- }).transform((response) {
+ }).then(expectAsync1((response) {
expect(response.statusCode, equals(200));
expect(response.body, parse(equals({
'method': 'PUT',
@@ -127,14 +127,14 @@ main() {
'x-other-header': ['Other Value']
}
})));
- }), completes);
+ })), completes);
});
test('delete', () {
expect(http.delete(serverUrl, headers: {
'X-Random-Header': 'Value',
'X-Other-Header': 'Other Value'
- }).transform((response) {
+ }).then(expectAsync1((response) {
expect(response.statusCode, equals(200));
expect(response.body, parse(equals({
'method': 'DELETE',
@@ -145,14 +145,14 @@ main() {
'x-other-header': ['Other Value']
}
})));
- }), completes);
+ })), completes);
});
test('read', () {
expect(http.read(serverUrl, headers: {
'X-Random-Header': 'Value',
'X-Other-Header': 'Other Value'
- }), completion(parse(equals({
+ }).then(expectAsync1((val) => val)), completion(parse(equals({
'method': 'GET',
'path': '/',
'headers': {
@@ -162,16 +162,17 @@ main() {
},
}))));
});
-
+
test('read throws an error for a 4** status code', () {
- expect(http.read(serverUrl.resolve('/error')), throwsHttpException);
+ expect(http.read(serverUrl.resolve('/error')).then((expectAsync1(x) => x)),
+ throwsHttpException);
});
-
+
test('readBytes', () {
var future = http.readBytes(serverUrl, headers: {
'X-Random-Header': 'Value',
'X-Other-Header': 'Other Value'
- }).transform((bytes) => new String.fromCharCodes(bytes));
+ }).then(expectAsync1((bytes) => new String.fromCharCodes(bytes)));
expect(future, completion(parse(equals({
'method': 'GET',
@@ -185,7 +186,8 @@ main() {
});
test('readBytes throws an error for a 4** status code', () {
- expect(http.readBytes(serverUrl.resolve('/error')), throwsHttpException);
+ expect(http.readBytes(serverUrl.resolve('/error')).then((expectAsync1(x) => x)),
+ throwsHttpException);
});
});
}
« no previous file with comments | « pkg/http/test/client_test.dart ('k') | pkg/http/test/mock_client_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698