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

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

Issue 12021008: Use the dart:async Stream API thoroughly in Pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes 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 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 args: ['uploader', 'foo', 'email'], 42 args: ['uploader', 'foo', 'email'],
43 output: USAGE_STRING, exitCode: 64)); 43 output: USAGE_STRING, exitCode: 64));
44 }); 44 });
45 45
46 test('adds an uploader', () { 46 test('adds an uploader', () {
47 var server = new ScheduledServer(); 47 var server = new ScheduledServer();
48 credentialsFile(server, 'access token').scheduleCreate(); 48 credentialsFile(server, 'access token').scheduleCreate();
49 var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']); 49 var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
50 50
51 server.handle('POST', '/packages/pkg/uploaders.json', (request, response) { 51 server.handle('POST', '/packages/pkg/uploaders.json', (request, response) {
52 expect(consumeInputStream(request.inputStream).then((bodyBytes) { 52 expect(wrapInputStream(request.inputStream).toBytes().then((bodyBytes) {
53 expect(new String.fromCharCodes(bodyBytes), equals('email=email')); 53 expect(new String.fromCharCodes(bodyBytes), equals('email=email'));
54 54
55 response.headers.contentType = new ContentType("application", "json"); 55 response.headers.contentType = new ContentType("application", "json");
56 response.outputStream.writeString(json.stringify({ 56 response.outputStream.writeString(json.stringify({
57 'success': {'message': 'Good job!'} 57 'success': {'message': 'Good job!'}
58 })); 58 }));
59 response.outputStream.close(); 59 response.outputStream.close();
60 }), completes); 60 }), completes);
61 }); 61 });
62 62
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 response.outputStream.close(); 178 response.outputStream.close();
179 }); 179 });
180 180
181 expectLater(pub.nextErrLine(), equals('Invalid server response:')); 181 expectLater(pub.nextErrLine(), equals('Invalid server response:'));
182 expectLater(pub.nextErrLine(), equals('{not json')); 182 expectLater(pub.nextErrLine(), equals('{not json'));
183 pub.shouldExit(1); 183 pub.shouldExit(1);
184 184
185 run(); 185 run();
186 }); 186 });
187 } 187 }
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