Unverified Commit 9e30d51a authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] start fixing command tests (#60172)

parent 77bc1ee5
......@@ -34,7 +34,7 @@ void main() {
expect(testLogger.statusText, containsIgnoringWhitespace('No devices detected'));
}, overrides: <Type, Generator>{
AndroidSdk: () => null,
DeviceManager: () => DeviceManager(),
DeviceManager: () => NoDevicesManager(),
ProcessManager: () => MockProcessManager(),
});
......@@ -160,3 +160,12 @@ class _FakeDeviceManager extends DeviceManager {
<String>['Cannot connect to device ABC']
);
}
class NoDevicesManager extends DeviceManager {
@override
Future<List<Device>> getAllConnectedDevices() async => <Device>[];
@override
Future<List<Device>> refreshAllConnectedDevices({Duration timeout}) =>
getAllConnectedDevices();
}
......@@ -43,6 +43,11 @@ final Map<Type, Generator> noColorTerminalOverride = <Type, Generator>{
Platform: _kNoColorOutputPlatform,
};
final Platform macPlatform = FakePlatform(
operatingSystem: 'macos',
environment: <String, String>{'HOME': '/foo/bar'}
);
void main() {
MockProcessManager mockProcessManager;
MockFlutterVersion mockFlutterVersion;
......@@ -93,11 +98,14 @@ void main() {
expect(validator.plistFile, '/path/to/app/Contents/Info.plist');
expect(validator.pluginsPath, pluginsDirectory.path);
}, overrides: <Type, Generator>{
Platform: () => FakePlatform()
..environment = <String, String>{'HOME': '/foo/bar'},
Platform: () => macPlatform,
PlistParser: () => mockPlistParser,
FileSystem: () => fileSystem,
ProcessManager: () => mockProcessManager,
FileSystemUtils: () => FileSystemUtils(
fileSystem: fileSystem,
platform: macPlatform,
)
});
testUsingContext('legacy intellij plugins path checking on mac', () async {
......@@ -106,9 +114,14 @@ void main() {
final IntelliJValidatorOnMac validator = IntelliJValidatorOnMac('Test', 'TestID', '/foo');
expect(validator.pluginsPath, '/foo/bar/Library/Application Support/TestID2020.10');
}, overrides: <Type, Generator>{
Platform: () => FakePlatform()
..environment = <String, String>{'HOME': '/foo/bar'},
Platform: () => macPlatform,
PlistParser: () => mockPlistParser,
FileSystem: () => fileSystem,
FileSystemUtils: () => FileSystemUtils(
fileSystem: fileSystem,
platform: macPlatform,
),
ProcessManager: () => FakeProcessManager.any(),
});
testUsingContext('intellij plugins path checking on mac with override', () async {
......@@ -118,6 +131,13 @@ void main() {
expect(validator.pluginsPath, '/path/to/JetBrainsToolboxApp.plugins');
}, overrides: <Type, Generator>{
PlistParser: () => mockPlistParser,
Platform: () => macPlatform,
FileSystem: () => fileSystem,
FileSystemUtils: () => FileSystemUtils(
fileSystem: fileSystem,
platform: macPlatform,
),
ProcessManager: () => FakeProcessManager.any(),
});
testUsingContext('vs code validator when both installed', () async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment