53af406764
Fixes https://github.com/dart-lang/sdk/issues/54586 Change-Id: Ide277dc7db1fe85a35a2a7d8cc0ad7ec70c10688 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347141 Reviewed-by: Derek Xu <derekx@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
39 lines
1.1 KiB
Dart
39 lines
1.1 KiB
Dart
// Copyright (c) 2019, 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';
|
|
|
|
final tests = <VMTest>[
|
|
(VmService service) async {
|
|
final vm = await service.getVM();
|
|
final result = await service.getMemoryUsage(vm.isolates!.first.id!);
|
|
expect(result.heapUsage, isPositive);
|
|
expect(result.heapCapacity, isPositive);
|
|
expect(result.externalUsage, greaterThanOrEqualTo(0));
|
|
},
|
|
(VmService service) async {
|
|
bool? caughtException;
|
|
try {
|
|
await service.getMemoryUsage('badid');
|
|
fail('Unreachable');
|
|
} on RPCError catch (e) {
|
|
caughtException = true;
|
|
expect(
|
|
e.details,
|
|
contains("getMemoryUsage: invalid 'isolateId' parameter: badid"),
|
|
);
|
|
}
|
|
expect(caughtException, isTrue);
|
|
},
|
|
];
|
|
|
|
void main([args = const <String>[]]) => runVMTests(
|
|
args,
|
|
tests,
|
|
'get_memory_usage_test.dart',
|
|
);
|