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 CodeATest extends VmServiceRequestHelper { |
| 12 CodeATest(port, id, codeId) : |
| 13 super('http://127.0.0.1:$port/isolates/$id/codes/$codeId'); |
| 14 |
| 15 onRequestCompleted(Map reply) { |
| 16 Expect.equals('Code', reply['type']); |
| 17 Expect.equals('a', reply['function']['name']); |
| 18 Expect.isTrue(reply['disassembly'].length > 0); |
| 19 } |
| 20 } |
| 21 |
| 22 class CodeCTest extends VmServiceRequestHelper { |
| 23 CodeCTest(port, id, codeId) : |
| 24 super('http://127.0.0.1:$port/isolates/$id/codes/$codeId'); |
| 25 |
| 26 onRequestCompleted(Map reply) { |
| 27 Expect.equals('Code', reply['type']); |
| 28 Expect.equals('C.c', reply['function']['name']); |
| 29 Expect.isTrue(reply['disassembly'].length > 0); |
| 30 } |
| 31 } |
| 32 |
| 33 class StackTraceTest extends VmServiceRequestHelper { |
| 34 StackTraceTest(port, id) : |
| 35 super('http://127.0.0.1:$port/isolates/$id/stacktrace'); |
| 36 |
| 37 int _aId; |
| 38 int _cId; |
| 39 onRequestCompleted(Map reply) { |
| 40 Expect.equals('StackTrace', reply['type']); |
| 41 List members = reply['members']; |
| 42 Expect.equals('a', members[0]['name']); |
| 43 _aId = members[0]['code']['id']; |
| 44 Expect.equals('c', members[2]['name']); |
| 45 _cId = members[2]['code']['id']; |
| 46 } |
| 47 } |
| 48 |
| 49 class IsolateListTest extends VmServiceRequestHelper { |
| 50 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); |
| 51 |
| 52 int _isolateId; |
| 53 onRequestCompleted(Map reply) { |
| 54 IsolateListTester tester = new IsolateListTester(reply); |
| 55 tester.checkIsolateCount(2); |
| 56 tester.checkIsolateNameContains('isolate_stacktrace_command_script.dart'); |
| 57 _isolateId = tester.checkIsolateNameContains('myIsolateName'); |
| 58 } |
| 59 } |
| 60 |
| 61 main() { |
| 62 var process = new TestLauncher('isolate_stacktrace_command_script.dart'); |
| 63 process.launch().then((port) { |
| 64 var test = new IsolateListTest(port); |
| 65 test.makeRequest().then((_) { |
| 66 var stackTraceTest = |
| 67 new StackTraceTest(port, test._isolateId); |
| 68 stackTraceTest.makeRequest().then((_) { |
| 69 var codeATest = new CodeATest(port, test._isolateId, |
| 70 stackTraceTest._aId); |
| 71 var codeCTest = new CodeCTest(port, test._isolateId, |
| 72 stackTraceTest._cId); |
| 73 var requests = Future.wait([codeATest.makeRequest(), |
| 74 codeCTest.makeRequest()]); |
| 75 requests.then((_) { |
| 76 process.requestExit(); |
| 77 }); |
| 78 }); |
| 79 }); |
| 80 }); |
| 81 } |
OLD | NEW |