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

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

Issue 311153003: Add Observatory test of io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | « tests/standalone/io/observatory.dart ('k') | tests/standalone/io/socket_exception_test.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) 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 // VMOptions= 5 // VMOptions=
6 // VMOptions=--short_socket_read 6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write 7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write 8 // VMOptions=--short_socket_read --short_socket_write
9 9
10 import "dart:async"; 10 import "dart:async";
11 import "dart:io"; 11 import "dart:io";
12 12
13 import "package:async_helper/async_helper.dart"; 13 import "package:async_helper/async_helper.dart";
14 import "package:expect/expect.dart"; 14 import "package:expect/expect.dart";
15 15
16 void testArguments() { 16 void testArguments() {
17 Expect.throws(() => RawServerSocket.bind("127.0.0.1", 65536)); 17 Expect.throws(() => RawServerSocket.bind("127.0.0.1", 65536));
18 Expect.throws(() => RawServerSocket.bind("127.0.0.1", -1)); 18 Expect.throws(() => RawServerSocket.bind("127.0.0.1", -1));
19 Expect.throws(() => RawServerSocket.bind("127.0.0.1", 0, backlog: -1)); 19 Expect.throws(() => RawServerSocket.bind("127.0.0.1", 0, backlog: -1));
20 } 20 }
21 21
22 void testSimpleBind() { 22 void testSimpleBind() {
23 asyncStart(); 23 asyncStart();
24 RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((s) { 24 RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((s) {
25 Expect.isTrue(s.port > 0); 25 Expect.isTrue(s.port > 0);
26 s.close();
26 asyncEnd(); 27 asyncEnd();
27 }); 28 });
28 } 29 }
29 30
30 void testInvalidBind() { 31 void testInvalidBind() {
31 // Bind to a unknown DNS name. 32 // Bind to a unknown DNS name.
32 asyncStart(); 33 asyncStart();
33 RawServerSocket.bind("ko.faar.__hest__", 0) 34 RawServerSocket.bind("ko.faar.__hest__", 0)
34 .then((_) { Expect.fail("Failure expected"); } ) 35 .then((_) { Expect.fail("Failure expected"); } )
35 .catchError((error) { 36 .catchError((error) {
(...skipping 13 matching lines...) Expand all
49 // Bind to a port already in use. 50 // Bind to a port already in use.
50 asyncStart(); 51 asyncStart();
51 RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0) 52 RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0)
52 .then((s) { 53 .then((s) {
53 RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, s.port) 54 RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, s.port)
54 .then((t) { 55 .then((t) {
55 Expect.fail("Multiple listens on same port"); 56 Expect.fail("Multiple listens on same port");
56 }) 57 })
57 .catchError((error) { 58 .catchError((error) {
58 Expect.isTrue(error is SocketException); 59 Expect.isTrue(error is SocketException);
60 s.close();
59 asyncEnd(); 61 asyncEnd();
60 }); 62 });
61 }); 63 });
62 } 64 }
63 65
64 void testSimpleConnect() { 66 void testSimpleConnect() {
65 asyncStart(); 67 asyncStart();
66 RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) { 68 RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
67 server.listen((socket) { socket.close(); }); 69 server.listen((socket) { socket.close(); });
68 RawSocket.connect("127.0.0.1", server.port).then((socket) { 70 RawSocket.connect("127.0.0.1", server.port).then((socket) {
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 testSimpleConnect(); 452 testSimpleConnect();
451 testServerListenAfterConnect(); 453 testServerListenAfterConnect();
452 testSimpleReadWrite(dropReads: false); 454 testSimpleReadWrite(dropReads: false);
453 testSimpleReadWrite(dropReads: true); 455 testSimpleReadWrite(dropReads: true);
454 testPauseServerSocket(); 456 testPauseServerSocket();
455 testPauseSocket(); 457 testPauseSocket();
456 testSocketZone(); 458 testSocketZone();
457 testSocketZoneError(); 459 testSocketZoneError();
458 asyncEnd(); 460 asyncEnd();
459 } 461 }
OLDNEW
« no previous file with comments | « tests/standalone/io/observatory.dart ('k') | tests/standalone/io/socket_exception_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698