OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:async/async.dart'; | 7 import 'package:async/async.dart'; |
8 import 'package:json_rpc_2/json_rpc_2.dart' as rpc; | 8 import 'package:json_rpc_2/json_rpc_2.dart' as rpc; |
9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
10 import 'package:vm_service_client/vm_service_client.dart'; | 10 import 'package:vm_service_client/vm_service_client.dart'; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 await other.load(); | 160 await other.load(); |
161 } on VMSentinelException catch (_) { | 161 } on VMSentinelException catch (_) { |
162 break; | 162 break; |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 expect(other.onExit, completes); | 166 expect(other.onExit, completes); |
167 }); | 167 }); |
168 }); | 168 }); |
169 | 169 |
170 test("onServiceExtensionAdded fires when an extension is added", () async { | 170 test("onExtensionAdded fires when an extension is added", () async { |
171 client = await runAndConnect(main: """ | 171 client = await runAndConnect(main: """ |
172 registerExtension('ext.test', (_, __) {}); | 172 registerExtension('ext.test', (_, __) {}); |
173 """, flags: ["--pause-isolates-on-start"]); | 173 """, flags: ["--pause-isolates-on-start"]); |
174 | 174 |
175 var isolate = await (await client.getVM()).isolates.first.loadRunnable(); | 175 var isolate = await (await client.getVM()).isolates.first.loadRunnable(); |
176 await isolate.waitUntilPaused(); | 176 await isolate.waitUntilPaused(); |
177 await isolate.resume(); | 177 await isolate.resume(); |
178 | 178 |
179 expect(await isolate.onServiceExtensionAdded.first, equals('ext.test')); | 179 expect(await isolate.onExtensionAdded.first, equals('ext.test')); |
180 }); | 180 }); |
181 | 181 |
182 group("onExtensionEvent", () { | 182 group("onExtensionEvent", () { |
183 test("emits extension events", () async { | 183 test("emits extension events", () async { |
184 client = await runAndConnect(main: """ | 184 client = await runAndConnect(main: """ |
185 postEvent('foo', {'bar': 'baz'}); | 185 postEvent('foo', {'bar': 'baz'}); |
186 """, flags: ["--pause-isolates-on-start"]); | 186 """, flags: ["--pause-isolates-on-start"]); |
187 | 187 |
188 var isolate = await (await client.getVM()).isolates.first.load(); | 188 var isolate = await (await client.getVM()).isolates.first.load(); |
189 await isolate.waitUntilPaused(); | 189 await isolate.waitUntilPaused(); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 var vm = await client.getVM(); | 541 var vm = await client.getVM(); |
542 var main = vm.isolates.first; | 542 var main = vm.isolates.first; |
543 | 543 |
544 var otherFuture = client.onIsolateRunnable.first; | 544 var otherFuture = client.onIsolateRunnable.first; |
545 await main.resume(); | 545 await main.resume(); |
546 var other = await otherFuture; | 546 var other = await otherFuture; |
547 await other.resume(); | 547 await other.resume(); |
548 | 548 |
549 return [main, other]; | 549 return [main, other]; |
550 } | 550 } |
OLD | NEW |