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'; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 expect(listening['id'], equals(result['data'][0]['id'])); | 58 expect(listening['id'], equals(result['data'][0]['id'])); |
59 expect(listening['listening'], isTrue); | 59 expect(listening['listening'], isTrue); |
60 expect(listening['socket_type'], equals('TCP')); | 60 expect(listening['socket_type'], equals('TCP')); |
61 expect(listening['port'], greaterThanOrEqualTo(1024)); | 61 expect(listening['port'], greaterThanOrEqualTo(1024)); |
62 expectTimeBiggerThanZero(listening['last_read']); | 62 expectTimeBiggerThanZero(listening['last_read']); |
63 | 63 |
64 expect(listening['total_read'], equals(2)); | 64 expect(listening['total_read'], equals(2)); |
65 expect(listening['last_write'], equals(0)); | 65 expect(listening['last_write'], equals(0)); |
66 expect(listening['total_written'], equals(0)); | 66 expect(listening['total_written'], equals(0)); |
67 expect(listening['write_count'], equals(0)); | 67 expect(listening['write_count'], equals(0)); |
68 expect(listening['read_count'], equals(0)); | 68 expect(listening['read_count'], equals(2)); |
69 expect(listening['remote_host'], equals('NA')); | 69 expect(listening['remote_host'], equals('NA')); |
70 expect(listening['remote_port'], equals('NA')); | 70 expect(listening['remote_port'], equals('NA')); |
71 | 71 |
72 var client = await isolate.invokeRpcNoUpgrade( | 72 var client = await isolate.invokeRpcNoUpgrade( |
73 '__getSocketByID', { 'id' : result['data'][1]['id'] }); | 73 '__getSocketByID', { 'id' : result['data'][1]['id'] }); |
74 expect(client['id'], equals(result['data'][1]['id'])); | 74 expect(client['id'], equals(result['data'][1]['id'])); |
75 | 75 |
76 var server = await isolate.invokeRpcNoUpgrade( | 76 var server = await isolate.invokeRpcNoUpgrade( |
77 '__getSocketByID', { 'id' : result['data'][2]['id'] }); | 77 '__getSocketByID', { 'id' : result['data'][2]['id'] }); |
78 expect(server['id'], equals(result['data'][2]['id'])); | 78 expect(server['id'], equals(result['data'][2]['id'])); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // Stopwatch resolution on windows make us sometimes report the same value. | 166 // Stopwatch resolution on windows make us sometimes report the same value. |
167 if (io.Platform.isWindows) { | 167 if (io.Platform.isWindows) { |
168 expect(server['last_read'], greaterThanOrEqualTo(client['last_write'])); | 168 expect(server['last_read'], greaterThanOrEqualTo(client['last_write'])); |
169 } else { | 169 } else { |
170 expect(server['last_read'], greaterThan(client['last_write'])); | 170 expect(server['last_read'], greaterThan(client['last_write'])); |
171 } | 171 } |
172 }, | 172 }, |
173 ]; | 173 ]; |
174 | 174 |
175 main(args) async => runIsolateTests(args, tcpTests, testeeBefore:setupTCP); | 175 main(args) async => runIsolateTests(args, tcpTests, testeeBefore:setupTCP); |
OLD | NEW |