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

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

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 Created 7 years, 10 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/utils.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 843cdabb40470a9b81149167352d323a3cd76f26..1f009b97e09da79f3d94be1beaf827d1e309a0d8 100644
--- a/pkg/http/test/request_test.dart
+++ b/pkg/http/test/request_test.dart
@@ -13,23 +13,24 @@ import 'utils.dart';
void main() {
test('.send', () {
- startServer();
-
- var request = new http.Request('POST', serverUrl);
- request.body = "hello";
-
- expect(request.send().then((response) {
- expect(response.statusCode, equals(200));
- return response.stream.bytesToString();
- }).whenComplete(stopServer), completion(parse(equals({
- 'method': 'POST',
- 'path': '/',
- 'headers': {
- 'content-type': ['text/plain; charset=UTF-8'],
- 'content-length': ['5']
- },
- 'body': 'hello'
- }))));
+ expect(startServer().then((_) {
+
+ var request = new http.Request('POST', serverUrl);
+ request.body = "hello";
+
+ expect(request.send().then((response) {
+ expect(response.statusCode, equals(200));
+ return response.stream.bytesToString();
+ }).whenComplete(stopServer), completion(parse(equals({
+ 'method': 'POST',
+ 'path': '/',
+ 'headers': {
+ 'content-type': ['text/plain; charset=UTF-8'],
+ 'content-length': ['5']
+ },
+ 'body': 'hello'
+ }))));
+ }), completes);
});
group('#contentLength', () {
@@ -183,47 +184,49 @@ void main() {
print("This test is known to be flaky, please ignore "
"(debug prints below added by sgjesse@)");
print("#followRedirects test starting server...");
- startServer();
- print("#followRedirects test server running");
-
- var request = new http.Request('POST', serverUrl.resolve('/redirect'))
- ..followRedirects = false;
- var future = request.send().then((response) {
- print("#followRedirects test response received");
- expect(response.statusCode, equals(302));
- });
- future.catchError((_) {}).then(expectAsync1((_) {
- print("#followRedirects test stopping server...");
- stopServer();
- print("#followRedirects test server stopped");
- }));
-
- expect(future, completes);
- print("#followRedirects test started");
+ expect(startServer().then((_) {
+ print("#followRedirects test server running");
+
+ var request = new http.Request('POST', serverUrl.resolve('/redirect'))
+ ..followRedirects = false;
+ var future = request.send().then((response) {
+ print("#followRedirects test response received");
+ expect(response.statusCode, equals(302));
+ });
+ expect(future.catchError((_) {}).then((_) {
+ print("#followRedirects test stopping server...");
+ stopServer();
+ print("#followRedirects test server stopped");
+ }), completes);
+
+ expect(future, completes);
+ print("#followRedirects test started");
+ }), completes);
});
test('#maxRedirects', () {
print("This test is known to be flaky, please ignore "
"(debug prints below added by sgjesse@)");
print("#maxRedirects test starting server...");
- startServer();
- print("#maxRedirects test server running");
-
- var request = new http.Request('POST', serverUrl.resolve('/loop?1'))
- ..maxRedirects = 2;
- var future = request.send().catchError((e) {
- print("#maxRedirects test exception received");
- expect(e.error, isRedirectLimitExceededException);
- expect(e.error.redirects.length, equals(2));
- });
- future.catchError((_) {}).then(expectAsync1((_) {
- print("#maxRedirects test stopping server...");
- stopServer();
- print("#maxRedirects test server stopped");
- }));
-
- expect(future, completes);
- print("#maxRedirects test started");
+ expect(startServer().then((_) {
+ print("#maxRedirects test server running");
+
+ var request = new http.Request('POST', serverUrl.resolve('/loop?1'))
+ ..maxRedirects = 2;
+ var future = request.send().catchError((e) {
+ print("#maxRedirects test exception received");
+ expect(e.error, isRedirectLimitExceededException);
+ expect(e.error.redirects.length, equals(2));
+ });
+ expect(future.catchError((_) {}).then((_) {
+ print("#maxRedirects test stopping server...");
+ stopServer();
+ print("#maxRedirects test server stopped");
+ }), completes);
+
+ expect(future, completes);
+ print("#maxRedirects test started");
+ }), completes);
});
group('content-type header', () {
« no previous file with comments | « pkg/http/test/http_test.dart ('k') | pkg/http/test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698