| OLD | NEW |
| 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
| 7 | 7 |
| 8 const ANY = InternetAddressType.ANY; | 8 const ANY = InternetAddressType.ANY; |
| 9 | 9 |
| 10 void testIPv6toIPv6() { | 10 void testIPv6toIPv6() { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 socket.destroy(); | 60 socket.destroy(); |
| 61 }); | 61 }); |
| 62 }); | 62 }); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void testIPv6Lookup() { | 65 void testIPv6Lookup() { |
| 66 var port = new ReceivePort(); | 66 var port = new ReceivePort(); |
| 67 InternetAddress.lookup("::0", type: ANY).then((list) { | 67 InternetAddress.lookup("::0", type: ANY).then((list) { |
| 68 if (list.length < 0) throw "no address"; | 68 if (list.length < 0) throw "no address"; |
| 69 for (var entry in list) { | 69 for (var entry in list) { |
| 70 if (entry.type != InternetAddressType.IPv6) { | 70 if (entry.type != InternetAddressType.IP_V6) { |
| 71 throw "Wrong IP type"; | 71 throw "Wrong IP type"; |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 port.close(); | 74 port.close(); |
| 75 }); | 75 }); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void testIPv4Lookup() { | 78 void testIPv4Lookup() { |
| 79 var port = new ReceivePort(); | 79 var port = new ReceivePort(); |
| 80 InternetAddress.lookup("127.0.0.1").then((list) { | 80 InternetAddress.lookup("127.0.0.1").then((list) { |
| 81 if (list.length < 0) throw "no addresse"; | 81 if (list.length < 0) throw "no addresse"; |
| 82 for (var entry in list) { | 82 for (var entry in list) { |
| 83 if (entry.type != InternetAddressType.IPv4) { | 83 if (entry.type != InternetAddressType.IP_V4) { |
| 84 throw "Wrong IP type"; | 84 throw "Wrong IP type"; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 port.close(); | 87 port.close(); |
| 88 }); | 88 }); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void main() { | 91 void main() { |
| 92 testIPv6toIPv6(); | 92 testIPv6toIPv6(); |
| 93 testIPv4toIPv6(); | 93 testIPv4toIPv6(); |
| 94 testIPv6toIPv4(); | 94 testIPv6toIPv4(); |
| 95 testIPv4toIPv4(); | 95 testIPv4toIPv4(); |
| 96 testIPv6Lookup(); | 96 testIPv6Lookup(); |
| 97 testIPv4Lookup(); | 97 testIPv4Lookup(); |
| 98 } | 98 } |
| OLD | NEW |