22// for details. All rights reserved. Use of this source code is governed by a
33// BSD-style license that can be found in the LICENSE file.
44
5- import 'dart:async' ;
65@TestOn ('vm' )
6+ import 'dart:async' ;
77import 'dart:convert' ;
88import 'dart:io' ;
99
1010import 'package:dwds/src/chrome_proxy_service.dart' ;
11-
1211import 'package:http/http.dart' as http;
1312import 'package:pedantic/pedantic.dart' ;
1413import 'package:test/test.dart' ;
@@ -183,14 +182,17 @@ void main() {
183182 expect (result, const TypeMatcher <Isolate >());
184183 var isolate = result as Isolate ;
185184 expect (isolate.name, contains (context.appUrl));
186- expect (isolate.rootLib.uri, 'hello_world/main.dart' );
185+ // TODO: library names change with kernel dart-lang/sdk#36736
186+ expect (isolate.rootLib.uri, endsWith ('main.dart' ));
187+
187188 expect (
188189 isolate.libraries,
189190 containsAll ([
190- predicate ((LibraryRef lib) => lib.uri == 'dart:core' ),
191- predicate ((LibraryRef lib) => lib.uri == 'dart:html' ),
192- predicate ((LibraryRef lib) => lib.uri == 'package:path/path.dart' ),
193- predicate ((LibraryRef lib) => lib.uri == 'hello_world/main.dart' ),
191+ _libRef ('dart:core' ),
192+ _libRef ('dart:html' ),
193+ _libRef ('package:path/path.dart' ),
194+ // TODO: library names change with kernel dart-lang/sdk#36736
195+ _libRef (endsWith ('main.dart' )),
194196 ]));
195197 expect (isolate.extensionRPCs, contains ('ext.hello_world.existing' ));
196198 });
@@ -212,7 +214,8 @@ void main() {
212214
213215 test ('Libraries' , () async {
214216 expect (rootLibrary, isNotNull);
215- expect (rootLibrary.uri, 'hello_world/main.dart' );
217+ // TODO: library names change with kernel dart-lang/sdk#36736
218+ expect (rootLibrary.uri, endsWith ('main.dart' ));
216219 expect (rootLibrary.classes.length, 1 );
217220 var testClass = rootLibrary.classes.first;
218221 expect (testClass.name, 'MyTestClass' );
@@ -336,11 +339,11 @@ void main() {
336339 test ('setExceptionPauseMode' , () async {
337340 var vm = await service.getVM ();
338341 var isolateId = vm.isolates.first.id;
339- expect (await service.setExceptionPauseMode (isolateId, 'all' ), isSuccess );
340- expect (
341- await service. setExceptionPauseMode (isolateId, 'unhandled' ), isSuccess );
342+ expect (await service.setExceptionPauseMode (isolateId, 'all' ), _isSuccess );
343+ expect (await service. setExceptionPauseMode (isolateId, 'unhandled' ),
344+ _isSuccess );
342345 // Make sure this is the last one - or future tests might hang.
343- expect (await service.setExceptionPauseMode (isolateId, 'none' ), isSuccess );
346+ expect (await service.setExceptionPauseMode (isolateId, 'none' ), _isSuccess );
344347 expect (
345348 service.setExceptionPauseMode (isolateId, 'invalid' ),
346349 throwsA (isA <RPCError >()
@@ -359,13 +362,13 @@ void main() {
359362 test ('setName' , () async {
360363 var vm = await service.getVM ();
361364 var isolateId = vm.isolates.first.id;
362- expect (service.setName (isolateId, 'test' ), completion (isSuccess ));
365+ expect (service.setName (isolateId, 'test' ), completion (_isSuccess ));
363366 var isolate = await service.getIsolate (isolateId);
364367 expect (isolate.name, 'test' );
365368 });
366369
367370 test ('setVMName' , () async {
368- expect (service.setVMName ('foo' ), completion (isSuccess ));
371+ expect (service.setVMName ('foo' ), completion (_isSuccess ));
369372 var vm = await service.getVM ();
370373 expect (vm.name, 'foo' );
371374 });
@@ -389,7 +392,7 @@ void main() {
389392 });
390393
391394 test ('basic Pause/Resume' , () async {
392- expect (service.streamListen ('Debug' ), completion (isSuccess ));
395+ expect (service.streamListen ('Debug' ), completion (_isSuccess ));
393396 var stream = service.onEvent ('Debug' );
394397 unawaited (tabConnection.debugger.pause ());
395398 await expectLater (
@@ -420,7 +423,7 @@ void main() {
420423 });
421424
422425 test ('Extension' , () async {
423- expect (service.streamListen ('Extension' ), completion (isSuccess ));
426+ expect (service.streamListen ('Extension' ), completion (_isSuccess ));
424427 var stream = service.onEvent ('Extension' );
425428 var eventKind = 'my.custom.event' ;
426429 expect (
@@ -433,14 +436,14 @@ void main() {
433436 });
434437
435438 test ('GC' , () async {
436- expect (service.streamListen ('GC' ), completion (isSuccess ));
439+ expect (service.streamListen ('GC' ), completion (_isSuccess ));
437440 });
438441
439442 group ('Isolate' , () {
440443 Stream <Event > isolateEventStream;
441444
442445 setUp (() async {
443- expect (await service.streamListen ('Isolate' ), isSuccess );
446+ expect (await service.streamListen ('Isolate' ), _isSuccess );
444447 isolateEventStream = service.onEvent ('Isolate' );
445448 });
446449
@@ -480,11 +483,11 @@ void main() {
480483 });
481484
482485 test ('Timeline' , () async {
483- expect (service.streamListen ('Timeline' ), completion (isSuccess ));
486+ expect (service.streamListen ('Timeline' ), completion (_isSuccess ));
484487 });
485488
486489 test ('Stdout' , () async {
487- expect (service.streamListen ('Stdout' ), completion (isSuccess ));
490+ expect (service.streamListen ('Stdout' ), completion (_isSuccess ));
488491 expect (
489492 service.onEvent ('Stdout' ),
490493 emitsThrough (predicate ((Event event) =>
@@ -495,7 +498,7 @@ void main() {
495498 });
496499
497500 test ('Stderr' , () async {
498- expect (service.streamListen ('Stderr' ), completion (isSuccess ));
501+ expect (service.streamListen ('Stderr' ), completion (_isSuccess ));
499502 var stderrStream = service.onEvent ('Stderr' );
500503 expect (
501504 stderrStream,
@@ -508,7 +511,7 @@ void main() {
508511
509512 test ('VM' , () async {
510513 var status = await service.streamListen ('VM' );
511- expect (status, isSuccess );
514+ expect (status, _isSuccess );
512515 var stream = service.onEvent ('VM' );
513516 expect (
514517 stream,
@@ -519,4 +522,7 @@ void main() {
519522 });
520523}
521524
522- const isSuccess = TypeMatcher <Success >();
525+ final _isSuccess = isA <Success >();
526+
527+ TypeMatcher _libRef (uriMatcher) =>
528+ isA <LibraryRef >().having ((l) => l.uri, 'uri' , uriMatcher);
0 commit comments