| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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:async'; | 5 import 'dart:async'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:io' as io; | 7 import 'dart:io' as io; |
| 8 import 'package:observatory/service_io.dart'; | 8 import 'package:observatory/service_io.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
| 11 | 11 |
| 12 /// Test that we correctly remove sockets that have been closed from the list | 12 /// Test that we correctly remove sockets that have been closed from the list |
| 13 /// of open sockets. We explictly leave one socket open. | 13 /// of open sockets. We explicitly leave one socket open. |
| 14 | 14 |
| 15 Future setup() async { | 15 Future setup() async { |
| 16 var serverSocket = await io.ServerSocket.bind('127.0.0.1', 0); | 16 var serverSocket = await io.ServerSocket.bind('127.0.0.1', 0); |
| 17 serverSocket.listen((s) { | 17 serverSocket.listen((s) { |
| 18 s.drain(); | 18 s.drain(); |
| 19 s.close(); | 19 s.close(); |
| 20 }); | 20 }); |
| 21 var socket = await io.Socket.connect("127.0.0.1", serverSocket.port); | 21 var socket = await io.Socket.connect("127.0.0.1", serverSocket.port); |
| 22 socket.write("foobar"); | 22 socket.write("foobar"); |
| 23 socket.write("foobar"); | 23 socket.write("foobar"); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 expect(server['lastRead'], equals(0)); | 65 expect(server['lastRead'], equals(0)); |
| 66 expect(server['totalRead'], equals(0)); | 66 expect(server['totalRead'], equals(0)); |
| 67 expect(server['lastWrite'], equals(0)); | 67 expect(server['lastWrite'], equals(0)); |
| 68 expect(server['totalWritten'], equals(0)); | 68 expect(server['totalWritten'], equals(0)); |
| 69 expect(server['writeCount'], equals(0)); | 69 expect(server['writeCount'], equals(0)); |
| 70 expect(server['readCount'], equals(0)); | 70 expect(server['readCount'], equals(0)); |
| 71 }, | 71 }, |
| 72 ]; | 72 ]; |
| 73 | 73 |
| 74 main(args) async => runIsolateTests(args, tests, testeeBefore: setup); | 74 main(args) async => runIsolateTests(args, tests, testeeBefore: setup); |
| OLD | NEW |