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

Side by Side Diff: runtime/observatory/tests/service/get_allocation_samples_test.dart

Issue 2999763002: Clear analyzer warning on Observatory (Closed)
Patch Set: Created 3 years, 4 months 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 unified diff | Download patch
OLDNEW
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/sample_profile.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 import 'service_test_common.dart'; 11 import 'service_test_common.dart';
12 import 'test_helper.dart'; 12 import 'test_helper.dart';
13 13
14 class Foo { 14 class Foo {
15 Foo() { 15 Foo() {
16 print('new Foo'); 16 print('new Foo');
17 } 17 }
18 } 18 }
19 19
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 (Isolate isolate) async { 54 (Isolate isolate) async {
55 var fooClass = await getClassFromRootLib(isolate, 'Foo'); 55 var fooClass = await getClassFromRootLib(isolate, 'Foo');
56 await fooClass.reload(); 56 await fooClass.reload();
57 expect(fooClass.traceAllocations, isTrue); 57 expect(fooClass.traceAllocations, isTrue);
58 var profileResponse = await fooClass.getAllocationSamples(); 58 var profileResponse = await fooClass.getAllocationSamples();
59 expect(profileResponse, isNotNull); 59 expect(profileResponse, isNotNull);
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 SampleProfile cpuProfile = new SampleProfile();
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 = [ 70 var expected = [
71 'Root', 71 'Root',
72 'DRT_AllocateObject', 72 'DRT_AllocateObject',
73 '[Stub] Allocate Foo', 73 '[Stub] Allocate Foo',
74 'test', 74 'test',
75 'test', 75 'test',
76 '_Closure.call' 76 '_Closure.call'
77 ]; 77 ];
78 for (var i = 0; i < expected.length; i++) { 78 for (var i = 0; i < expected.length; i++) {
79 expect(node.profileCode.code.name, equals(expected[i])); 79 expect(node.profileCode.code.name, equals(expected[i]));
80 // Depth first traversal. 80 // Depth first traversal.
81 if (node.children.length == 0) { 81 if (node.children.length == 0) {
82 node = null; 82 node = null;
83 } else { 83 } else {
84 node = node.children[0]; 84 node = node.children[0];
85 } 85 }
86 expect(node, isNotNull); 86 expect(node, isNotNull);
87 } 87 }
88 }, 88 },
89 resumeIsolate, 89 resumeIsolate,
90 ]; 90 ];
91 91
92 main(args) async => runIsolateTests(args, tests, testeeConcurrent: test); 92 main(args) async => runIsolateTests(args, tests, testeeConcurrent: test);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698