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

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

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: Created 3 years, 9 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 7
8 import 'test_helper.dart'; 8 import 'test_helper.dart';
9 import 'service_test_common.dart'; 9 import 'service_test_common.dart';
10 10
11 import 'package:observatory/heap_snapshot.dart'; 11 import 'package:observatory/heap_snapshot.dart';
12 import 'package:observatory/models.dart' as M; 12 import 'package:observatory/models.dart' as M;
13 import 'package:observatory/object_graph.dart'; 13 import 'package:observatory/object_graph.dart';
14 import 'package:observatory/service_io.dart'; 14 import 'package:observatory/service_io.dart';
15 import 'package:unittest/unittest.dart'; 15 import 'package:unittest/unittest.dart';
16 16
17 int arrayLength = 1024 * 1024; 17 int arrayLength = 1024 * 1024;
18 int minArraySize = arrayLength * 4; 18 int minArraySize = arrayLength * 4;
19 19
20 void script() { 20 void script() {
21 var stackSlot = new List(arrayLength); 21 var stackSlot = new List(arrayLength);
22 debugger(); 22 debugger();
23 print(stackSlot); // Prevent optimizing away the stack slot. 23 print(stackSlot); // Prevent optimizing away the stack slot.
24 } 24 }
25 25
26 checkForStackReferent(Isolate isolate) async { 26 checkForStackReferent(Isolate isolate) async {
27 Library corelib = 27 Library corelib =
28 isolate.libraries.singleWhere((lib) => lib.uri == 'dart:core'); 28 isolate.libraries.singleWhere((lib) => lib.uri == 'dart:core');
29 await corelib.load(); 29 await corelib.load();
30 Class _List = 30 Class _List =
31 corelib.classes.singleWhere((cls) => cls.vmName.startsWith('_List')); 31 corelib.classes.singleWhere((cls) => cls.vmName.startsWith('_List'));
32 int kArrayCid = _List.vmCid; 32 int kArrayCid = _List.vmCid;
33 33
34 RawHeapSnapshot raw = 34 RawHeapSnapshot raw =
35 await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.user, false).last; 35 await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.user, false).last;
36 HeapSnapshot snapshot = new HeapSnapshot(); 36 HeapSnapshot snapshot = new HeapSnapshot();
37 await snapshot.loadProgress(isolate, raw).last; 37 await snapshot.loadProgress(isolate, raw).last;
38 ObjectGraph graph = snapshot.graph; 38 ObjectGraph graph = snapshot.graph;
39 39
40 var root = graph.root; 40 var root = graph.root;
41 var stack = graph.root.dominatorTreeChildren() 41 var stack =
42 .singleWhere((child) => child.isStack); 42 graph.root.dominatorTreeChildren().singleWhere((child) => child.isStack);
43 expect(stack.retainedSize, greaterThanOrEqualTo(minArraySize)); 43 expect(stack.retainedSize, greaterThanOrEqualTo(minArraySize));
44 44
45 bool foundBigArray = false; 45 bool foundBigArray = false;
46 for (var stackReferent in stack.dominatorTreeChildren()) { 46 for (var stackReferent in stack.dominatorTreeChildren()) {
47 if (stackReferent.vmCid == kArrayCid && 47 if (stackReferent.vmCid == kArrayCid &&
48 stackReferent.shallowSize >= minArraySize) { 48 stackReferent.shallowSize >= minArraySize) {
49 foundBigArray = true; 49 foundBigArray = true;
50 } 50 }
51 } 51 }
52 } 52 }
53 53
54 var tests = [ 54 var tests = [
55 hasStoppedAtBreakpoint, 55 hasStoppedAtBreakpoint,
56 checkForStackReferent, 56 checkForStackReferent,
57 resumeIsolate, 57 resumeIsolate,
58 ]; 58 ];
59 59
60 main(args) => runIsolateTests(args, tests, testeeConcurrent: script); 60 main(args) => runIsolateTests(args, tests, testeeConcurrent: script);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698