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

Unified Diff: tests/standalone/io/socket_invalid_arguments_test.dart

Issue 12089071: IO v2: Handle illegal arguments to socket writes (Closed) Base URL: http://dart.googlecode.com/svn/experimental/lib_v2_io/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 side-by-side diff with in-line comments
Download patch
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/socket_invalid_arguments_test.dart
===================================================================
--- tests/standalone/io/socket_invalid_arguments_test.dart (revision 17848)
+++ tests/standalone/io/socket_invalid_arguments_test.dart (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, 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.
@@ -24,28 +24,33 @@
}
testAdd(buffer) {
- var server = new ServerSocket("127.0.0.1", 0, 5);
- Socket.connect("127.0.0.1", server.port)
- .then((socket) {
- int errors = 0;
- socket.listen(
- (data) {},
- onError: (error) {
- errors++;
- },
- onDone: () {
- Expect.equals(1, errors);
- server.close();
- });
- socket.add(buffer);
- });
+ ServerSocket.bind("127.0.0.1", 0, 5).then((server) {
+ server.listen((socket) => socket.destroy());
+ Socket.connect("127.0.0.1", server.port)
+ .then((socket) {
Mads Ager (google) 2013/01/31 07:53:30 I would move this to the line above and remove som
Søren Gjesse 2013/01/31 12:12:01 Done.
+ int errors = 0;
+ socket.done.catchError((e) { errors++; });
+ socket.listen(
+ (_) { },
+ onError: (error) {
+ Expect.fail("Error on stream");
+ },
+ onDone: () {
+ Expect.equals(1, errors);
+ socket.destroy();
+ server.close();
+ });
+ socket.add(buffer);
+ });
+ });
}
testServerSocketCreation(address, port, backlog) {
var server;
var port = new ReceivePort();
try {
- server = new ServerSocket(address, port, backlog);
+ ServerSocket.bind(address, port, backlog)
+ .then((_) { Expect.fail("ServerSocket bound"); });
} catch (e) {
port.close();
}
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698