OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
8 import 'package:observatory/service_io.dart'; | 8 import 'package:observatory/service_io.dart'; |
9 import 'package:observatory/cpu_profile.dart'; | 9 import 'package:observatory/cpu_profile.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 expect(profileResponse['type'], equals('_CpuProfile')); | 60 expect(profileResponse['type'], equals('_CpuProfile')); |
61 await fooClass.setTraceAllocations(false); | 61 await fooClass.setTraceAllocations(false); |
62 await fooClass.reload(); | 62 await fooClass.reload(); |
63 expect(fooClass.traceAllocations, isFalse); | 63 expect(fooClass.traceAllocations, isFalse); |
64 CpuProfile cpuProfile = new CpuProfile(); | 64 CpuProfile cpuProfile = new CpuProfile(); |
65 await cpuProfile.load(isolate, profileResponse); | 65 await cpuProfile.load(isolate, profileResponse); |
66 cpuProfile.buildCodeCallerAndCallees(); | 66 cpuProfile.buildCodeCallerAndCallees(); |
67 cpuProfile.buildFunctionCallerAndCallees(); | 67 cpuProfile.buildFunctionCallerAndCallees(); |
68 var tree = cpuProfile.loadCodeTree(M.ProfileTreeDirection.exclusive); | 68 var tree = cpuProfile.loadCodeTree(M.ProfileTreeDirection.exclusive); |
69 var node = tree.root; | 69 var node = tree.root; |
70 var expected = ['Root', 'DRT_AllocateObject', '[Stub] Allocate Foo', | 70 var expected = [ |
71 'test', 'test', '_Closure.call']; | 71 'Root', |
| 72 'DRT_AllocateObject', |
| 73 '[Stub] Allocate Foo', |
| 74 'test', |
| 75 'test', |
| 76 '_Closure.call' |
| 77 ]; |
72 for (var i = 0; i < expected.length; i++) { | 78 for (var i = 0; i < expected.length; i++) { |
73 expect(node.profileCode.code.name, equals(expected[i])); | 79 expect(node.profileCode.code.name, equals(expected[i])); |
74 // Depth first traversal. | 80 // Depth first traversal. |
75 if (node.children.length == 0) { | 81 if (node.children.length == 0) { |
76 node = null; | 82 node = null; |
77 } else { | 83 } else { |
78 node = node.children[0]; | 84 node = node.children[0]; |
79 } | 85 } |
80 expect(node, isNotNull); | 86 expect(node, isNotNull); |
81 } | 87 } |
82 }, | 88 }, |
83 resumeIsolate, | 89 resumeIsolate, |
84 ]; | 90 ]; |
85 | 91 |
86 main(args) async => runIsolateTests(args, tests, testeeConcurrent:test); | 92 main(args) async => runIsolateTests(args, tests, testeeConcurrent: test); |
OLD | NEW |