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

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

Issue 12086110: Use the dart:async Stream API thoroughly in Pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/tests/pub/oauth2_test.dart ('k') | utils/tests/pub/test_pub.dart » ('j') | 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_uploader_test; 5 library pub_uploader_test;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:json' as json; 8 import 'dart:json' as json;
9 9
10 import 'test_pub.dart'; 10 import 'test_pub.dart';
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 output: USAGE_STRING, exitCode: 64); 47 output: USAGE_STRING, exitCode: 64);
48 }); 48 });
49 }); 49 });
50 50
51 integration('adds an uploader', () { 51 integration('adds an uploader', () {
52 var server = new ScheduledServer(); 52 var server = new ScheduledServer();
53 credentialsFile(server, 'access token').scheduleCreate(); 53 credentialsFile(server, 'access token').scheduleCreate();
54 var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']); 54 var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
55 55
56 server.handle('POST', '/packages/pkg/uploaders.json', (request, response) { 56 server.handle('POST', '/packages/pkg/uploaders.json', (request, response) {
57 expect(consumeInputStream(request.inputStream).then((bodyBytes) { 57 expect(wrapInputStream(request.inputStream).toBytes().then((bodyBytes) {
58 expect(new String.fromCharCodes(bodyBytes), equals('email=email')); 58 expect(new String.fromCharCodes(bodyBytes), equals('email=email'));
59 59
60 response.headers.contentType = new ContentType("application", "json"); 60 response.headers.contentType = new ContentType("application", "json");
61 response.outputStream.writeString(json.stringify({ 61 response.outputStream.writeString(json.stringify({
62 'success': {'message': 'Good job!'} 62 'success': {'message': 'Good job!'}
63 })); 63 }));
64 response.outputStream.close(); 64 response.outputStream.close();
65 }), completes); 65 }), completes);
66 }); 66 });
67 67
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 (request, response) { 169 (request, response) {
170 response.outputStream.writeString("{not json"); 170 response.outputStream.writeString("{not json");
171 response.outputStream.close(); 171 response.outputStream.close();
172 }); 172 });
173 173
174 expectLater(pub.nextErrLine(), equals('Invalid server response:')); 174 expectLater(pub.nextErrLine(), equals('Invalid server response:'));
175 expectLater(pub.nextErrLine(), equals('{not json')); 175 expectLater(pub.nextErrLine(), equals('{not json'));
176 pub.shouldExit(1); 176 pub.shouldExit(1);
177 }); 177 });
178 } 178 }
OLDNEW
« 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