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

Unified Diff: utils/tests/pub/pub_lish_test.dart

Issue 11464015: Revert "Stop working around issue 6984." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Base files Created 8 years 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 | « utils/tests/pub/oauth2_test.dart ('k') | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/pub_lish_test.dart
diff --git a/utils/tests/pub/pub_lish_test.dart b/utils/tests/pub/pub_lish_test.dart
index 36ef02039ae7e839489eeed79bb27d9e2365aa9f..b2b165555187083beb1b63a96c6a346ec5a49a3c 100644
--- a/utils/tests/pub/pub_lish_test.dart
+++ b/utils/tests/pub/pub_lish_test.dart
@@ -13,7 +13,7 @@ import '../../pub/io.dart';
void handleUploadForm(ScheduledServer server, [Map body]) {
server.handle('GET', '/packages/versions/new.json', (request, response) {
- return server.url.transform((url) {
+ return server.url.chain((url) {
expect(request.headers.value('authorization'),
equals('Bearer access token'));
@@ -29,7 +29,7 @@ void handleUploadForm(ScheduledServer server, [Map body]) {
response.headers.contentType = new ContentType("application", "json");
response.outputStream.writeString(JSON.stringify(body));
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
});
}
@@ -38,10 +38,10 @@ void handleUpload(ScheduledServer server) {
server.handle('POST', '/upload', (request, response) {
// TODO(nweiz): Once a multipart/form-data parser in Dart exists, validate
// that the request body is correctly formatted. See issue 6952.
- return server.url.transform((url) {
+ return server.url.chain((url) {
response.statusCode = 302;
response.headers.set('location', url.resolve('/create').toString());
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
});
}
@@ -60,7 +60,7 @@ main() {
response.outputStream.writeString(JSON.stringify({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
expectLater(pub.nextLine(), equals('Package test_pkg 1.0.0 uploaded!'));
@@ -84,7 +84,7 @@ main() {
response.outputStream.writeString(JSON.stringify({
'error': {'message': 'your token sucks'}
}));
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
expectLater(pub.nextErrLine(), equals('OAuth2 authorization failed (your '
@@ -145,7 +145,7 @@ main() {
response.outputStream.writeString(JSON.stringify({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
pub.shouldExit(0);
@@ -165,7 +165,7 @@ main() {
response.outputStream.writeString(JSON.stringify({
'error': {'message': 'your request sucked'}
}));
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
expectLater(pub.nextErrLine(), equals('your request sucked'));
@@ -181,7 +181,7 @@ main() {
server.handle('GET', '/packages/versions/new.json', (request, response) {
response.outputStream.writeString('{not json');
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
expectLater(pub.nextErrLine(), equals('Invalid server response:'));
@@ -314,7 +314,7 @@ main() {
server.handle('POST', '/upload', (request, response) {
// don't set the location header
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
expectLater(pub.nextErrLine(), equals('Failed to upload the package.'));
@@ -335,7 +335,7 @@ main() {
response.outputStream.writeString(JSON.stringify({
'error': {'message': 'Your package was too boring.'}
}));
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
expectLater(pub.nextErrLine(), equals('Your package was too boring.'));
@@ -353,7 +353,7 @@ main() {
server.handle('GET', '/create', (request, response) {
response.outputStream.writeString('{not json');
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
expectLater(pub.nextErrLine(), equals('Invalid server response:'));
@@ -374,7 +374,7 @@ main() {
server.handle('GET', '/create', (request, response) {
response.statusCode = 400;
response.outputStream.writeString(JSON.stringify(body));
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
expectLater(pub.nextErrLine(), equals('Invalid server response:'));
@@ -394,7 +394,7 @@ main() {
var body = {'success': 'Your package was awesome.'};
server.handle('GET', '/create', (request, response) {
response.outputStream.writeString(JSON.stringify(body));
- response.outputStream.close();
+ return closeHttpResponse(request, response);
});
expectLater(pub.nextErrLine(), equals('Invalid server response:'));
« no previous file with comments | « utils/tests/pub/oauth2_test.dart ('k') | utils/tests/pub/test_pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698