mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

* Update project.pbxproj files to say Flutter rather than Chromium Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright. * Update the copyright notice checker to require a standard notice on all files * Update copyrights on Dart files. (This was a mechanical commit.) * Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine. Some were already marked "The Flutter Authors", not clear why. Their dates have been normalized. Some were missing the blank line after the license. Some were randomly different in trivial ways for no apparent reason (e.g. missing the trailing period). * Clean up the copyrights in non-Dart files. (Manual edits.) Also, make sure templates don't have copyrights. * Fix some more ORGANIZATIONNAMEs
116 lines
3.5 KiB
Dart
116 lines
3.5 KiB
Dart
// 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.
|
|
|
|
import 'package:flutter_tools/src/base/file_system.dart';
|
|
import 'package:flutter_tools/src/base/platform.dart';
|
|
import 'package:flutter_tools/src/features.dart';
|
|
import 'package:flutter_tools/src/web/chrome.dart';
|
|
import 'package:flutter_tools/src/web/workflow.dart';
|
|
import 'package:mockito/mockito.dart';
|
|
import 'package:process/process.dart';
|
|
|
|
import '../../src/common.dart';
|
|
import '../../src/context.dart';
|
|
import '../../src/testbed.dart';
|
|
|
|
void main() {
|
|
group('WebWorkflow', () {
|
|
Testbed testbed;
|
|
MockPlatform notSupported;
|
|
MockPlatform windows;
|
|
MockPlatform linux;
|
|
MockPlatform macos;
|
|
MockProcessManager mockProcessManager;
|
|
WebWorkflow workflow;
|
|
|
|
setUpAll(() {
|
|
notSupported = MockPlatform(linux: false, windows: false, macos: false);
|
|
windows = MockPlatform(windows: true);
|
|
linux = MockPlatform(linux: true);
|
|
macos = MockPlatform(macos: true);
|
|
workflow = const WebWorkflow();
|
|
mockProcessManager = MockProcessManager();
|
|
testbed = Testbed(setup: () async {
|
|
fs.file('chrome').createSync();
|
|
when(mockProcessManager.canRun('chrome')).thenReturn(true);
|
|
}, overrides: <Type, Generator>{
|
|
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
|
|
ProcessManager: () => mockProcessManager,
|
|
});
|
|
});
|
|
|
|
test('Applies on Linux', () => testbed.run(() {
|
|
expect(workflow.appliesToHostPlatform, true);
|
|
expect(workflow.canLaunchDevices, true);
|
|
expect(workflow.canListDevices, true);
|
|
expect(workflow.canListEmulators, false);
|
|
}, overrides: <Type, Generator>{
|
|
Platform: () => linux,
|
|
}));
|
|
|
|
test('Applies on macOS', () => testbed.run(() {
|
|
expect(workflow.appliesToHostPlatform, true);
|
|
expect(workflow.canLaunchDevices, true);
|
|
expect(workflow.canListDevices, true);
|
|
expect(workflow.canListEmulators, false);
|
|
}, overrides: <Type, Generator>{
|
|
Platform: () => macos,
|
|
}));
|
|
|
|
test('Applies on Windows', () => testbed.run(() {
|
|
expect(workflow.appliesToHostPlatform, true);
|
|
expect(workflow.canLaunchDevices, true);
|
|
expect(workflow.canListDevices, true);
|
|
expect(workflow.canListEmulators, false);
|
|
}, overrides: <Type, Generator>{
|
|
Platform: () => windows,
|
|
}));
|
|
|
|
test('does not apply on other platforms', () => testbed.run(() {
|
|
expect(workflow.appliesToHostPlatform, false);
|
|
}, overrides: <Type, Generator>{
|
|
Platform: () => notSupported,
|
|
}));
|
|
|
|
test('does not apply if feature flag is disabled', () => testbed.run(() {
|
|
expect(workflow.appliesToHostPlatform, false);
|
|
expect(workflow.canLaunchDevices, false);
|
|
expect(workflow.canListDevices, false);
|
|
expect(workflow.canListEmulators, false);
|
|
}, overrides: <Type, Generator>{
|
|
Platform: () => macos,
|
|
FeatureFlags: () => TestFeatureFlags(isWebEnabled: false),
|
|
}));
|
|
});
|
|
}
|
|
|
|
class MockProcessManager extends Mock implements ProcessManager {}
|
|
|
|
class MockPlatform extends Mock implements Platform {
|
|
MockPlatform({
|
|
this.windows = false,
|
|
this.macos = false,
|
|
this.linux = false,
|
|
this.environment = const <String, String>{
|
|
kChromeEnvironment: 'chrome',
|
|
},
|
|
});
|
|
|
|
final bool windows;
|
|
final bool macos;
|
|
final bool linux;
|
|
|
|
@override
|
|
final Map<String, String> environment;
|
|
|
|
@override
|
|
bool get isLinux => linux;
|
|
|
|
@override
|
|
bool get isMacOS => macos;
|
|
|
|
@override
|
|
bool get isWindows => windows;
|
|
}
|