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

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

Issue 1726773002: Refactor service tests in preparation of running on sky_shell (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/service_io.dart'; 7 import 'package:observatory/service_io.dart';
8 import 'package:observatory/cpu_profile.dart'; 8 import 'package:observatory/cpu_profile.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10 import 'service_test_common.dart';
11 import 'test_helper.dart'; 11 import 'test_helper.dart';
12 12
13 class Foo { 13 class Foo {
14 Foo() { 14 Foo() {
15 print('new Foo'); 15 print('new Foo');
16 } 16 }
17 } 17 }
18 18
19 void test() { 19 void test() {
20 debugger(); 20 debugger();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 await fooClass.setTraceAllocations(false); 60 await fooClass.setTraceAllocations(false);
61 await fooClass.reload(); 61 await fooClass.reload();
62 expect(fooClass.traceAllocations, isFalse); 62 expect(fooClass.traceAllocations, isFalse);
63 CpuProfile cpuProfile = new CpuProfile(); 63 CpuProfile cpuProfile = new CpuProfile();
64 cpuProfile.load(isolate, profileResponse); 64 cpuProfile.load(isolate, profileResponse);
65 cpuProfile.buildCodeCallerAndCallees(); 65 cpuProfile.buildCodeCallerAndCallees();
66 cpuProfile.buildFunctionCallerAndCallees(); 66 cpuProfile.buildFunctionCallerAndCallees();
67 var tree = cpuProfile.loadCodeTree('exclusive'); 67 var tree = cpuProfile.loadCodeTree('exclusive');
68 var node = tree.root; 68 var node = tree.root;
69 var expected = 69 var expected =
70 ['Root', 'test', 'test', '_Closure.call', 70 ['Root', 'test', 'test', '_Closure.call'];
71 'runIsolateTests.<runIsolateTests_async_body>'];
72 for (var i = 0; i < expected.length; i++) { 71 for (var i = 0; i < expected.length; i++) {
73 expect(node.profileCode.code.name, equals(expected[i])); 72 expect(node.profileCode.code.name, equals(expected[i]));
74 // Depth first traversal. 73 // Depth first traversal.
75 if (node.children.length == 0) { 74 if (node.children.length == 0) {
76 node = null; 75 node = null;
77 } else { 76 } else {
78 node = node.children[0]; 77 node = node.children[0];
79 } 78 }
80 expect(node, isNotNull); 79 expect(node, isNotNull);
81 } 80 }
82 }, 81 },
83 resumeIsolate, 82 resumeIsolate,
84 ]; 83 ];
85 84
86 main(args) async => runIsolateTests(args, tests, testeeConcurrent:test); 85 main(args) async => runIsolateTests(args, tests, testeeConcurrent:test);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698