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 // VMOptions=--error_on_bad_type --error_on_bad_override | 4 // VMOptions=--error_on_bad_type --error_on_bad_override |
5 | 5 |
6 import 'package:observatory/service_io.dart'; | 6 import 'package:observatory/service_io.dart'; |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'test_helper.dart'; | 8 import 'test_helper.dart'; |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'dart:isolate' as isolate; | 10 import 'dart:isolate' as isolate; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Sanity check. | 67 // Sanity check. |
68 expect(stack['messages'].length, greaterThanOrEqualTo(1)); | 68 expect(stack['messages'].length, greaterThanOrEqualTo(1)); |
69 | 69 |
70 // Iterate over messages. | 70 // Iterate over messages. |
71 var messageDepth = 0; | 71 var messageDepth = 0; |
72 // objectId of message to be handled by msgHandler. | 72 // objectId of message to be handled by msgHandler. |
73 var msgHandlerObjectId; | 73 var msgHandlerObjectId; |
74 for (var message in stack['messages']) { | 74 for (var message in stack['messages']) { |
75 print('checking message $messageDepth'); | 75 print('checking message $messageDepth'); |
76 expect(message.index, equals(messageDepth++)); | 76 expect(message.index, equals(messageDepth++)); |
77 expect(message.size, greaterThanOrEqualTo(1)); | 77 expect(message.size, greaterThanOrEqualTo(0)); |
78 expect(message.handler.type, equals('Function')); | 78 expect(message.handler.type, equals('Function')); |
79 expect(message.location.type, equals('SourceLocation')); | 79 expect(message.location.type, equals('SourceLocation')); |
80 if (message.handler.name.contains('msgHandler')) { | 80 if (message.handler.name.contains('msgHandler')) { |
81 msgHandlerObjectId = message.messageObjectId; | 81 msgHandlerObjectId = message.messageObjectId; |
82 } | 82 } |
83 } | 83 } |
84 expect(msgHandlerObjectId, isNotNull); | 84 expect(msgHandlerObjectId, isNotNull); |
85 | 85 |
86 // Get object. | 86 // Get object. |
87 var object = await isolate.getObject(msgHandlerObjectId); | 87 var object = await isolate.getObject(msgHandlerObjectId); |
88 expect(object.valueAsString, equals('34')); | 88 expect(object.valueAsString, equals('34')); |
89 } | 89 } |
90 | 90 |
91 ]; | 91 ]; |
92 | 92 |
93 main(args) => runIsolateTests(args, tests, testeeBefore: startTimer); | 93 main(args) => runIsolateTests(args, tests, testeeBefore: startTimer); |
OLD | NEW |