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 'dart:developer'; | 6 import 'dart:developer'; |
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'; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 hasStoppedAtBreakpoint, | 66 hasStoppedAtBreakpoint, |
67 (Isolate isolate) async { | 67 (Isolate isolate) async { |
68 // Get the timeline. | 68 // Get the timeline. |
69 Map result = await isolate.vm.invokeRpcNoUpgrade('_getVMTimeline', {}); | 69 Map result = await isolate.vm.invokeRpcNoUpgrade('_getVMTimeline', {}); |
70 expect(result['type'], equals('_Timeline')); | 70 expect(result['type'], equals('_Timeline')); |
71 expect(result['traceEvents'], new isInstanceOf<List>()); | 71 expect(result['traceEvents'], new isInstanceOf<List>()); |
72 print(result['traceEvents']); | 72 print(result['traceEvents']); |
73 // Confirm that Dart events are added. | 73 // Confirm that Dart events are added. |
74 expect(filterEvents(result['traceEvents'], isDart).length, greaterThan(0)); | 74 expect(filterEvents(result['traceEvents'], isDart).length, greaterThan(0)); |
75 // Confirm that zero non-Dart events are added. | 75 // Confirm that zero non-Dart events are added. |
76 expect( | 76 expect(filterEvents(result['traceEvents'], isNotDartAndMetaData).length, |
77 filterEvents(result['traceEvents'], isNotDartAndMetaData).length, | |
78 equals(0)); | 77 equals(0)); |
79 }, | 78 }, |
80 hasStoppedAtBreakpoint, | 79 hasStoppedAtBreakpoint, |
81 (Isolate isolate) async { | 80 (Isolate isolate) async { |
82 // Disable the Dart category. | 81 // Disable the Dart category. |
83 await isolate.vm.invokeRpcNoUpgrade('_setVMTimelineFlags', { | 82 await isolate.vm |
84 "recordedStreams": [] | 83 .invokeRpcNoUpgrade('_setVMTimelineFlags', {"recordedStreams": []}); |
85 }); | |
86 // Grab the timeline and remember the number of Dart events. | 84 // Grab the timeline and remember the number of Dart events. |
87 Map result = await isolate.vm.invokeRpcNoUpgrade('_getVMTimeline', {}); | 85 Map result = await isolate.vm.invokeRpcNoUpgrade('_getVMTimeline', {}); |
88 expect(result['type'], equals('_Timeline')); | 86 expect(result['type'], equals('_Timeline')); |
89 expect(result['traceEvents'], new isInstanceOf<List>()); | 87 expect(result['traceEvents'], new isInstanceOf<List>()); |
90 dartEventCount = filterEvents(result['traceEvents'], isDart).length; | 88 dartEventCount = filterEvents(result['traceEvents'], isDart).length; |
91 }, | 89 }, |
92 (Isolate isolate) async { | 90 (Isolate isolate) async { |
93 // Get the flags. | 91 // Get the flags. |
94 Map flags = await isolate.vm.invokeRpcNoUpgrade('_getVMTimelineFlags', {}); | 92 Map flags = await isolate.vm.invokeRpcNoUpgrade('_getVMTimelineFlags', {}); |
95 expect(flags['type'], 'TimelineFlags'); | 93 expect(flags['type'], 'TimelineFlags'); |
96 // Confirm that 'Dart' is not being recorded. | 94 // Confirm that 'Dart' is not being recorded. |
97 expect(flags['recordedStreams'].length, equals(0)); | 95 expect(flags['recordedStreams'].length, equals(0)); |
98 }, | 96 }, |
99 resumeIsolate, | 97 resumeIsolate, |
100 hasStoppedAtBreakpoint, | 98 hasStoppedAtBreakpoint, |
101 (Isolate isolate) async { | 99 (Isolate isolate) async { |
102 // Grab the timeline and verify that we haven't added any new Dart events. | 100 // Grab the timeline and verify that we haven't added any new Dart events. |
103 Map result = await isolate.vm.invokeRpcNoUpgrade('_getVMTimeline', {}); | 101 Map result = await isolate.vm.invokeRpcNoUpgrade('_getVMTimeline', {}); |
104 expect(result['type'], equals('_Timeline')); | 102 expect(result['type'], equals('_Timeline')); |
105 expect(result['traceEvents'], new isInstanceOf<List>()); | 103 expect(result['traceEvents'], new isInstanceOf<List>()); |
106 expect(filterEvents(result['traceEvents'], isDart).length, dartEventCount); | 104 expect(filterEvents(result['traceEvents'], isDart).length, dartEventCount); |
107 // Confirm that zero non-Dart events are added. | 105 // Confirm that zero non-Dart events are added. |
108 expect( | 106 expect(filterEvents(result['traceEvents'], isNotDartAndMetaData).length, |
109 filterEvents(result['traceEvents'], isNotDartAndMetaData).length, | |
110 equals(0)); | 107 equals(0)); |
111 }, | 108 }, |
112 ]; | 109 ]; |
113 | 110 |
114 main(args) async => runIsolateTests(args, | 111 main(args) async => |
115 tests, | 112 runIsolateTests(args, tests, testeeConcurrent: primeDartTimeline); |
116 testeeConcurrent: primeDartTimeline); | |
OLD | NEW |