@@ -15,7 +15,6 @@ import 'package:test_common/logging.dart';
1515import 'package:test_common/test_sdk_configuration.dart' ;
1616import 'package:vm_service/vm_service.dart' ;
1717import 'package:vm_service_interface/vm_service_interface.dart' ;
18- import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' ;
1918
2019import 'fixtures/context.dart' ;
2120import 'fixtures/project.dart' ;
@@ -91,9 +90,6 @@ void main() {
9190 late VmService client;
9291 late VmServiceInterface service;
9392 late Stream <Event > stream;
94- // Fetch the log statements that are sent to console.
95- final consoleLogs = < String > [];
96- late StreamSubscription <ConsoleAPIEvent > consoleSubscription;
9793
9894 setUp (() async {
9995 setCurrentLogWriter (debug: debug);
@@ -110,14 +106,9 @@ void main() {
110106 service = context.service;
111107 await service.streamListen ('Debug' );
112108 stream = service.onEvent ('Debug' );
113- consoleSubscription = context.webkitDebugger.onConsoleAPICalled.listen (
114- (e) => consoleLogs.add (e.args.first.value as String ),
115- );
116109 });
117110
118111 tearDown (() async {
119- await consoleSubscription.cancel ();
120- consoleLogs.clear ();
121112 undoEdits ();
122113 await context.tearDown ();
123114 });
@@ -254,11 +245,8 @@ void main() {
254245
255246 // Should break at `callLog`.
256247 await breakpointFuture;
257- expect (consoleLogs.contains (oldString), false );
258248 await resumeAndExpectLog (oldString);
259249
260- consoleLogs.clear ();
261-
262250 // Modify the string that gets printed.
263251 await makeEditAndRecompile (mainFile, oldString, newString);
264252
@@ -272,7 +260,6 @@ void main() {
272260
273261 // Should break at `callLog`.
274262 await breakpointFuture;
275- expect (consoleLogs.contains (newString), false );
276263 await resumeAndExpectLog (newString);
277264 });
278265
@@ -291,11 +278,8 @@ void main() {
291278
292279 // Should break at `callLog`.
293280 await breakpointFuture;
294- expect (consoleLogs.contains (genLog), false );
295281 await resumeAndExpectLog (genLog);
296282
297- consoleLogs.clear ();
298-
299283 // Add an extra log before the existing log.
300284 final extraLog = 'hot reload' ;
301285 final oldString = "log('" ;
@@ -309,15 +293,12 @@ void main() {
309293
310294 breakpointFuture = waitForBreakpoint ();
311295
312- await callEvaluate ( );
296+ await callEvaluateAndExpectLog (extraLog );
313297
314298 // Should break at `callLog`.
315299 await breakpointFuture;
316- expect (consoleLogs.contains (extraLog), true );
317300 await resumeAndExpectLog (genLog);
318301
319- consoleLogs.clear ();
320-
321302 // Remove the line we just added.
322303 await makeEditAndRecompile (mainFile, newString, oldString);
323304
@@ -327,12 +308,19 @@ void main() {
327308
328309 breakpointFuture = waitForBreakpoint ();
329310
311+ final consoleLogs = < String > [];
312+ final consoleSubscription = context.webkitDebugger.onConsoleAPICalled
313+ .listen ((e) {
314+ consoleLogs.add (e.args.first.value as String );
315+ });
316+
330317 await callEvaluate ();
331318
332319 // Should break at `callLog`.
333320 await breakpointFuture;
334321 expect (consoleLogs.contains (extraLog), false );
335322 await resumeAndExpectLog (genLog);
323+ await consoleSubscription.cancel ();
336324 });
337325
338326 test (
@@ -352,11 +340,8 @@ void main() {
352340
353341 // Should break at `callLog`.
354342 await breakpointFuture;
355- expect (consoleLogs.contains (genLog), false );
356343 await resumeAndExpectLog (genLog);
357344
358- consoleLogs.clear ();
359-
360345 // Add a library file, import it, and then refer to it in the log.
361346 final libFile = 'library.dart' ;
362347 final libGenLog = 'lib gen0' ;
@@ -387,14 +372,12 @@ void main() {
387372
388373 // Should break at `callLog`.
389374 await breakpointFuture;
390- expect (consoleLogs.contains (libGenLog), false );
391375
392376 breakpointFuture = waitForBreakpoint ();
393377
394378 await resume ();
395379 // Should break at `libValue`.
396380 await breakpointFuture;
397- expect (consoleLogs.contains (libGenLog), false );
398381 await resumeAndExpectLog (libGenLog);
399382
400383 context.removeLibraryFile (libFileName: libFile);
@@ -423,7 +406,6 @@ void main() {
423406 // Should break at `capturedString`.
424407 await breakpointFuture;
425408 final oldCapturedString = 'captured closure gen0' ;
426- expect (consoleLogs.contains (oldCapturedString), false );
427409 // Closure gets evaluated for the first time.
428410 await resumeAndExpectLog (oldCapturedString);
429411
0 commit comments