OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library isolate_class_test; | 5 library isolate_class_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'test_helper.dart'; | 8 import 'test_helper.dart'; |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 | 10 |
11 class MethodTest extends VmServiceRequestHelper { | 11 class MethodTest extends VmServiceRequestHelper { |
12 MethodTest(port, id, functionId) : | 12 MethodTest(port, id, functionId) : |
13 super('http://127.0.0.1:$port/isolates/$id/objects/$functionId'); | 13 super('http://127.0.0.1:$port/$id/$functionId'); |
14 onRequestCompleted(Map reply) { | 14 onRequestCompleted(Map reply) { |
15 Expect.equals('Function', reply['type']); | 15 Expect.equals('Function', reply['type']); |
16 Expect.equals('C.c', reply['user_name']); | 16 Expect.equals('C.c', reply['user_name']); |
17 Expect.equals(false, reply['is_static']); | 17 Expect.equals(false, reply['is_static']); |
18 } | 18 } |
19 } | 19 } |
20 | 20 |
21 class FunctionTest extends VmServiceRequestHelper { | 21 class FunctionTest extends VmServiceRequestHelper { |
22 FunctionTest(port, id, functionId) : | 22 FunctionTest(port, id, functionId) : |
23 super('http://127.0.0.1:$port/isolates/$id/objects/$functionId'); | 23 super('http://127.0.0.1:$port/$id/$functionId'); |
24 | 24 |
25 onRequestCompleted(Map reply) { | 25 onRequestCompleted(Map reply) { |
26 Expect.equals('Function', reply['type']); | 26 Expect.equals('Function', reply['type']); |
27 Expect.equals('a', reply['name']); | 27 Expect.equals('a', reply['name']); |
28 Expect.equals(true, reply['is_static']); | 28 Expect.equals(true, reply['is_static']); |
29 } | 29 } |
30 } | 30 } |
31 | 31 |
32 class StackTraceTest extends VmServiceRequestHelper { | 32 class StackTraceTest extends VmServiceRequestHelper { |
33 StackTraceTest(port, id) : | 33 StackTraceTest(port, id) : |
34 super('http://127.0.0.1:$port/isolates/$id/stacktrace'); | 34 super('http://127.0.0.1:$port/$id/stacktrace'); |
35 | 35 |
36 int _aId; | 36 String _aId; |
37 int _cId; | 37 String _cId; |
38 onRequestCompleted(Map reply) { | 38 onRequestCompleted(Map reply) { |
39 Expect.equals('StackTrace', reply['type']); | 39 Expect.equals('StackTrace', reply['type']); |
40 List members = reply['members']; | 40 List members = reply['members']; |
41 Expect.equals('a', members[0]['name']); | 41 Expect.equals('a', members[0]['name']); |
42 _aId = members[0]['function']['id']; | 42 _aId = members[0]['function']['id']; |
43 Expect.equals('c', members[2]['name']); | 43 Expect.equals('c', members[2]['name']); |
44 _cId = members[2]['function']['id']; | 44 _cId = members[2]['function']['id']; |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 class IsolateListTest extends VmServiceRequestHelper { | 48 class IsolateListTest extends VmServiceRequestHelper { |
49 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); | 49 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); |
50 | 50 |
51 int _isolateId; | 51 String _isolateId; |
52 onRequestCompleted(Map reply) { | 52 onRequestCompleted(Map reply) { |
53 IsolateListTester tester = new IsolateListTester(reply); | 53 IsolateListTester tester = new IsolateListTester(reply); |
54 tester.checkIsolateCount(2); | 54 tester.checkIsolateCount(2); |
55 tester.checkIsolateNameContains('isolate_stacktrace_command_script.dart'); | 55 tester.checkIsolateNameContains('isolate_stacktrace_command_script.dart'); |
56 _isolateId = tester.checkIsolateNameContains('myIsolateName'); | 56 _isolateId = tester.checkIsolateNameContains('myIsolateName'); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 main() { | 60 main() { |
61 var process = new TestLauncher('isolate_stacktrace_command_script.dart'); | 61 var process = new TestLauncher('isolate_stacktrace_command_script.dart'); |
62 process.launch().then((port) { | 62 process.launch().then((port) { |
63 var test = new IsolateListTest(port); | 63 var test = new IsolateListTest(port); |
64 test.makeRequest().then((_) { | 64 test.makeRequest().then((_) { |
65 var stackTraceTest = | 65 var stackTraceTest = |
66 new StackTraceTest(port, test._isolateId); | 66 new StackTraceTest(port, test._isolateId); |
67 stackTraceTest.makeRequest().then((_) { | 67 stackTraceTest.makeRequest().then((_) { |
68 var functionTest = new FunctionTest(port, test._isolateId, | 68 var functionTest = new FunctionTest(port, test._isolateId, |
69 stackTraceTest._aId); | 69 stackTraceTest._aId); |
70 functionTest.makeRequest().then((_) { | 70 functionTest.makeRequest().then((_) { |
71 var methodTest = new MethodTest(port, test._isolateId, | 71 var methodTest = new MethodTest(port, test._isolateId, |
72 stackTraceTest._cId); | 72 stackTraceTest._cId); |
73 methodTest.makeRequest().then((_) { | 73 methodTest.makeRequest().then((_) { |
74 process.requestExit(); | 74 process.requestExit(); |
75 }); | 75 }); |
76 }); | 76 }); |
77 }); | 77 }); |
78 }); | 78 }); |
79 }); | 79 }); |
80 } | 80 } |
OLD | NEW |