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

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

Issue 14036017: Revert "Add new InternetAddress class with a static lookup function (including IPv6 results)." (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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:io';
6 import 'dart:isolate';
7
8 void testIPv6toIPv6() {
9 ServerSocket.bind("::0").then((server) {
10 server.listen((socket) {
11 socket.destroy();
12 server.close();
13 });
14 Socket.connect("::1", server.port).then((socket) {
15 socket.destroy();
16 });
17 });
18 }
19
20 void testIPv4toIPv6() {
21 ServerSocket.bind("::0").then((server) {
22 server.listen((socket) {
23 socket.destroy();
24 server.close();
25 });
26 Socket.connect("127.0.0.1", server.port).then((socket) {
27 socket.destroy();
28 });
29 });
30 }
31
32 void testIPv6toIPv4() {
33 ServerSocket.bind("127.0.0.1").then((server) {
34 server.listen((socket) {
35 throw "Unexpected socket";
36 });
37 Socket.connect("::1", server.port).catchError((e) {
38 server.close();
39 });
40 });
41 }
42
43 void testIPv4toIPv4() {
44 ServerSocket.bind("127.0.0.1").then((server) {
45 server.listen((socket) {
46 socket.destroy();
47 server.close();
48 });
49 Socket.connect("127.0.0.1", server.port).then((socket) {
50 socket.destroy();
51 });
52 });
53 }
54
55 void testIPv6Lookup() {
56 var port = new ReceivePort();
57 InternetAddress.lookup("::0").then((list) {
58 if (list.length < 0) throw "no address";
59 for (var entry in list) {
60 if (entry.type != InternetAddressType.IPv6) {
61 throw "Wrong IP type";
62 }
63 }
64 port.close();
65 });
66 }
67
68 void testIPv4Lookup() {
69 var port = new ReceivePort();
70 InternetAddress.lookup("127.0.0.1").then((list) {
71 if (list.length < 0) throw "no addresse";
72 for (var entry in list) {
73 if (entry.type != InternetAddressType.IPv4) {
74 throw "Wrong IP type";
75 }
76 }
77 port.close();
78 });
79 }
80
81 void main() {
82 testIPv6toIPv6();
83 testIPv4toIPv6();
84 testIPv6toIPv4();
85 testIPv4toIPv4();
86 testIPv6Lookup();
87 testIPv4Lookup();
88 }
OLDNEW
« no previous file with comments | « tests/standalone/io/secure_socket_test.dart ('k') | tests/standalone/io/socket_upgrade_to_secure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698