| 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_list_test; | 5 library isolate_class_list_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 BananaClassTest { | 11 class BananaClassTest { |
| 12 int port; | 12 int port; |
| 13 int isolate_id; | 13 String isolate_id; |
| 14 int class_id; | 14 String class_id; |
| 15 BananaClassTest(this.port, this.isolate_id, this.class_id); | 15 BananaClassTest(this.port, this.isolate_id, this.class_id); |
| 16 | 16 |
| 17 _testFieldA(Map field) { | 17 _testFieldA(Map field) { |
| 18 Expect.equals('Field', field['type']); | 18 Expect.equals('Field', field['type']); |
| 19 Expect.equals('a', field['user_name']); | 19 Expect.equals('a', field['user_name']); |
| 20 Expect.equals('a', field['name']); | 20 Expect.equals('a', field['name']); |
| 21 Expect.equals(false, field['final']); | 21 Expect.equals(false, field['final']); |
| 22 Expect.equals(false, field['static']); | 22 Expect.equals(false, field['static']); |
| 23 Expect.equals(false, field['const']); | 23 Expect.equals(false, field['const']); |
| 24 Expect.equals('dynamic', field['guard_class']); | 24 Expect.equals('dynamic', field['guard_class']); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 _testFieldA(helper.fields['a']); | 68 _testFieldA(helper.fields['a']); |
| 69 _testFieldFinalFixedLengthList(helper.fields['final_fixed_length_list']); | 69 _testFieldFinalFixedLengthList(helper.fields['final_fixed_length_list']); |
| 70 _testFieldFixedLengthList(helper.fields['fixed_length_list']); | 70 _testFieldFixedLengthList(helper.fields['fixed_length_list']); |
| 71 _testFieldName(helper.fields['name']); | 71 _testFieldName(helper.fields['name']); |
| 72 }); | 72 }); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 class BadBananaClassTest { | 76 class BadBananaClassTest { |
| 77 int port; | 77 int port; |
| 78 int isolate_id; | 78 String isolate_id; |
| 79 int class_id; | 79 String class_id; |
| 80 BadBananaClassTest(this.port, this.isolate_id, this.class_id); | 80 BadBananaClassTest(this.port, this.isolate_id, this.class_id); |
| 81 | 81 |
| 82 _testFieldV(Map field) { | 82 _testFieldV(Map field) { |
| 83 Expect.equals('Field', field['type']); | 83 Expect.equals('Field', field['type']); |
| 84 Expect.equals('v', field['user_name']); | 84 Expect.equals('v', field['user_name']); |
| 85 Expect.equals('v', field['name']); | 85 Expect.equals('v', field['name']); |
| 86 Expect.equals(false, field['final']); | 86 Expect.equals(false, field['final']); |
| 87 Expect.equals(false, field['static']); | 87 Expect.equals(false, field['static']); |
| 88 Expect.equals(false, field['const']); | 88 Expect.equals(false, field['const']); |
| 89 Expect.equals('double', field['guard_class']['user_name']); | 89 Expect.equals('double', field['guard_class']['user_name']); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 _testFieldV(helper.fields['v']); | 133 _testFieldV(helper.fields['v']); |
| 134 _testFieldC(helper.fields['c']); | 134 _testFieldC(helper.fields['c']); |
| 135 _testFieldFinalFixedLengthList(helper.fields['final_fixed_length_list']); | 135 _testFieldFinalFixedLengthList(helper.fields['final_fixed_length_list']); |
| 136 _testFieldFixedLengthArray(helper.fields['fixed_length_array']); | 136 _testFieldFixedLengthArray(helper.fields['fixed_length_array']); |
| 137 }); | 137 }); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 class ClassTableTest extends VmServiceRequestHelper { | 141 class ClassTableTest extends VmServiceRequestHelper { |
| 142 ClassTableTest(port, id) : | 142 ClassTableTest(port, id) : |
| 143 super('http://127.0.0.1:$port/isolates/$id/classes/'); | 143 super('http://127.0.0.1:$port/$id/classes/'); |
| 144 | 144 |
| 145 int banana_class_id; | 145 String banana_class_id; |
| 146 int bad_banana_class_id; | 146 String bad_banana_class_id; |
| 147 | 147 |
| 148 onRequestCompleted(Map reply) { | 148 onRequestCompleted(Map reply) { |
| 149 ClassTableHelper helper = new ClassTableHelper(reply); | 149 ClassTableHelper helper = new ClassTableHelper(reply); |
| 150 Expect.isTrue(helper.classExists('Banana')); | 150 Expect.isTrue(helper.classExists('Banana')); |
| 151 banana_class_id = helper.classId('Banana'); | 151 banana_class_id = helper.classId('Banana'); |
| 152 Expect.isTrue(helper.classExists('BadBanana')); | 152 Expect.isTrue(helper.classExists('BadBanana')); |
| 153 bad_banana_class_id = helper.classId('BadBanana'); | 153 bad_banana_class_id = helper.classId('BadBanana'); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 class IsolateListTest extends VmServiceRequestHelper { | 157 class IsolateListTest extends VmServiceRequestHelper { |
| 158 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); | 158 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); |
| 159 | 159 |
| 160 int _isolateId; | 160 String _isolateId; |
| 161 onRequestCompleted(Map reply) { | 161 onRequestCompleted(Map reply) { |
| 162 IsolateListTester tester = new IsolateListTester(reply); | 162 IsolateListTester tester = new IsolateListTester(reply); |
| 163 tester.checkIsolateCount(1); | 163 tester.checkIsolateCount(1); |
| 164 tester.checkIsolateNameContains('field_script.dart'); | 164 tester.checkIsolateNameContains('field_script.dart'); |
| 165 _isolateId = tester.checkIsolateNameContains('field_script'); | 165 _isolateId = tester.checkIsolateNameContains('field_script'); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 main() { | 169 main() { |
| 170 var process = new TestLauncher('field_script.dart'); | 170 var process = new TestLauncher('field_script.dart'); |
| 171 process.launch().then((port) { | 171 process.launch().then((port) { |
| 172 var test = new IsolateListTest(port); | 172 var test = new IsolateListTest(port); |
| 173 test.makeRequest().then((_) { | 173 test.makeRequest().then((_) { |
| 174 var classTableTest = new ClassTableTest(port, test._isolateId); | 174 var classTableTest = new ClassTableTest(port, test._isolateId); |
| 175 classTableTest.makeRequest().then((_) { | 175 classTableTest.makeRequest().then((_) { |
| 176 var bananaClassTest = | 176 var bananaClassTest = |
| 177 new BananaClassTest(port, test._isolateId, | 177 new BananaClassTest(port, test._isolateId, |
| 178 classTableTest.banana_class_id); | 178 classTableTest.banana_class_id); |
| 179 var badBananaClassTest = | 179 var badBananaClassTest = |
| 180 new BadBananaClassTest(port, test._isolateId, | 180 new BadBananaClassTest(port, test._isolateId, |
| 181 classTableTest.bad_banana_class_id); | 181 classTableTest.bad_banana_class_id); |
| 182 Future.wait([bananaClassTest.makeRequest(), | 182 Future.wait([bananaClassTest.makeRequest(), |
| 183 badBananaClassTest.makeRequest()]).then((_) { | 183 badBananaClassTest.makeRequest()]).then((_) { |
| 184 process.requestExit(); | 184 process.requestExit(); |
| 185 }); | 185 }); |
| 186 }); | 186 }); |
| 187 }); | 187 }); |
| 188 }); | 188 }); |
| 189 } | 189 } |
| OLD | NEW |