Add run capability for macOS target (#31218)
This commit is contained in:
@@ -44,6 +44,7 @@ void main() {
|
||||
), throwsA(isInstanceOf<ToolExit>()));
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => linuxPlatform,
|
||||
FileSystem: () => memoryFilesystem,
|
||||
});
|
||||
|
||||
testUsingContext('Linux build fails on non-linux platform', () async {
|
||||
|
||||
@@ -13,7 +13,7 @@ void main() {
|
||||
group(LinuxWorkflow, () {
|
||||
final MockPlatform linux = MockPlatform();
|
||||
final MockPlatform linuxWithFde = MockPlatform()
|
||||
..environment['FLUTTER_DESKTOP_EMBEDDING'] = 'true';
|
||||
..environment['ENABLE_FLUTTER_DESKTOP'] = 'true';
|
||||
final MockPlatform notLinux = MockPlatform();
|
||||
when(linux.isLinux).thenReturn(true);
|
||||
when(linuxWithFde.isLinux).thenReturn(true);
|
||||
|
||||
@@ -32,7 +32,7 @@ void main() {
|
||||
|
||||
testUsingContext('defaults', () async {
|
||||
final MockMacOSApp mockMacOSApp = MockMacOSApp();
|
||||
when(mockMacOSApp.executable).thenReturn('foo');
|
||||
when(mockMacOSApp.executable(any)).thenReturn('foo');
|
||||
expect(await device.targetPlatform, TargetPlatform.darwin_x64);
|
||||
expect(device.name, 'macOS');
|
||||
expect(await device.installApp(mockMacOSApp), true);
|
||||
@@ -49,7 +49,7 @@ void main() {
|
||||
tester 17193 0.0 0.2 4791128 37820 ?? S 2:27PM 0:00.09 /Applications/foo
|
||||
''';
|
||||
final MockMacOSApp mockMacOSApp = MockMacOSApp();
|
||||
when(mockMacOSApp.executable).thenReturn('/Applications/foo');
|
||||
when(mockMacOSApp.executable(any)).thenReturn('/Applications/foo');
|
||||
when(mockProcessManager.run(<String>['ps', 'aux'])).thenAnswer((Invocation invocation) async {
|
||||
return ProcessResult(1, 0, psOut, '');
|
||||
});
|
||||
@@ -68,7 +68,7 @@ tester 17193 0.0 0.2 4791128 37820 ?? S 2:27PM 0:00.09 /Applica
|
||||
final MockProcessManager mockProcessManager = MockProcessManager();
|
||||
final MockFile mockFile = MockFile();
|
||||
final MockProcess mockProcess = MockProcess();
|
||||
when(macOSApp.executable).thenReturn('test');
|
||||
when(macOSApp.executable(any)).thenReturn('test');
|
||||
when(mockFileSystem.file('test')).thenReturn(mockFile);
|
||||
when(mockFile.existsSync()).thenReturn(true);
|
||||
when(mockProcessManager.start(<String>['test'])).thenAnswer((Invocation invocation) async {
|
||||
@@ -83,11 +83,6 @@ tester 17193 0.0 0.2 4791128 37820 ?? S 2:27PM 0:00.09 /Applica
|
||||
]);
|
||||
});
|
||||
|
||||
test('fails without a prebuilt application', () async {
|
||||
final LaunchResult result = await device.startApp(macOSApp, prebuiltApplication: false);
|
||||
expect(result.started, false);
|
||||
});
|
||||
|
||||
testUsingContext('Can run from prebuilt application', () async {
|
||||
final LaunchResult result = await device.startApp(macOSApp, prebuiltApplication: true);
|
||||
expect(result.started, true);
|
||||
|
||||
@@ -16,7 +16,7 @@ void main() {
|
||||
group(MacOSWorkflow, () {
|
||||
final MockPlatform mac = MockPlatform();
|
||||
final MockPlatform macWithFde = MockPlatform()
|
||||
..environment['FLUTTER_DESKTOP_EMBEDDING'] = 'true';
|
||||
..environment['ENABLE_FLUTTER_DESKTOP'] = 'true';
|
||||
final MockPlatform notMac = MockPlatform();
|
||||
when(mac.isMacOS).thenReturn(true);
|
||||
when(macWithFde.isMacOS).thenReturn(true);
|
||||
|
||||
@@ -14,7 +14,7 @@ void main() {
|
||||
group(WindowsWorkflow, () {
|
||||
final MockPlatform windows = MockPlatform();
|
||||
final MockPlatform windowsWithFde = MockPlatform()
|
||||
..environment['FLUTTER_DESKTOP_EMBEDDING'] = 'true';
|
||||
..environment['ENABLE_FLUTTER_DESKTOP'] = 'true';
|
||||
final MockPlatform notWindows = MockPlatform();
|
||||
when(windows.isWindows).thenReturn(true);
|
||||
when(windowsWithFde.isWindows).thenReturn(true);
|
||||
|
||||
Reference in New Issue
Block a user