66@Timeout (Duration (minutes: 2 ))
77import 'dart:async' ;
88
9- import 'package:dwds/src/connections/debug_connection.dart' ;
109import 'package:dwds/src/services/chrome_proxy_service.dart' ;
1110import 'package:test/test.dart' ;
1211import 'package:test_common/logging.dart' ;
1312import 'package:vm_service/vm_service.dart' ;
14- import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' ;
1513
1614import 'fixtures/context.dart' ;
17-
18- class TestSetup {
19- static final contextUnsound = TestContext .withWeakNullSafety (
20- packageName: '_testPackage' ,
21- webAssetsPath: 'web' ,
22- dartEntryFileName: 'main.dart' ,
23- htmlEntryFileName: 'index.html' ,
24- );
25-
26- static final contextSound = TestContext .withSoundNullSafety (
27- packageName: '_testPackageSound' ,
28- webAssetsPath: 'web' ,
29- dartEntryFileName: 'main.dart' ,
30- htmlEntryFileName: 'index.html' ,
31- );
32-
33- TestContext context;
34-
35- TestSetup .sound () : context = contextSound;
36-
37- TestSetup .unsound () : context = contextUnsound;
38-
39- ChromeProxyService get service =>
40- fetchChromeProxyService (context.debugConnection);
41- WipConnection get tabConnection => context.tabConnection;
42- }
15+ import 'fixtures/project.dart' ;
4316
4417void main () {
4518 group (
@@ -50,10 +23,8 @@ void main() {
5023
5124 for (var nullSafety in NullSafety .values) {
5225 group ('${nullSafety .name } null safety |' , () {
53- final soundNullSafety = nullSafety == NullSafety .sound;
54- final setup =
55- soundNullSafety ? TestSetup .sound () : TestSetup .unsound ();
56- final context = setup.context;
26+ final project = TestProject .testPackage (nullSafety: nullSafety);
27+ final context = TestContext (project);
5728
5829 setUpAll (() async {
5930 setCurrentLogWriter (debug: debug);
@@ -79,17 +50,15 @@ void main() {
7950
8051 setUp (() async {
8152 setCurrentLogWriter (debug: debug);
82- service = setup .service;
53+ service = context .service;
8354 vm = await service.getVM ();
8455 isolate = await service.getIsolate (vm.isolates! .first.id! );
8556 scripts = await service.getScripts (isolate.id! );
8657
8758 await service.streamListen ('Debug' );
8859 stream = service.onEvent ('Debug' );
8960
90- final testPackage =
91- soundNullSafety ? '_test_package_sound' : '_test_package' ;
92-
61+ final testPackage = project.packageName;
9362 mainScript = scripts.scripts!
9463 .firstWhere ((each) => each.uri! .contains ('main.dart' ));
9564 testLibraryScript = scripts.scripts! .firstWhere ((each) =>
@@ -108,8 +77,8 @@ void main() {
10877 final script = breakpoint.script;
10978 final line =
11079 await context.findBreakpointLine (bpId, isolate.id! , script);
111- bp = await setup. service
112- . addBreakpointWithScriptUri ( isolate.id! , script.uri! , line);
80+ bp = await service. addBreakpointWithScriptUri (
81+ isolate.id! , script.uri! , line);
11382
11483 expect (bp, isNotNull);
11584 expect (bp.location, _matchBpLocation (script, line, 0 ));
@@ -121,7 +90,7 @@ void main() {
12190 } finally {
12291 // Remove breakpoint so it doesn't impact other tests or retries.
12392 if (bp != null ) {
124- await setup. service.removeBreakpoint (isolate.id! , bp.id! );
93+ await service.removeBreakpoint (isolate.id! , bp.id! );
12594 }
12695 }
12796 }
0 commit comments