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