blob: 5f8b3fd2f71206defe375c481886ed2dd768c7cc [file] [log] [blame]
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/device_port_forwader.dart';
import 'package:mockito/mockito.dart';
import '../src/common.dart';
import '../src/context.dart';
void main() {
testUsingContext('dispose does not throw exception if no process is present', () {
final ForwardedPort forwardedPort = ForwardedPort(123, 456);
expect(forwardedPort.context, isNull);
testUsingContext('dispose kills process if process was available', () {
final MockProcess mockProcess = MockProcess();
final ForwardedPort forwardedPort = ForwardedPort.withContext(123, 456, mockProcess);
expect(forwardedPort.context, isNotNull);
class MockProcess extends Mock implements Process {}