blob: 6fedbecb8d45c9fd838634bc38e7eee1ea962fb4 [file] [log] [blame]
// Copyright (c) 2018, 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:async/async.dart';
import 'package:vm_service/vm_service.dart';
import 'package:test_core/src/runner/environment.dart'; // ignore: implementation_imports
/// The environment in which VM tests are loaded.
class VMEnvironment implements Environment {
final supportsDebugging = true;
final Uri observatoryUrl;
/// The VM service isolate object used to control this isolate.
final IsolateRef _isolate;
final VmService _client;
VMEnvironment(this.observatoryUrl, this._isolate, this._client);
Uri get remoteDebuggerUrl => null;
Stream get onRestart => StreamController.broadcast().stream;
CancelableOperation displayPause() {
var completer =
CancelableCompleter(onCancel: () => _client.resume(;
completer.complete(_client.pause( => _client
.firstWhere((event) => event.kind == EventKind.kResume)));
return completer.operation;