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

Side by Side Diff: pkg/http/test/response_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « pkg/http/test/request_test.dart ('k') | pkg/http/test/utils.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 response_test; 5 library response_test;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'package:http/http.dart' as http; 10 import 'package:http/http.dart' as http;
(...skipping 28 matching lines...) Expand all
39 39
40 // TODO(nweiz): test that this respects the inferred encoding when issue 40 // TODO(nweiz): test that this respects the inferred encoding when issue
41 // 6284 is fixed. 41 // 6284 is fixed.
42 }); 42 });
43 43
44 group('.fromStream()', () { 44 group('.fromStream()', () {
45 test('sets body', () { 45 test('sets body', () {
46 var stream = new ListInputStream(); 46 var stream = new ListInputStream();
47 var streamResponse = new http.StreamedResponse(stream, 200, 13); 47 var streamResponse = new http.StreamedResponse(stream, 200, 13);
48 var future = http.Response.fromStream(streamResponse) 48 var future = http.Response.fromStream(streamResponse)
49 .transform((response) => response.body); 49 .then((response) => response.body);
50 expect(future, completion(equals("Hello, world!"))); 50 expect(future, completion(equals("Hello, world!")));
51 51
52 stream.write([72, 101, 108, 108, 111, 44, 32]); 52 stream.write([72, 101, 108, 108, 111, 44, 32]);
53 stream.write([119, 111, 114, 108, 100, 33]); 53 stream.write([119, 111, 114, 108, 100, 33]);
54 stream.markEndOfStream(); 54 stream.markEndOfStream();
55 }); 55 });
56 56
57 test('sets bodyBytes', () { 57 test('sets bodyBytes', () {
58 var stream = new ListInputStream(); 58 var stream = new ListInputStream();
59 var streamResponse = new http.StreamedResponse(stream, 200, 5); 59 var streamResponse = new http.StreamedResponse(stream, 200, 5);
60 var future = http.Response.fromStream(streamResponse) 60 var future = http.Response.fromStream(streamResponse)
61 .transform((response) => response.bodyBytes); 61 .then((response) => response.bodyBytes);
62 expect(future, completion(equals([104, 101, 108, 108, 111]))); 62 expect(future, completion(equals([104, 101, 108, 108, 111])));
63 63
64 stream.write([104, 101, 108, 108, 111]); 64 stream.write([104, 101, 108, 108, 111]);
65 stream.markEndOfStream(); 65 stream.markEndOfStream();
66 }); 66 });
67 }); 67 });
68 } 68 }
OLDNEW
« no previous file with comments | « pkg/http/test/request_test.dart ('k') | pkg/http/test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698