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

Unified Diff: tests/standalone/src/Regress-1925.dart

Issue 9568006: Missing handling of default arguments in socket stream readInto (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/src/EchoServerTest.dart ('k') | tests/standalone/src/SocketManyConnectionsTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/Regress-1925.dart
diff --git a/tests/standalone/src/Regress-1925.dart b/tests/standalone/src/Regress-1925.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bbcf31e873b6467178135f14e8c17f5a84f12033
--- /dev/null
+++ b/tests/standalone/src/Regress-1925.dart
@@ -0,0 +1,70 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// Regression test for http://code.google.com/p/dart/issues/detail?id=1925.
+//
+// VMOptions=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+#import("dart:io");
+#import("dart:isolate");
+#source("TestingServer.dart");
+
+final CONNECTIONS = 200;
+
+class Regress1925TestServer extends TestingServer {
+
+ void onConnection(Socket socket) {
+ socket.onError = () => Expect.fail("Server socket error");
+ socket.inputStream.onClosed = () => socket.outputStream.close();
+ socket.inputStream.onData = () {
+ var buffer = new List(1);
+ var read = socket.inputStream.readInto(buffer);
+ Expect.equals(1, read);
+ socket.outputStream.writeFrom(buffer, 0, read);
+ };
+ }
+
+ int _connections = 0;
+}
+
+
+class Regress1925Test extends TestingServerTest {
+ Regress1925Test.start() : super.start(new Regress1925TestServer());
+
+ void run() {
+
+ void onConnect() {
+ _connections++;
+ if (_connections == CONNECTIONS) {
+ for (int i = 0; i < CONNECTIONS; i++) {
+ _sockets[i].close();
+ }
+ shutdown();
+ }
+ }
+
+ var count = 0;
+ var buffer = new List(5);
+ Socket socket = new Socket(TestingServer.HOST, _port);
+ socket.onConnect = () {
+ socket.outputStream.write("12345".charCodes());
+ socket.outputStream.close();
+ socket.inputStream.onData = () {
+ count += socket.inputStream.readInto(buffer, count);
+ };
+ socket.inputStream.onClosed = () {
+ Expect.equals(5, count);
+ shutdown();
+ };
+ socket.inputStream.onError = () => Expect.fail("Socket error");
+ };
+ }
+}
+
+main() {
+ Regress1925Test test = new Regress1925Test.start();
+}
« no previous file with comments | « tests/standalone/src/EchoServerTest.dart ('k') | tests/standalone/src/SocketManyConnectionsTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698