@@ -15,7 +15,6 @@ import 'package:test_common/logging.dart';
15
15
import 'package:test_common/test_sdk_configuration.dart' ;
16
16
import 'package:vm_service/vm_service.dart' ;
17
17
import 'package:vm_service_interface/vm_service_interface.dart' ;
18
- import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' ;
19
18
20
19
import 'fixtures/context.dart' ;
21
20
import 'fixtures/project.dart' ;
@@ -91,9 +90,6 @@ void main() {
91
90
late VmService client;
92
91
late VmServiceInterface service;
93
92
late Stream <Event > stream;
94
- // Fetch the log statements that are sent to console.
95
- final consoleLogs = < String > [];
96
- late StreamSubscription <ConsoleAPIEvent > consoleSubscription;
97
93
98
94
setUp (() async {
99
95
setCurrentLogWriter (debug: debug);
@@ -110,14 +106,9 @@ void main() {
110
106
service = context.service;
111
107
await service.streamListen ('Debug' );
112
108
stream = service.onEvent ('Debug' );
113
- consoleSubscription = context.webkitDebugger.onConsoleAPICalled.listen (
114
- (e) => consoleLogs.add (e.args.first.value as String ),
115
- );
116
109
});
117
110
118
111
tearDown (() async {
119
- await consoleSubscription.cancel ();
120
- consoleLogs.clear ();
121
112
undoEdits ();
122
113
await context.tearDown ();
123
114
});
@@ -254,11 +245,8 @@ void main() {
254
245
255
246
// Should break at `callLog`.
256
247
await breakpointFuture;
257
- expect (consoleLogs.contains (oldString), false );
258
248
await resumeAndExpectLog (oldString);
259
249
260
- consoleLogs.clear ();
261
-
262
250
// Modify the string that gets printed.
263
251
await makeEditAndRecompile (mainFile, oldString, newString);
264
252
@@ -272,7 +260,6 @@ void main() {
272
260
273
261
// Should break at `callLog`.
274
262
await breakpointFuture;
275
- expect (consoleLogs.contains (newString), false );
276
263
await resumeAndExpectLog (newString);
277
264
});
278
265
@@ -291,11 +278,8 @@ void main() {
291
278
292
279
// Should break at `callLog`.
293
280
await breakpointFuture;
294
- expect (consoleLogs.contains (genLog), false );
295
281
await resumeAndExpectLog (genLog);
296
282
297
- consoleLogs.clear ();
298
-
299
283
// Add an extra log before the existing log.
300
284
final extraLog = 'hot reload' ;
301
285
final oldString = "log('" ;
@@ -309,15 +293,12 @@ void main() {
309
293
310
294
breakpointFuture = waitForBreakpoint ();
311
295
312
- await callEvaluate ( );
296
+ await callEvaluateAndExpectLog (extraLog );
313
297
314
298
// Should break at `callLog`.
315
299
await breakpointFuture;
316
- expect (consoleLogs.contains (extraLog), true );
317
300
await resumeAndExpectLog (genLog);
318
301
319
- consoleLogs.clear ();
320
-
321
302
// Remove the line we just added.
322
303
await makeEditAndRecompile (mainFile, newString, oldString);
323
304
@@ -327,12 +308,19 @@ void main() {
327
308
328
309
breakpointFuture = waitForBreakpoint ();
329
310
311
+ final consoleLogs = < String > [];
312
+ final consoleSubscription = context.webkitDebugger.onConsoleAPICalled
313
+ .listen ((e) {
314
+ consoleLogs.add (e.args.first.value as String );
315
+ });
316
+
330
317
await callEvaluate ();
331
318
332
319
// Should break at `callLog`.
333
320
await breakpointFuture;
334
321
expect (consoleLogs.contains (extraLog), false );
335
322
await resumeAndExpectLog (genLog);
323
+ await consoleSubscription.cancel ();
336
324
});
337
325
338
326
test (
@@ -352,11 +340,8 @@ void main() {
352
340
353
341
// Should break at `callLog`.
354
342
await breakpointFuture;
355
- expect (consoleLogs.contains (genLog), false );
356
343
await resumeAndExpectLog (genLog);
357
344
358
- consoleLogs.clear ();
359
-
360
345
// Add a library file, import it, and then refer to it in the log.
361
346
final libFile = 'library.dart' ;
362
347
final libGenLog = 'lib gen0' ;
@@ -387,14 +372,12 @@ void main() {
387
372
388
373
// Should break at `callLog`.
389
374
await breakpointFuture;
390
- expect (consoleLogs.contains (libGenLog), false );
391
375
392
376
breakpointFuture = waitForBreakpoint ();
393
377
394
378
await resume ();
395
379
// Should break at `libValue`.
396
380
await breakpointFuture;
397
- expect (consoleLogs.contains (libGenLog), false );
398
381
await resumeAndExpectLog (libGenLog);
399
382
400
383
context.removeLibraryFile (libFileName: libFile);
@@ -423,7 +406,6 @@ void main() {
423
406
// Should break at `capturedString`.
424
407
await breakpointFuture;
425
408
final oldCapturedString = 'captured closure gen0' ;
426
- expect (consoleLogs.contains (oldCapturedString), false );
427
409
// Closure gets evaluated for the first time.
428
410
await resumeAndExpectLog (oldCapturedString);
429
411
0 commit comments