make FDE opt-in via the environment variable (#26898)
This commit is contained in:
@@ -4,9 +4,7 @@
|
||||
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:flutter_tools/src/linux/linux_workflow.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
|
||||
import '../src/common.dart';
|
||||
import '../src/context.dart';
|
||||
@@ -14,8 +12,11 @@ import '../src/context.dart';
|
||||
void main() {
|
||||
group(LinuxWorkflow, () {
|
||||
final MockPlatform linux = MockPlatform();
|
||||
final MockPlatform linuxWithFde = MockPlatform()
|
||||
..environment['FLUTTER_DESKTOP_EMBEDDING'] = 'true';
|
||||
final MockPlatform notLinux = MockPlatform();
|
||||
when(linux.isLinux).thenReturn(true);
|
||||
when(linuxWithFde.isLinux).thenReturn(true);
|
||||
when(notLinux.isLinux).thenReturn(false);
|
||||
|
||||
testUsingContext('Applies to linux platform', () {
|
||||
@@ -29,30 +30,17 @@ void main() {
|
||||
Platform: () => notLinux,
|
||||
});
|
||||
|
||||
final MockFileSystem fileSystem = MockFileSystem();
|
||||
final MockDirectory directory = MockDirectory();
|
||||
Cache.flutterRoot = '';
|
||||
when(fileSystem.directory(Cache.flutterRoot)).thenReturn(directory);
|
||||
when(directory.parent).thenReturn(directory);
|
||||
when(directory.childDirectory('flutter-desktop-embedding')).thenReturn(directory);
|
||||
when(directory.existsSync()).thenReturn(true);
|
||||
|
||||
testUsingContext('defaults', () {
|
||||
expect(linuxWorkflow.canListEmulators, false);
|
||||
expect(linuxWorkflow.canLaunchDevices, true);
|
||||
expect(linuxWorkflow.canListDevices, true);
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => linux,
|
||||
FileSystem: () => fileSystem,
|
||||
Platform: () => linuxWithFde
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
class MockFileSystem extends Mock implements FileSystem {}
|
||||
|
||||
class MockDirectory extends Mock implements Directory {}
|
||||
|
||||
class MockPlatform extends Mock implements Platform {
|
||||
@override
|
||||
Map<String, String> get environment => const <String, String>{};
|
||||
final Map<String, String> environment = <String, String>{};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user