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

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

Issue 2751423005: Run dartfmt on all files under runtime. (Closed)
Patch Set: Run dartfmt on all files under runtime. 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) 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 'package:observatory/heap_snapshot.dart'; 6 import 'package:observatory/heap_snapshot.dart';
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:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'test_helper.dart'; 10 import 'test_helper.dart';
11 11
12 // small example from [Lenguaer & Tarjan 1979] 12 // small example from [Lenguaer & Tarjan 1979]
13 class R { var x; var y; var z; } 13 class R {
14 class A { var x; } 14 var x;
15 class B { var x; var y; var z; } 15 var y;
16 class C { var x; var y; } 16 var z;
17 class D { var x; } 17 }
18 class E { var x; } 18
19 class F { var x; } 19 class A {
20 class G { var x; var y; } 20 var x;
21 class H { var x; var y; } 21 }
22 class I { var x; } 22
23 class J { var x; } 23 class B {
24 class K { var x; var y; } 24 var x;
25 class L { var x; } 25 var y;
26 var z;
27 }
28
29 class C {
30 var x;
31 var y;
32 }
33
34 class D {
35 var x;
36 }
37
38 class E {
39 var x;
40 }
41
42 class F {
43 var x;
44 }
45
46 class G {
47 var x;
48 var y;
49 }
50
51 class H {
52 var x;
53 var y;
54 }
55
56 class I {
57 var x;
58 }
59
60 class J {
61 var x;
62 }
63
64 class K {
65 var x;
66 var y;
67 }
68
69 class L {
70 var x;
71 }
26 72
27 var r; 73 var r;
28 74
29 buildGraph() { 75 buildGraph() {
30 r = new R(); 76 r = new R();
31 var a = new A(); 77 var a = new A();
32 var b = new B(); 78 var b = new B();
33 var c = new C(); 79 var c = new C();
34 var d = new D(); 80 var d = new D();
35 var e = new E(); 81 var e = new E();
36 var f = new F(); 82 var f = new F();
37 var g = new G(); 83 var g = new G();
38 var h = new H(); 84 var h = new H();
39 var i = new I(); 85 var i = new I();
40 var j = new J(); 86 var j = new J();
41 var k = new K(); 87 var k = new K();
42 var l = new L(); 88 var l = new L();
43 89
44 r.x = a; r.y = b; r.z = c; 90 r.x = a;
91 r.y = b;
92 r.z = c;
45 a.x = d; 93 a.x = d;
46 b.x = a; b.y = d; b.z = e; 94 b.x = a;
47 c.x = f; c.y = g; 95 b.y = d;
96 b.z = e;
97 c.x = f;
98 c.y = g;
48 d.x = l; 99 d.x = l;
49 e.x = h; 100 e.x = h;
50 f.x = i; 101 f.x = i;
51 g.x = i; g.y = j; 102 g.x = i;
52 h.x = e; h.y = k; 103 g.y = j;
104 h.x = e;
105 h.y = k;
53 i.x = k; 106 i.x = k;
54 j.x = i; 107 j.x = i;
55 k.x = i; k.y = r; 108 k.x = i;
109 k.y = r;
56 l.x = h; 110 l.x = h;
57 } 111 }
58 112
59 var tests = [ 113 var tests = [
60 (Isolate isolate) async { 114 (Isolate isolate) async {
61 final rootLib = await isolate.rootLibrary.load(); 115 final rootLib = await isolate.rootLibrary.load();
62 final raw = 116 final raw =
63 await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.user, false).last; 117 await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.user, false).last;
64 final snapshot = new HeapSnapshot(); 118 final snapshot = new HeapSnapshot();
65 await snapshot.loadProgress(isolate, raw).last; 119 await snapshot.loadProgress(isolate, raw).last;
66 120
67 node(String className) { 121 node(String className) {
68 var cls = rootLib.classes.singleWhere((cls) => cls.name == className); 122 var cls = rootLib.classes.singleWhere((cls) => cls.name == className);
69 return snapshot.graph.vertices.singleWhere((v) => v.vmCid == cls.vmCid); 123 return snapshot.graph.vertices.singleWhere((v) => v.vmCid == cls.vmCid);
70 } 124 }
71 125
72 expect(node('I').dominator, equals(node('R'))); 126 expect(node('I').dominator, equals(node('R')));
73 expect(node('K').dominator, equals(node('R'))); 127 expect(node('K').dominator, equals(node('R')));
74 expect(node('C').dominator, equals(node('R'))); 128 expect(node('C').dominator, equals(node('R')));
75 expect(node('H').dominator, equals(node('R'))); 129 expect(node('H').dominator, equals(node('R')));
76 expect(node('E').dominator, equals(node('R'))); 130 expect(node('E').dominator, equals(node('R')));
77 expect(node('A').dominator, equals(node('R'))); 131 expect(node('A').dominator, equals(node('R')));
78 expect(node('D').dominator, equals(node('R'))); 132 expect(node('D').dominator, equals(node('R')));
79 expect(node('B').dominator, equals(node('R'))); 133 expect(node('B').dominator, equals(node('R')));
80 134
81 expect(node('F').dominator, equals(node('C'))); 135 expect(node('F').dominator, equals(node('C')));
82 expect(node('G').dominator, equals(node('C'))); 136 expect(node('G').dominator, equals(node('C')));
83 expect(node('J').dominator, equals(node('G'))); 137 expect(node('J').dominator, equals(node('G')));
84 expect(node('L').dominator, equals(node('D'))); 138 expect(node('L').dominator, equals(node('D')));
85 139
86 expect(node('R'), isNotNull); // The field. 140 expect(node('R'), isNotNull); // The field.
87 }, 141 },
88 ]; 142 ];
89 143
90 main(args) => runIsolateTests(args, tests, testeeBefore: buildGraph); 144 main(args) => runIsolateTests(args, tests, testeeBefore: buildGraph);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698