OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/models.dart' as M; | 6 import 'package:observatory/models.dart' as M; |
7 import 'package:observatory/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 import 'service_test_common.dart'; | 9 import 'service_test_common.dart'; |
10 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
11 import 'dart:developer' as developer; | 11 import 'dart:developer' as developer; |
12 | 12 |
13 void doDebugger() { | 13 void doDebugger() { |
14 developer.debugger(message: "foo", when: true); | 14 developer.debugger(message: "foo", when: true); |
15 } | 15 } |
16 | 16 |
17 bool isClosureFunctionsList(NamedField field) { | 17 bool isClosureFunctionsList(NamedField field) { |
18 return field.name == 'closure_functions_'; | 18 return field.name == 'closure_functions_'; |
19 } | 19 } |
20 | 20 |
21 var tests = [ | 21 var tests = [ |
| 22 |
22 // Initial data fetch and verify we've hit the breakpoint. | 23 // Initial data fetch and verify we've hit the breakpoint. |
23 (Isolate isolate) async { | 24 (Isolate isolate) async { |
24 await isolate.rootLibrary.load(); | 25 await isolate.rootLibrary.load(); |
25 var script = isolate.rootLibrary.scripts[0]; | 26 var script = isolate.rootLibrary.scripts[0]; |
26 await script.load(); | 27 await script.load(); |
27 await hasStoppedAtBreakpoint(isolate); | 28 await hasStoppedAtBreakpoint(isolate); |
28 // Sanity check. | 29 // Sanity check. |
29 expect(isolate.pauseEvent is M.PauseBreakpointEvent, isTrue); | 30 expect(isolate.pauseEvent is M.PauseBreakpointEvent, isTrue); |
30 }, | 31 }, |
31 | 32 |
32 // Get object_store. | 33 // Get object_store. |
33 (Isolate isolate) async { | 34 (Isolate isolate) async { |
34 var object_store = await isolate.getObjectStore(); | 35 var object_store = await isolate.getObjectStore(); |
35 expect(object_store.runtimeType, equals(ObjectStore)); | 36 expect(object_store.runtimeType, equals(ObjectStore)); |
36 // Sanity check. | 37 // Sanity check. |
37 expect(object_store.fields.length, greaterThanOrEqualTo(1)); | 38 expect(object_store.fields.length, greaterThanOrEqualTo(1)); |
38 // Checking Closures. | 39 // Checking Closures. |
39 expect(object_store.fields.singleWhere(isClosureFunctionsList), isNotNull); | 40 expect(object_store.fields.singleWhere(isClosureFunctionsList), isNotNull); |
40 expect(object_store.fields.singleWhere(isClosureFunctionsList).value.isList, | 41 expect(object_store.fields.singleWhere(isClosureFunctionsList).value.isList, i
sTrue); |
41 isTrue); | 42 } |
42 } | 43 |
43 ]; | 44 ]; |
44 | 45 |
45 main(args) => | 46 main(args) => runIsolateTestsSynchronous(args, tests, |
46 runIsolateTestsSynchronous(args, tests, testeeConcurrent: doDebugger); | 47 testeeConcurrent: doDebugger); |
OLD | NEW |