| 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/$id/$functionId'); | |
| 14 onRequestCompleted(Map reply) { | |
| 15 Expect.equals('Function', reply['type']); | |
| 16 Expect.equals('c', reply['name']); | |
| 17 Expect.equals(false, reply['static']); | |
| 18 } | |
| 19 } | |
| 20 | |
| 21 class FunctionTest extends VmServiceRequestHelper { | |
| 22 FunctionTest(port, id, functionId) : | |
| 23 super('http://127.0.0.1:$port/$id/$functionId'); | |
| 24 | |
| 25 onRequestCompleted(Map reply) { | |
| 26 Expect.equals('Function', reply['type']); | |
| 27 Expect.equals('a', reply['name']); | |
| 28 Expect.equals(true, reply['static']); | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 class StackTraceTest extends VmServiceRequestHelper { | |
| 33 StackTraceTest(port, id) : | |
| 34 super('http://127.0.0.1:$port/$id/stacktrace'); | |
| 35 | |
| 36 String _aId; | |
| 37 String _cId; | |
| 38 onRequestCompleted(Map reply) { | |
| 39 Expect.equals('StackTrace', reply['type']); | |
| 40 List members = reply['members']; | |
| 41 Expect.equals('a', members[0]['function']['name']); | |
| 42 _aId = members[0]['function']['id']; | |
| 43 Expect.equals('c', members[2]['function']['name']); | |
| 44 _cId = members[2]['function']['id']; | |
| 45 } | |
| 46 } | |
| 47 | |
| 48 class VMTest extends VmServiceRequestHelper { | |
| 49 VMTest(port) : super('http://127.0.0.1:$port/vm'); | |
| 50 | |
| 51 String _isolateId; | |
| 52 onRequestCompleted(Map reply) { | |
| 53 VMTester tester = new VMTester(reply); | |
| 54 tester.checkIsolateCount(2); | |
| 55 // TODO(turnidge): Fragile. Relies on isolate order in response. | |
| 56 _isolateId = tester.getIsolateId(0); | |
| 57 } | |
| 58 } | |
| 59 | |
| 60 main() { | |
| 61 var process = new TestLauncher('isolate_stacktrace_command_script.dart'); | |
| 62 process.launch().then((port) { | |
| 63 var test = new VMTest(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 |