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

Side by Side Diff: tests/standalone/src/io/EchoServerStreamTest.dart

Issue 9699017: Start better error reporting for sockets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed bug Created 8 years, 9 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 | « runtime/bin/utils_win.cc ('k') | tests/standalone/src/io/EchoServerTest.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 // Echo server test program to test socket streams. 5 // Echo server test program to test socket streams.
6 // 6 //
7 // VMOptions= 7 // VMOptions=
8 // VMOptions=--short_socket_read 8 // VMOptions=--short_socket_read
9 // VMOptions=--short_socket_write 9 // VMOptions=--short_socket_write
10 // VMOptions=--short_socket_read --short_socket_write 10 // VMOptions=--short_socket_read --short_socket_write
(...skipping 17 matching lines...) Expand all
28 _buffer[i] = FIRSTCHAR + i; 28 _buffer[i] = FIRSTCHAR + i;
29 } 29 }
30 new EchoServer().spawn().then((SendPort port) { 30 new EchoServer().spawn().then((SendPort port) {
31 _sendPort = port; 31 _sendPort = port;
32 start(); 32 start();
33 }); 33 });
34 } 34 }
35 35
36 void sendData() { 36 void sendData() {
37 37
38 void errorHandler() { 38 void errorHandler(Exception e) {
39 Expect.fail("Socket error"); 39 Expect.fail("Socket error $e");
40 } 40 }
41 41
42 void connectHandler() { 42 void connectHandler() {
43 43
44 SocketOutputStream stream = _socket.outputStream; 44 SocketOutputStream stream = _socket.outputStream;
45 45
46 void dataSent() { 46 void dataSent() {
47 InputStream inputStream = _socket.inputStream; 47 InputStream inputStream = _socket.inputStream;
48 int offset = 0; 48 int offset = 0;
49 List<int> data; 49 List<int> data;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 for (int i = 0; i < offset; i++) { 154 for (int i = 0; i < offset; i++) {
155 Expect.equals(EchoServerGame.FIRSTCHAR + i, buffer[i]); 155 Expect.equals(EchoServerGame.FIRSTCHAR + i, buffer[i]);
156 } 156 }
157 if (offset == MSGSIZE) { 157 if (offset == MSGSIZE) {
158 outputStream.write(buffer); 158 outputStream.write(buffer);
159 outputStream.close(); 159 outputStream.close();
160 } 160 }
161 } 161 }
162 } 162 }
163 163
164 void errorHandler() { 164 void errorHandler(Exception e) {
165 Expect.fail("Socket error"); 165 Expect.fail("Socket error $e");
166 } 166 }
167 167
168 inputStream = connection.inputStream; 168 inputStream = connection.inputStream;
169 inputStream.onData = dataReceived; 169 inputStream.onData = dataReceived;
170 connection.onError = errorHandler; 170 connection.onError = errorHandler;
171 } 171 }
172 } 172 }
173 173
174 main() { 174 main() {
175 EchoServerGame echoServerGame = new EchoServerGame.start(); 175 EchoServerGame echoServerGame = new EchoServerGame.start();
176 } 176 }
OLDNEW
« no previous file with comments | « runtime/bin/utils_win.cc ('k') | tests/standalone/src/io/EchoServerTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698