fuchsia_workflow_test.dart 1.9 KB
Newer Older
1 2 3 4 5
// 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';
6
import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart';
7 8 9
import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
import 'package:mockito/mockito.dart';

10 11
import '../../src/common.dart';
import '../../src/context.dart';
12 13 14 15

class MockFile extends Mock implements File {}

void main() {
16
  group('Fuchsia workflow', () {
17 18 19 20 21
    final MockFile devFinder = MockFile();
    final MockFile sshConfig = MockFile();
    when(devFinder.absolute).thenReturn(devFinder);
    when(sshConfig.absolute).thenReturn(sshConfig);

22
    testUsingContext('can not list and launch devices if there is not ssh config and dev finder', () {
23 24 25 26
      expect(fuchsiaWorkflow.canLaunchDevices, false);
      expect(fuchsiaWorkflow.canListDevices, false);
      expect(fuchsiaWorkflow.canListEmulators, false);
    }, overrides: <Type, Generator>{
27
      FuchsiaArtifacts: () => FuchsiaArtifacts(devFinder: null, sshConfig: null),
28 29
    });

30
    testUsingContext('can not list and launch devices if there is not ssh config and dev finder', () {
31 32 33 34
      expect(fuchsiaWorkflow.canLaunchDevices, false);
      expect(fuchsiaWorkflow.canListDevices, true);
      expect(fuchsiaWorkflow.canListEmulators, false);
    }, overrides: <Type, Generator>{
35
      FuchsiaArtifacts: () => FuchsiaArtifacts(devFinder: devFinder, sshConfig: null),
36 37
    });

38
    testUsingContext('can list and launch devices supported with sufficient SDK artifacts', () {
39 40 41 42
      expect(fuchsiaWorkflow.canLaunchDevices, true);
      expect(fuchsiaWorkflow.canListDevices, true);
      expect(fuchsiaWorkflow.canListEmulators, false);
    }, overrides: <Type, Generator>{
43 44
      FuchsiaArtifacts: () =>
          FuchsiaArtifacts(devFinder: devFinder, sshConfig: sshConfig),
45 46 47
    });
  });
}