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

Side by Side Diff: tests/standalone/io/http_client_request_test.dart

Issue 14150002: Remove StreamSink(replaced by EventSink) and make IOSink extend EventSink. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "dart:io"; 6 import "dart:io";
7 import "dart:isolate"; 7 import "dart:isolate";
8 import "dart:typeddata"; 8 import "dart:typeddata";
9 9
10 void testClientRequest(void handler(request)) { 10 void testClientRequest(void handler(request)) {
(...skipping 30 matching lines...) Expand all
41 }); 41 });
42 }); 42 });
43 return request.done; 43 return request.done;
44 }); 44 });
45 } 45 }
46 46
47 void testBadResponseAdd() { 47 void testBadResponseAdd() {
48 testClientRequest((request) { 48 testClientRequest((request) {
49 var port = new ReceivePort(); 49 var port = new ReceivePort();
50 request.contentLength = 0; 50 request.contentLength = 0;
51 request.writeBytes([0]); 51 request.add([0]);
52 request.close(); 52 request.close();
53 request.done.catchError((error) { 53 request.done.catchError((error) {
54 port.close(); 54 port.close();
55 }, test: (e) => e is HttpException); 55 }, test: (e) => e is HttpException);
56 return request.done; 56 return request.done;
57 }); 57 });
58 58
59 testClientRequest((request) { 59 testClientRequest((request) {
60 var port = new ReceivePort(); 60 var port = new ReceivePort();
61 request.contentLength = 5; 61 request.contentLength = 5;
62 request.writeBytes([0, 0, 0]); 62 request.add([0, 0, 0]);
63 request.writeBytes([0, 0, 0]); 63 request.add([0, 0, 0]);
64 request.close(); 64 request.close();
65 request.done.catchError((error) { 65 request.done.catchError((error) {
66 port.close(); 66 port.close();
67 }, test: (e) => e is HttpException); 67 }, test: (e) => e is HttpException);
68 return request.done; 68 return request.done;
69 }); 69 });
70 70
71 testClientRequest((request) { 71 testClientRequest((request) {
72 var port = new ReceivePort(); 72 var port = new ReceivePort();
73 request.contentLength = 0; 73 request.contentLength = 0;
74 request.writeBytes(new Uint8List(64 * 1024)); 74 request.add(new Uint8List(64 * 1024));
75 request.writeBytes(new Uint8List(64 * 1024)); 75 request.add(new Uint8List(64 * 1024));
76 request.writeBytes(new Uint8List(64 * 1024)); 76 request.add(new Uint8List(64 * 1024));
77 request.close(); 77 request.close();
78 request.done.catchError((error) { 78 request.done.catchError((error) {
79 port.close(); 79 port.close();
80 }, test: (e) => e is HttpException); 80 }, test: (e) => e is HttpException);
81 return request.done; 81 return request.done;
82 }); 82 });
83 } 83 }
84 84
85 void testBadResponseClose() { 85 void testBadResponseClose() {
86 testClientRequest((request) { 86 testClientRequest((request) {
87 var port = new ReceivePort(); 87 var port = new ReceivePort();
88 request.contentLength = 5; 88 request.contentLength = 5;
89 request.close(); 89 request.close();
90 request.done.catchError((error) { 90 request.done.catchError((error) {
91 port.close(); 91 port.close();
92 }, test: (e) => e is HttpException); 92 }, test: (e) => e is HttpException);
93 return request.done; 93 return request.done;
94 }); 94 });
95 95
96 testClientRequest((request) { 96 testClientRequest((request) {
97 var port = new ReceivePort(); 97 var port = new ReceivePort();
98 request.contentLength = 5; 98 request.contentLength = 5;
99 request.writeBytes([0]); 99 request.add([0]);
100 request.close(); 100 request.close();
101 request.done.catchError((error) { 101 request.done.catchError((error) {
102 port.close(); 102 port.close();
103 }, test: (e) => e is HttpException); 103 }, test: (e) => e is HttpException);
104 return request.done; 104 return request.done;
105 }); 105 });
106 } 106 }
107 107
108 void main() { 108 void main() {
109 testResponseDone(); 109 testResponseDone();
110 testBadResponseAdd(); 110 testBadResponseAdd();
111 testBadResponseClose(); 111 testBadResponseClose();
112 } 112 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_client_connect_test.dart ('k') | tests/standalone/io/http_close_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698