OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // VMOptions=--error_on_bad_type --error_on_bad_override --complete_timeline |
| 5 |
| 6 import 'dart:developer'; |
| 7 import 'package:observatory/service_io.dart'; |
| 8 import 'package:unittest/unittest.dart'; |
| 9 |
| 10 import 'test_helper.dart'; |
| 11 |
| 12 primeTimeline() { |
| 13 Timeline.startSync('apple'); |
| 14 Timeline.finishSync(); |
| 15 } |
| 16 |
| 17 List<Map> filterForDartEvents(List<Map> events) { |
| 18 return events.where((event) => event['cat'] == 'Dart').toList(); |
| 19 } |
| 20 |
| 21 var tests = [ |
| 22 (VM vm) async { |
| 23 Map result = await vm.invokeRpcNoUpgrade('_getVMTimeline', {}); |
| 24 expect(result['type'], equals('_Timeline')); |
| 25 expect(result['traceEvents'], new isInstanceOf<List>()); |
| 26 List<Map> dartEvents = filterForDartEvents(result['traceEvents']); |
| 27 expect(dartEvents.length, equals(1)); |
| 28 Map dartEvent = dartEvents[0]; |
| 29 expect(dartEvent['name'], equals('apple')); |
| 30 }, |
| 31 ]; |
| 32 |
| 33 main(args) async => runVMTests(args, tests, testeeBefore: primeTimeline); |
OLD | NEW |