e3ca6d824b
Brings pass rate of package:vm_service tests to ~85% TEST=Manual Change-Id: I2335d98358362110add93c2acfe51c3fc1385237 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487560 Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
42 lines
1.3 KiB
Dart
42 lines
1.3 KiB
Dart
// Copyright (c) 2023, 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 'package:test/test.dart';
|
|
import 'package:vm_service/vm_service.dart';
|
|
|
|
import 'common/test_helper.dart';
|
|
|
|
const kEchoStream = '_Echo';
|
|
|
|
final tests = <VMTest>[
|
|
// Check double subscription fails.
|
|
(VmService service) async {
|
|
await service.streamListen(kEchoStream);
|
|
try {
|
|
await service.streamListen(kEchoStream);
|
|
fail('Subscribed to stream twice');
|
|
} on RPCError catch (e) {
|
|
expect(e.code, RPCErrorKind.kStreamAlreadySubscribed.code);
|
|
expect(e.message, contains('Stream already subscribed'));
|
|
}
|
|
},
|
|
// Check double cancellation fails.
|
|
(VmService service) async {
|
|
await service.streamCancel(kEchoStream);
|
|
try {
|
|
await service.streamCancel(kEchoStream);
|
|
fail('Double cancellation of stream successful');
|
|
} on RPCError catch (e) {
|
|
expect(e.code, RPCErrorKind.kStreamNotSubscribed.code);
|
|
expect(e.message, contains('Stream not subscribed'));
|
|
}
|
|
},
|
|
];
|
|
|
|
void main([args = const <String>[]]) => runVMTests(
|
|
args,
|
|
tests,
|
|
'stream_subscription_test.dart',
|
|
);
|