2019-11-27 23:04:02 +00:00
|
|
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
2019-06-04 06:19:42 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-05-06 15:15:39 +00:00
|
|
|
import 'package:flutter_tools/src/base/platform.dart';
|
2020-03-16 18:33:00 +00:00
|
|
|
import 'package:flutter_tools/src/web/workflow.dart';
|
2019-06-04 06:19:42 +00:00
|
|
|
|
2019-07-13 18:51:44 +00:00
|
|
|
import '../../src/common.dart';
|
2021-02-26 19:13:32 +00:00
|
|
|
import '../../src/fakes.dart';
|
2019-06-04 06:19:42 +00:00
|
|
|
|
|
|
|
void main() {
|
2020-03-16 18:33:00 +00:00
|
|
|
testWithoutContext('WebWorkflow applies on Linux', () {
|
|
|
|
final WebWorkflow workflow = WebWorkflow(
|
|
|
|
platform: FakePlatform(operatingSystem: 'linux'),
|
|
|
|
featureFlags: TestFeatureFlags(isWebEnabled: true),
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(workflow.appliesToHostPlatform, true);
|
|
|
|
expect(workflow.canLaunchDevices, true);
|
|
|
|
expect(workflow.canListDevices, true);
|
|
|
|
expect(workflow.canListEmulators, false);
|
|
|
|
});
|
2019-06-04 06:19:42 +00:00
|
|
|
|
2020-03-16 18:33:00 +00:00
|
|
|
testWithoutContext('WebWorkflow applies on macOS', () {
|
|
|
|
final WebWorkflow workflow = WebWorkflow(
|
|
|
|
platform: FakePlatform(operatingSystem: 'macos'),
|
|
|
|
featureFlags: TestFeatureFlags(isWebEnabled: true),
|
|
|
|
);
|
2019-06-04 06:19:42 +00:00
|
|
|
|
2020-03-16 18:33:00 +00:00
|
|
|
expect(workflow.appliesToHostPlatform, true);
|
|
|
|
expect(workflow.canLaunchDevices, true);
|
|
|
|
expect(workflow.canListDevices, true);
|
|
|
|
expect(workflow.canListEmulators, false);
|
2019-06-04 06:19:42 +00:00
|
|
|
});
|
|
|
|
|
2020-03-16 18:33:00 +00:00
|
|
|
testWithoutContext('WebWorkflow applies on Windows', () {
|
|
|
|
final WebWorkflow workflow = WebWorkflow(
|
|
|
|
platform: FakePlatform(operatingSystem: 'windows'),
|
|
|
|
featureFlags: TestFeatureFlags(isWebEnabled: true),
|
|
|
|
);
|
2019-06-04 06:19:42 +00:00
|
|
|
|
2020-03-16 18:33:00 +00:00
|
|
|
expect(workflow.appliesToHostPlatform, true);
|
|
|
|
expect(workflow.canLaunchDevices, true);
|
|
|
|
expect(workflow.canListDevices, true);
|
|
|
|
expect(workflow.canListEmulators, false);
|
2019-10-04 09:00:18 +00:00
|
|
|
});
|
2019-06-04 06:19:42 +00:00
|
|
|
|
2020-03-16 18:33:00 +00:00
|
|
|
testWithoutContext('WebWorkflow does not apply on other platforms', () {
|
|
|
|
final WebWorkflow workflow = WebWorkflow(
|
|
|
|
platform: FakePlatform(operatingSystem: 'fuchsia'),
|
|
|
|
featureFlags: TestFeatureFlags(isWebEnabled: true),
|
|
|
|
);
|
2019-06-04 06:19:42 +00:00
|
|
|
|
2020-03-16 18:33:00 +00:00
|
|
|
expect(workflow.appliesToHostPlatform, false);
|
|
|
|
});
|
2019-06-04 06:19:42 +00:00
|
|
|
|
2020-03-16 18:33:00 +00:00
|
|
|
testWithoutContext('WebWorkflow does not apply if feature flag is disabled', () {
|
|
|
|
final WebWorkflow workflow = WebWorkflow(
|
|
|
|
platform: FakePlatform(operatingSystem: 'linux'),
|
|
|
|
featureFlags: TestFeatureFlags(),
|
|
|
|
);
|
2019-06-04 06:19:42 +00:00
|
|
|
|
2020-03-16 18:33:00 +00:00
|
|
|
expect(workflow.appliesToHostPlatform, false);
|
|
|
|
expect(workflow.canLaunchDevices, false);
|
|
|
|
expect(workflow.canListDevices, false);
|
|
|
|
expect(workflow.canListEmulators, false);
|
|
|
|
});
|
2019-06-04 06:19:42 +00:00
|
|
|
}
|