| OLD | NEW | 
|   1 // Copyright 2015 The Chromium Authors. All rights reserved. |   1 // Copyright 2015 The Chromium Authors. All rights reserved. | 
|   2 // Use of this source code is governed by a BSD-style license that can be |   2 // Use of this source code is governed by a BSD-style license that can be | 
|   3 // found in the LICENSE file. |   3 // found in the LICENSE file. | 
|   4  |   4  | 
|   5 library io_internet_address_apptests; |   5 library io_internet_address_apptests; | 
|   6  |   6  | 
|   7 import 'dart:async'; |   7 import 'dart:async'; | 
|   8 import 'dart:io'; |   8 import 'dart:io'; | 
|   9  |   9  | 
|  10 import 'package:apptest/apptest.dart'; |  10 import 'package:apptest/apptest.dart'; | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
|  27       expect(result.host, equals('localhost')); |  27       expect(result.host, equals('localhost')); | 
|  28     }); |  28     }); | 
|  29     test('Lookup IPv4', () async { |  29     test('Lookup IPv4', () async { | 
|  30       var result = |  30       var result = | 
|  31           await InternetAddress.lookup('localhost', |  31           await InternetAddress.lookup('localhost', | 
|  32                                        type:InternetAddressType.IP_V4); |  32                                        type:InternetAddressType.IP_V4); | 
|  33       expect(result.length, greaterThan(0)); |  33       expect(result.length, greaterThan(0)); | 
|  34       expect(result[0], equals(InternetAddress.LOOPBACK_IP_V4)); |  34       expect(result[0], equals(InternetAddress.LOOPBACK_IP_V4)); | 
|  35     }); |  35     }); | 
|  36     test('Lookup IPv6', () async { |  36     test('Lookup IPv6', () async { | 
|  37       var result = |  37       try { | 
|  38           await InternetAddress.lookup('localhost', |  38         var result = | 
|  39                                        type:InternetAddressType.IP_V6); |  39             await InternetAddress.lookup('localhost', | 
|  40       expect(result.length, greaterThan(0)); |  40                                          type:InternetAddressType.IP_V6); | 
|  41       expect(result[0], equals(InternetAddress.LOOPBACK_IP_V6)); |  41         expect(result.length, greaterThan(0)); | 
 |  42         expect(result[0], equals(InternetAddress.LOOPBACK_IP_V6)); | 
 |  43       } on OSError catch (e) { | 
 |  44         expect(e.message, stringContainsInOrder(["ERR_NAME_NOT_RESOLVED"])); | 
 |  45       } | 
|  42     }); |  46     }); | 
|  43     test('Lookup ANY', () async { |  47     test('Lookup ANY', () async { | 
|  44       var result = |  48       var result = | 
|  45           await InternetAddress.lookup('localhost', |  49           await InternetAddress.lookup('localhost', | 
|  46                                        type:InternetAddressType.ANY); |  50                                        type:InternetAddressType.ANY); | 
|  47       expect(result.length, greaterThan(0)); |  51       expect(result.length, greaterThan(0)); | 
|  48     }); |  52     }); | 
|  49     test('Lookup failure', () async { |  53     test('Lookup failure', () async { | 
|  50       var result; |  54       var result; | 
|  51       var exceptionCaught = false; |  55       var exceptionCaught = false; | 
|  52       try { |  56       try { | 
|  53         result = await InternetAddress.lookup('local.7778888'); |  57         result = await InternetAddress.lookup('local.7778888'); | 
|  54         // Not hit. |  58         // Not hit. | 
|  55         expect(true, isFalse); |  59         expect(true, isFalse); | 
|  56       } on OSError catch(e) { |  60       } on OSError catch(e) { | 
|  57         exceptionCaught = true; |  61         exceptionCaught = true; | 
|  58         expect(e.errorCode, isNot(equals(0))); |  62         expect(e.errorCode, isNot(equals(0))); | 
|  59       } |  63       } | 
|  60       expect(exceptionCaught, isTrue); |  64       expect(exceptionCaught, isTrue); | 
|  61     }); |  65     }); | 
|  62   }); |  66   }); | 
|  63 } |  67 } | 
| OLD | NEW |