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

Side by Side Diff: runtime/observatory/tests/ui/inspector.dart

Issue 1306743004: Update manual inspector test. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | runtime/observatory/tests/ui/inspector_part.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 4
5 // See inspector.txt for expected behavior. 5 // See inspector.txt for expected behavior.
6 6
7 library manual_inspector_test; 7 library manual_inspector_test;
8 8
9 import 'dart:async';
9 import 'dart:isolate'; 10 import 'dart:isolate';
10 import 'dart:mirrors'; 11 import 'dart:mirrors';
11 import 'dart:developer'; 12 import 'dart:developer';
12 import 'dart:typed_data'; 13 import 'dart:typed_data';
13 14
15 part 'inspector_part.dart';
16
17 var libraryField;
18 var node;
19 var uninitialized = new Object();
20
21 extractPrivateField(obj, name) {
22 return reflect(obj).getField(MirrorSystem.getSymbol(name, reflect(obj).type.ow ner)).reflectee;
23 }
24
14 class A <T> {} 25 class A <T> {}
15 class B <S extends num> {} 26 class B <S extends num> {}
16 27
17 var array; 28 class Node {
18 var bigint; 29 static var classField;
19 var blockClean; 30
20 var blockCopying; 31 var nullable;
21 var blockFull; 32 var mixedType;
22 var blockFullWithChain; 33 var array;
23 var boundedType; 34 var bigint;
24 var capability; 35 var blockClean;
25 var counter; 36 var blockCopying;
26 var expando; 37 var blockFull;
27 var float32x4; 38 var blockFullWithChain;
28 var float64; 39 var boundedType;
29 var float64x2; 40 var capability;
30 var gauge; 41 var counter;
31 var growableList; 42 var expando;
32 var int32x4; 43 var float32x4;
33 var isolate; 44 var float64;
34 var map; 45 var float64x2;
35 var mint; 46 var gauge;
36 var mirrorClass; 47 var growableList;
37 var mirrorClosure; 48 var int32x4;
38 var mirrorInstance; 49 var isolate;
39 var mirrorReference; 50 var map;
40 var portReceive; 51 var mint;
41 var portSend; 52 var mirrorClass;
42 var regex; 53 var mirrorClosure;
43 var smi; 54 var mirrorInstance;
44 var stacktrace; 55 var mirrorReference;
45 var string; 56 var portReceive;
46 var stringEscapedUnicodeEscape; 57 var portSend;
47 var stringHebrew; 58 var regex;
48 var stringLatin1; 59 var smi;
49 var stringMalformedLead; 60 var stacktrace;
50 var stringMalformedTrail; 61 var string;
51 var stringNewLinesAndTabs; 62 var stringLatin1;
52 var stringNullInTheMiddle; 63 var stringSnowflake;
53 var stringSnowflake; 64 var stringUnicode;
54 var stringTrebleClefs; 65 var stringHebrew;
55 var stringUnicode; 66 var stringTrebleClef;
56 var theFalse; 67 var theFalse;
57 var theNull; 68 var theNull;
58 var theTrue; 69 var theTrue;
59 var type; 70 var type;
60 var typeParameter; 71 var typeParameter;
61 var typedData; 72 var typedData;
62 var uninitialized = new Object(); 73 var userTag;
63 var userTag; 74 var weakProperty;
64 var weakProperty; 75
65 76 genStacktrace() {
66 extractPrivateField(obj, name) { 77 try {
67 return reflect(obj).getField(MirrorSystem.getSymbol(name, reflect(obj).type.ow ner)).reflectee; 78 num.parse(',');
68 } 79 } catch (e, s) {
69 80 return s;
70 genStacktrace() { 81 }
71 try { 82 }
72 num.parse(','); 83
73 } catch (e, s) { 84 genCleanBlock() {
74 return s; 85 block(x) => x;
75 }
76 }
77
78 genCleanBlock() {
79 block(x) => x;
80 return block;
81 }
82
83 genCopyingBlock() {
84 final x = 'I could be copied down';
85 block() => x;
86 return block;
87 }
88
89 genFullBlock() {
90 var x = 0;
91 block() => x++;
92 return block;
93 }
94
95 genFullBlockWithChain() {
96 var x = 0;
97 outer() {
98 var y = 0;
99 block() => x++ + y++;
100 return block; 86 return block;
101 } 87 }
102 return outer; 88
103 } 89 genCopyingBlock() {
104 90 final x = 'I could be copied down';
105 secondMain(msg) { } 91 block() => x;
92 return block;
93 }
94
95 genFullBlock() {
96 var x = 0;
97 block() => x++;
98 return block;
99 }
100
101 genFullBlockWithChain() {
102 var x = 0;
103 outer() {
104 var y = 0;
105 block() => x++ + y++;
106 return block;
107 }
108 return outer;
109 }
110
111 f(int x) {
112 ++x;
113 return x;
114 }
115
116 main() {
117 print("Started main");
118
119 f(9);
120
121 nullable = 1;
122 nullable = null;
123 nullable = 1;
124 mixedType = 1;
125 mixedType = "2";
126 mixedType = false;
127
128 array = [1, 2, 3];
129 bigint = 1 << 65;
130 blockClean = genCleanBlock();
131 blockCopying = genCopyingBlock();
132 blockFull = genFullBlock();
133 blockFullWithChain = genFullBlockWithChain();
134 boundedType = extractPrivateField(reflect(new B<int>()).type.typeVariables.s ingle, '_reflectee');
135 counter = new Counter("CounterName", "Counter description");
136 expando = new Expando("expando-name");
137 expando[array] = 'The weakly associated value';
138 float32x4 = new Float32x4.zero();
139 float64 = 3.14;
140 float64x2 = new Float64x2.zero();
141 gauge = new Gauge("GuageName", "Guage description", 0.0, 100.0);
142 growableList = new List();
143 int32x4 = new Int32x4(0,0,0,0);
144 map = { "x-key": "x-value", "y-key": "y-value", "removed-key": "removed-valu e" };
145 map.remove("removed-key");
146 mint = 1 << 32;
147 mirrorClass = reflectClass(Object);
148 mirrorClosure = reflect(blockFull);
149 mirrorInstance = reflect("a reflectee");
150 mirrorReference = extractPrivateField(mirrorClass, '_reflectee');
151 portReceive = new RawReceivePort();
152 portSend = portReceive.sendPort;
153 regex = new RegExp("a*b+c");
154 smi = 7;
155 stacktrace = genStacktrace();
156 string = "Hello $smi ${smi.runtimeType}";
157 stringLatin1 = "blåbærgrød";
158 stringSnowflake = "❄";
159 stringUnicode = "Îñţérñåţîöñåļîžåţîờñ";
160 stringHebrew = "שלום רב שובך צפורה נחמדת"; // An example of Right-to-Left.
161 stringTrebleClef = "𝄞"; // An example of a surrogate pair.
162 theFalse = false;
163 theNull = null;
164 theTrue = true;
165 type = String;
166 typeParameter = extractPrivateField(reflectClass(A).typeVariables.single, '_ reflectee');
167 typedData = extractPrivateField(new ByteData(64), '_typedData');
168 userTag = new UserTag("Example tag name");
169 weakProperty = extractPrivateField(expando, '_data').firstWhere((e) => e != null);
170
171 Isolate.spawn(secondMain, "Hello2").then((otherIsolate) {
172 isolate = otherIsolate;
173 portSend = otherIsolate.controlPort;
174 capability = otherIsolate.terminateCapability;
175 });
176 Isolate.spawn(secondMain, "Hello3").then((otherIsolate) {
177 isolate = otherIsolate;
178 portSend = otherIsolate.controlPort;
179 capability = otherIsolate.terminateCapability;
180 });
181
182 print("Finished main");
183 busy();
184 }
185
186 busy() {
187 var localVar = 0;
188 while (true) {
189 localVar = (localVar + 1) & 0xFFFF;
190 }
191 }
192 }
193
194 secondMain(msg) {
195 print("Hello from second isolate");
196 }
197
198 var typed;
199 class Typed {
200 var float32List = new Float32List(16);
201 var float64List = new Float64List(16);
202
203 var int32x4 = new Int32x4(1, 2, 3, 4);
204 var float32x4 = new Float32x4.zero();
205 var float64x2 = new Float64x2.zero();
206 var int32x4List = new Int32x4List(16);
207 var float32x4List = new Float32x4List(16);
208 var float64x2List = new Float64x2List(16);
209
210 var int8List = new Int8List(8);
211 var int16List = new Int16List(8);
212 var int32List = new Int32List(8);
213 var int64List = new Int64List(8);
214 var uint8List = new Uint8List(8);
215 var uint16List = new Uint16List(8);
216 var uint32List = new Uint32List(8);
217 var uint64List = new Uint64List(8);
218 var uint8ClampedList = new Uint8ClampedList(8);
219
220 var byteBuffer = new Uint8List(8).buffer;
221 var byteBuffer2 = new Float32List(8).buffer;
222
223 var byteData = new ByteData(8);
224
225 Typed() {
226 float32List[0] = 3.14;
227 int8List[0] = 5;
228 }
229
230 Typed._named() {
231 float32List[0] = 3.14;
232 int8List[0] = 5;
233 }
234 }
106 235
107 main() { 236 main() {
108 print("Started main"); 237 libraryField = 'Library field value';
109 238 Node.classField = 'Class field value';
110 array = new List(1); 239 typed = new Typed();
111 bigint = 1 << 65; 240 node = new Node();
112 blockClean = genCleanBlock(); 241 node.main();
113 blockCopying = genCopyingBlock(); 242 }
114 blockFull = genFullBlock(); 243
115 blockFullWithChain = genFullBlockWithChain(); 244 class C {
116 boundedType = extractPrivateField(reflect(new B<int>()).type.typeVariables.sin gle, '_reflectee'); 245 static doPrint() {
117 counter = new Counter("CounterName", "Counter description"); 246 print("Original");
118 expando = new Expando("expando-name"); 247 }
119 expando[array] = 'The weakly associated value'; 248 }
120 float32x4 = new Float32x4.zero();
121 float64 = 3.14;
122 float64x2 = new Float64x2.zero();
123 gauge = new Gauge("GaugeName", "Gauge description", 0.0, 100.0);
124 growableList = new List();
125 int32x4 = new Int32x4(0,0,0,0);
126 map = { "x":3, "y":4 };
127 mint = 1 << 32;
128 mirrorClass = reflectClass(Object);
129 mirrorClosure = reflect(blockFull);
130 mirrorInstance = reflect("a reflectee");
131 mirrorReference = extractPrivateField(mirrorClass, '_reflectee');
132 portReceive = new RawReceivePort();
133 regex = new RegExp("a*b+c");
134 smi = 7;
135 stacktrace = genStacktrace();
136 string = "Hello";
137 stringEscapedUnicodeEscape = "Should not be A: \\u0041";
138 stringHebrew = "שלום רב שובך צפורה נחמדת"; // Right-to-left text.
139 stringLatin1 = "blåbærgrød";
140 stringMalformedLead = "before" + "𝄞"[0] + "after";
141 stringMalformedTrail = "before" + "𝄞"[1] + "after";
142 stringNewLinesAndTabs = "One fish\ttwo fish\nRed fish\tBlue fish\n";
143 stringNullInTheMiddle = "There are four\u0000 words.";
144 stringSnowflake = "❄";
145 stringTrebleClefs = "1𝄞2𝄞𝄞3𝄞𝄞𝄞"; // Surrogate pair.
146 stringUnicode = "Îñţérñåţîöñåļîžåţîờñ";
147 theFalse = false;
148 theNull = null;
149 theTrue = true;
150 type = String;
151 typeParameter = extractPrivateField(reflectClass(A).typeVariables.single, '_re flectee');
152 typedData = extractPrivateField(new ByteData(64), '_typedData');
153 userTag = new UserTag("Example tag name");
154 weakProperty = extractPrivateField(expando, '_data').firstWhere((e) => e != nu ll);
155
156 Isolate.spawn(secondMain, "Hello").then((otherIsolate) {
157 isolate = otherIsolate;
158 portSend = otherIsolate.controlPort;
159 capability = otherIsolate.terminateCapability;
160 });
161
162 print("Finished main");
163 }
OLDNEW
« no previous file with comments | « no previous file | runtime/observatory/tests/ui/inspector_part.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698