Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(739)

Unified Diff: runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart

Issue 1412183008: Redo TimelineTask API (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/timeline.dart ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
},
];
« no previous file with comments | « runtime/lib/timeline.dart ('k') | runtime/vm/bootstrap_natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698