mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:49:47 +00:00
c687db6ff5
Change-Id: I5431bdd2277538a1836cac9c1ba8d19fcfd2626a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240914 Reviewed-by: Ben Konyi <bkonyi@google.com> Commit-Queue: Devon Carew <devoncarew@google.com>
29 lines
827 B
Dart
29 lines
827 B
Dart
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:async';
|
|
|
|
import 'package:test/test.dart';
|
|
import 'package:vm_service/vm_service.dart';
|
|
|
|
void main() {
|
|
test('Call dispose handler before onDone completion', () async {
|
|
final controller = StreamController<String>(onCancel: () async {
|
|
await Future.delayed(const Duration(seconds: 1));
|
|
});
|
|
bool completed = false;
|
|
final fakeService = VmService(
|
|
controller.stream,
|
|
controller.sink.add,
|
|
disposeHandler: () async {
|
|
completed = true;
|
|
},
|
|
);
|
|
|
|
unawaited(fakeService.dispose());
|
|
await fakeService.onDone;
|
|
expect(completed, true);
|
|
});
|
|
}
|