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

Side by Side Diff: utils/tests/pub/pub_lish_test.dart

Issue 11478004: Stop working around issue 7044. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library pub_lish_test; 5 library pub_lish_test;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:json'; 8 import 'dart:json';
9 9
10 import 'test_pub.dart'; 10 import 'test_pub.dart';
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 run(); 277 run();
278 }); 278 });
279 279
280 test('cloud storage upload provides an error', () { 280 test('cloud storage upload provides an error', () {
281 var server = new ScheduledServer(); 281 var server = new ScheduledServer();
282 credentialsFile(server, 'access token').scheduleCreate(); 282 credentialsFile(server, 'access token').scheduleCreate();
283 var pub = startPubLish(server); 283 var pub = startPubLish(server);
284 handleUploadForm(server); 284 handleUploadForm(server);
285 285
286 server.handle('POST', '/upload', (request, response) { 286 server.handle('POST', '/upload', (request, response) {
287 // TODO(rnystrom): HTTP requires that you don't start sending a response 287 response.statusCode = 400;
288 // until the request has been completely sent, but dart:io doesn't 288 response.headers.contentType = new ContentType('application', 'xml');
289 // ensure that (#7044). Workaround it by manually consuming the entire 289 response.outputStream.writeString('<Error><Message>Your request sucked.'
290 // input stream before we start responding. If we don't do this, curl 290 '</Message></Error>');
291 // will choke on this on Mac and Windows. 291 response.outputStream.close();
292 return consumeInputStream(request.inputStream).transform((_) {
293 response.statusCode = 400;
294 response.headers.contentType = new ContentType('application', 'xml');
295 response.outputStream.writeString('<Error><Message>Your request sucked.'
296 '</Message></Error>');
297 response.outputStream.close();
298 });
299 }); 292 });
300 293
301 // TODO(nweiz): This should use the server's error message once the client 294 // TODO(nweiz): This should use the server's error message once the client
302 // can parse the XML. 295 // can parse the XML.
303 expectLater(pub.nextErrLine(), equals('Failed to upload the package.')); 296 expectLater(pub.nextErrLine(), equals('Failed to upload the package.'));
304 pub.shouldExit(1); 297 pub.shouldExit(1);
305 298
306 run(); 299 run();
307 }); 300 });
308 301
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 return closeHttpResponse(request, response); 390 return closeHttpResponse(request, response);
398 }); 391 });
399 392
400 expectLater(pub.nextErrLine(), equals('Invalid server response:')); 393 expectLater(pub.nextErrLine(), equals('Invalid server response:'));
401 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); 394 expectLater(pub.nextErrLine(), equals(JSON.stringify(body)));
402 pub.shouldExit(1); 395 pub.shouldExit(1);
403 396
404 run(); 397 run();
405 }); 398 });
406 } 399 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698