flutter/packages/flutter_tools/test/fuchsia/fuchsia_workflow_test.dart

59 lines
2.1 KiB
Dart
Raw Normal View History

// Copyright 2018 The Chromium Authors. 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:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/os.dart';
2019-01-09 17:27:56 +00:00
import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart';
import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
import 'package:mockito/mockito.dart';
import '../src/common.dart';
import '../src/context.dart';
class MockOperatingSystemUtils extends Mock implements OperatingSystemUtils {}
class MockFile extends Mock implements File {}
void main() {
group('Fuchsia workflow', () {
2019-01-09 17:27:56 +00:00
final MockFile devFinder = MockFile();
final MockFile sshConfig = MockFile();
when(devFinder.absolute).thenReturn(devFinder);
when(sshConfig.absolute).thenReturn(sshConfig);
testUsingContext(
'can not list and launch devices if there is not ssh config and dev finder',
() {
expect(fuchsiaWorkflow.canLaunchDevices, false);
expect(fuchsiaWorkflow.canListDevices, false);
expect(fuchsiaWorkflow.canListEmulators, false);
}, overrides: <Type, Generator>{
FuchsiaArtifacts: () =>
FuchsiaArtifacts(devFinder: null, sshConfig: null),
2019-01-09 17:27:56 +00:00
});
testUsingContext(
'can not list and launch devices if there is not ssh config and dev finder',
() {
2019-01-09 17:27:56 +00:00
expect(fuchsiaWorkflow.canLaunchDevices, false);
expect(fuchsiaWorkflow.canListDevices, true);
expect(fuchsiaWorkflow.canListEmulators, false);
}, overrides: <Type, Generator>{
FuchsiaArtifacts: () =>
FuchsiaArtifacts(devFinder: devFinder, sshConfig: null),
});
testUsingContext(
'can list and launch devices supported with sufficient SDK artifacts',
() {
expect(fuchsiaWorkflow.canLaunchDevices, true);
expect(fuchsiaWorkflow.canListDevices, true);
expect(fuchsiaWorkflow.canListEmulators, false);
}, overrides: <Type, Generator>{
FuchsiaArtifacts: () =>
FuchsiaArtifacts(devFinder: devFinder, sshConfig: sshConfig),
});
});
}