| Index: runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart
|
| diff --git a/runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart b/runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cf534c2d3edaa7f8dfda237c463d1c6483d2cc27
|
| --- /dev/null
|
| +++ b/runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart
|
| @@ -0,0 +1,56 @@
|
| +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +// VMOptions=--error_on_bad_type --error_on_bad_override
|
| +
|
| +import 'package:observatory/service_io.dart';
|
| +import 'package:unittest/unittest.dart';
|
| +
|
| +import 'test_helper.dart';
|
| +
|
| +fib(n) {
|
| + if (n < 0) return 0;
|
| + if (n == 0) return 1;
|
| + return fib(n - 1) + fib(n - 2);
|
| +}
|
| +
|
| +testeeDo() {
|
| + print("Testee doing something.");
|
| + fib(25);
|
| + print("Testee did something.");
|
| +}
|
| +
|
| +var tests = [
|
| + (Isolate isolate) async {
|
| + var params = {
|
| + 'tags': 'VMUser'
|
| + };
|
| + var result = await isolate.invokeRpcNoUpgrade(
|
| + '_getCpuProfileTimeline', params);
|
| + print(result);
|
| + expect(result['type'], equals('_CpuProfileTimeline'));
|
| +
|
| + var isString = new isInstanceOf<String>();
|
| +
|
| + Map frames = result['stackFrames'];
|
| + for (Map frame in frames.values) {
|
| + expect(frame['category'], isString);
|
| + expect(frame['name'], isString);
|
| + if (frame['parent'] != null) {
|
| + expect(frames.containsKey(frame['parent']), isTrue);
|
| + }
|
| + }
|
| +
|
| + List events = result['traceEvents'];
|
| + for (Map event in events) {
|
| + expect(event['ph'], equals('P'));
|
| + expect(event['pid'], isString);
|
| + expect(event['tid'], isString);
|
| + expect(event['ts'], isString);
|
| + expect(event['category'], equals("Dart"));
|
| + expect(frames.containsKey(event['sf']), isTrue);
|
| + }
|
| + },
|
| +];
|
| +
|
| +main(args) async => runIsolateTests(args, tests, testeeBefore: testeeDo);
|
|
|