Index: runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart |
diff --git a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart |
index 0ab482576912c4caaee94840c45c9e4054918e7d..2d7f8ac619136d01d34d67ada87076cf067e15c0 100644 |
--- a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart |
+++ b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart |
@@ -11,22 +11,40 @@ import 'test_helper.dart'; |
primeTimeline() { |
Timeline.startSync('apple'); |
+ Timeline.instantSync('ISYNC'); |
Timeline.finishSync(); |
+ TimelineTask task = new TimelineTask(); |
+ task.start('TASK1'); |
+ task.instant('ITASK'); |
+ task.finish(); |
} |
List<Map> filterForDartEvents(List<Map> events) { |
return events.where((event) => event['cat'] == 'Dart').toList(); |
} |
+bool eventsContains(List<Map> events, String phase, String name) { |
+ for (Map event in events) { |
+ if ((event['ph'] == phase) && (event['name'] == name)) { |
+ return true; |
+ } |
+ } |
+ return false; |
+} |
+ |
var tests = [ |
(VM vm) async { |
Map result = await vm.invokeRpcNoUpgrade('_getVMTimeline', {}); |
expect(result['type'], equals('_Timeline')); |
expect(result['traceEvents'], new isInstanceOf<List>()); |
List<Map> dartEvents = filterForDartEvents(result['traceEvents']); |
- expect(dartEvents.length, equals(1)); |
- Map dartEvent = dartEvents[0]; |
- expect(dartEvent['name'], equals('apple')); |
+ expect(dartEvents.length, equals(5)); |
+ expect(eventsContains(dartEvents, 'I', 'ISYNC'), isTrue); |
+ expect(eventsContains(dartEvents, 'X', 'apple'), isTrue); |
+ expect(eventsContains(dartEvents, 'b', 'TASK1'), isTrue); |
+ expect(eventsContains(dartEvents, 'e', 'TASK1'), isTrue); |
+ expect(eventsContains(dartEvents, 'n', 'ITASK'), isTrue); |
+ expect(eventsContains(dartEvents, 'q', 'ITASK'), isFalse); |
}, |
]; |