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

Side by Side Diff: services/dart/dart_apptests/lib/src/io_internet_address_apptests.dart

Issue 1545483003: Dart: Reorganize files (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix build file Created 4 years, 12 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 library io_internet_address_apptests;
6
7 import 'dart:async';
8 import 'dart:io';
9
10 import 'package:mojo_apptest/apptest.dart';
11 import 'package:mojo/application.dart';
12 import 'package:mojo/bindings.dart';
13 import 'package:mojo/core.dart';
14
15 tests(Application application, String url) {
16 group('InternetAddress Apptests', () {
17 test('Parse IPv4', () async {
18 var localhost = new InternetAddress('127.0.0.1');
19 expect(localhost, equals(InternetAddress.LOOPBACK_IP_V4));
20 });
21 test('Parse IPv6', () async {
22 var localhost = new InternetAddress('0:0:0:0:0:0:0:1');
23 expect(localhost, equals(InternetAddress.LOOPBACK_IP_V6));
24 });
25 test('Reverse', () async {
26 var result = await InternetAddress.LOOPBACK_IP_V4.reverse();
27 expect(result.host, equals('localhost'));
28 });
29 test('Lookup IPv4', () async {
30 var result =
31 await InternetAddress.lookup('localhost',
32 type:InternetAddressType.IP_V4);
33 expect(result.length, greaterThan(0));
34 expect(result[0], equals(InternetAddress.LOOPBACK_IP_V4));
35 });
36 test('Lookup IPv6', () async {
37 try {
38 var result =
39 await InternetAddress.lookup('localhost',
40 type:InternetAddressType.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 }
46 });
47 test('Lookup ANY', () async {
48 var result =
49 await InternetAddress.lookup('localhost',
50 type:InternetAddressType.ANY);
51 expect(result.length, greaterThan(0));
52 });
53 test('Lookup failure', () async {
54 var result;
55 var exceptionCaught = false;
56 try {
57 result = await InternetAddress.lookup('local.7778888');
58 // Not hit.
59 expect(true, isFalse);
60 } on OSError catch(e) {
61 exceptionCaught = true;
62 expect(e.errorCode, isNot(equals(0)));
63 }
64 expect(exceptionCaught, isTrue);
65 });
66 });
67 }
OLDNEW
« no previous file with comments | « services/dart/dart_apptests/lib/src/io_http_apptests.dart ('k') | services/dart/dart_apptests/lib/src/pingpong_apptests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698