[flutter_tools] replace MockFlutterVersion usage with fake where possible, move from context (#77390)
This commit is contained in:
parent
db162a47f3
commit
721702717d
@ -720,7 +720,7 @@ class FlutterValidator extends DoctorValidator {
|
|||||||
messages.add(ValidationMessage(_userMessages.flutterRevision(
|
messages.add(ValidationMessage(_userMessages.flutterRevision(
|
||||||
version.frameworkRevisionShort,
|
version.frameworkRevisionShort,
|
||||||
version.frameworkAge,
|
version.frameworkAge,
|
||||||
version.frameworkDate,
|
version.frameworkCommitDate,
|
||||||
)));
|
)));
|
||||||
messages.add(ValidationMessage(_userMessages.engineRevision(version.engineRevisionShort)));
|
messages.add(ValidationMessage(_userMessages.engineRevision(version.engineRevisionShort)));
|
||||||
messages.add(ValidationMessage(_userMessages.dartRevision(version.dartSdkVersion)));
|
messages.add(ValidationMessage(_userMessages.dartRevision(version.dartSdkVersion)));
|
||||||
|
@ -144,8 +144,6 @@ class FlutterVersion {
|
|||||||
String _frameworkVersion;
|
String _frameworkVersion;
|
||||||
String get frameworkVersion => _frameworkVersion;
|
String get frameworkVersion => _frameworkVersion;
|
||||||
|
|
||||||
String get frameworkDate => frameworkCommitDate;
|
|
||||||
|
|
||||||
String get dartSdkVersion => globals.cache.dartSdkVersion;
|
String get dartSdkVersion => globals.cache.dartSdkVersion;
|
||||||
|
|
||||||
String get engineRevision => globals.cache.engineRevision;
|
String get engineRevision => globals.cache.engineRevision;
|
||||||
@ -181,6 +179,8 @@ class FlutterVersion {
|
|||||||
'dartSdkVersion': dartSdkVersion,
|
'dartSdkVersion': dartSdkVersion,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
String get frameworkDate => frameworkCommitDate;
|
||||||
|
|
||||||
/// A date String describing the last framework commit.
|
/// A date String describing the last framework commit.
|
||||||
///
|
///
|
||||||
/// If a git command fails, this will return a placeholder date.
|
/// If a git command fails, this will return a placeholder date.
|
||||||
|
@ -53,12 +53,12 @@ final Platform macPlatform = FakePlatform(
|
|||||||
);
|
);
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
MockFlutterVersion mockFlutterVersion;
|
FakeFlutterVersion flutterVersion;
|
||||||
BufferLogger logger;
|
BufferLogger logger;
|
||||||
FakeProcessManager fakeProcessManager;
|
FakeProcessManager fakeProcessManager;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
mockFlutterVersion = MockFlutterVersion();
|
flutterVersion = FakeFlutterVersion();
|
||||||
logger = BufferLogger.test();
|
logger = BufferLogger.test();
|
||||||
fakeProcessManager = FakeProcessManager.list(<FakeCommand>[]);
|
fakeProcessManager = FakeProcessManager.list(<FakeCommand>[]);
|
||||||
});
|
});
|
||||||
@ -667,13 +667,12 @@ void main() {
|
|||||||
|
|
||||||
await commandRunner.run(<String>['doctor']);
|
await commandRunner.run(<String>['doctor']);
|
||||||
|
|
||||||
verify(mockFlutterVersion.fetchTagsAndUpdate()).called(1);
|
expect(flutterVersion.didFetchTagsAndUpdate, true);
|
||||||
|
|
||||||
Cache.enableLocking();
|
Cache.enableLocking();
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
FlutterVersion: () => mockFlutterVersion,
|
FlutterVersion: () => flutterVersion,
|
||||||
Doctor: () => NoOpDoctor(),
|
Doctor: () => NoOpDoctor(),
|
||||||
}, initializeFlutterRoot: false);
|
}, initializeFlutterRoot: false);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import 'package:mockito/mockito.dart';
|
|||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
|
import '../../src/mocks.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
FileSystem fileSystem;
|
FileSystem fileSystem;
|
||||||
|
@ -20,6 +20,7 @@ import 'package:process/process.dart';
|
|||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
import '../../src/fake_process_manager.dart';
|
import '../../src/fake_process_manager.dart';
|
||||||
|
import '../../src/mocks.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('UpgradeCommandRunner', () {
|
group('UpgradeCommandRunner', () {
|
||||||
|
@ -14,6 +14,7 @@ import 'package:flutter_tools/src/build_info.dart';
|
|||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/device.dart';
|
import 'package:flutter_tools/src/device.dart';
|
||||||
import 'package:flutter_tools/src/drive/drive_service.dart';
|
import 'package:flutter_tools/src/drive/drive_service.dart';
|
||||||
|
import 'package:flutter_tools/src/version.dart';
|
||||||
import 'package:flutter_tools/src/vmservice.dart';
|
import 'package:flutter_tools/src/vmservice.dart';
|
||||||
import 'package:package_config/package_config_types.dart';
|
import 'package:package_config/package_config_types.dart';
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
@ -21,6 +22,7 @@ import 'package:vm_service/vm_service.dart' as vm_service;
|
|||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
|
import '../../src/fakes.dart';
|
||||||
|
|
||||||
|
|
||||||
final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate(
|
final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate(
|
||||||
@ -288,9 +290,13 @@ void main() {
|
|||||||
expect(json.decode(fileSystem.file('out.json').readAsStringSync()), <String, Object>{
|
expect(json.decode(fileSystem.file('out.json').readAsStringSync()), <String, Object>{
|
||||||
'platform': 'android',
|
'platform': 'android',
|
||||||
'name': 'test',
|
'name': 'test',
|
||||||
'engineRevision': null,
|
'engineRevision': 'abcdefghijklmnopqrstuvwxyz',
|
||||||
'data': <String, Object>{'A': 'B'}
|
'data': <String, Object>{'A': 'B'}
|
||||||
});
|
});
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FlutterVersion: () => FakeFlutterVersion(
|
||||||
|
engineRevision: 'abcdefghijklmnopqrstuvwxyz',
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Can connect to existing application and stop it during cleanup', () async {
|
testWithoutContext('Can connect to existing application and stop it during cleanup', () async {
|
||||||
|
@ -15,11 +15,14 @@ import 'package:mockito/mockito.dart';
|
|||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/context.dart';
|
import '../src/context.dart';
|
||||||
|
import '../src/fakes.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWithoutContext('FlutterValidator shows an error message if gen_snapshot is '
|
testWithoutContext('FlutterValidator shows an error message if gen_snapshot is '
|
||||||
'downloaded and exits with code 1', () async {
|
'downloaded and exits with code 1', () async {
|
||||||
final MockFlutterVersion flutterVersion = MockFlutterVersion();
|
final FakeFlutterVersion flutterVersion = FakeFlutterVersion(
|
||||||
|
frameworkVersion: '1.0.0',
|
||||||
|
);
|
||||||
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
||||||
final Artifacts artifacts = Artifacts.test();
|
final Artifacts artifacts = Artifacts.test();
|
||||||
final FlutterValidator flutterValidator = FlutterValidator(
|
final FlutterValidator flutterValidator = FlutterValidator(
|
||||||
@ -46,7 +49,7 @@ void main() {
|
|||||||
|
|
||||||
expect(await flutterValidator.validate(), matchDoctorValidation(
|
expect(await flutterValidator.validate(), matchDoctorValidation(
|
||||||
validationType: ValidationType.partial,
|
validationType: ValidationType.partial,
|
||||||
statusInfo: 'Channel unknown, Unknown, on Linux, locale en_US.UTF-8',
|
statusInfo: 'Channel unknown, 1.0.0, on Linux, locale en_US.UTF-8',
|
||||||
messages: containsAll(const <ValidationMessage>[
|
messages: containsAll(const <ValidationMessage>[
|
||||||
ValidationMessage.error(
|
ValidationMessage.error(
|
||||||
'Downloaded executables cannot execute on host.\n'
|
'Downloaded executables cannot execute on host.\n'
|
||||||
@ -60,13 +63,16 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('FlutterValidator does not run gen_snapshot binary check if it is not already downloaded', () async {
|
testWithoutContext('FlutterValidator does not run gen_snapshot binary check if it is not already downloaded', () async {
|
||||||
|
final FakeFlutterVersion flutterVersion = FakeFlutterVersion(
|
||||||
|
frameworkVersion: '1.0.0',
|
||||||
|
);
|
||||||
final FlutterValidator flutterValidator = FlutterValidator(
|
final FlutterValidator flutterValidator = FlutterValidator(
|
||||||
platform: FakePlatform(
|
platform: FakePlatform(
|
||||||
operatingSystem: 'windows',
|
operatingSystem: 'windows',
|
||||||
localeName: 'en_US.UTF-8',
|
localeName: 'en_US.UTF-8',
|
||||||
environment: <String, String>{},
|
environment: <String, String>{},
|
||||||
),
|
),
|
||||||
flutterVersion: () => MockFlutterVersion(),
|
flutterVersion: () => flutterVersion,
|
||||||
userMessages: UserMessages(),
|
userMessages: UserMessages(),
|
||||||
artifacts: Artifacts.test(),
|
artifacts: Artifacts.test(),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
@ -79,16 +85,15 @@ void main() {
|
|||||||
// fail if the gen_snapshot binary is not present.
|
// fail if the gen_snapshot binary is not present.
|
||||||
expect(await flutterValidator.validate(), matchDoctorValidation(
|
expect(await flutterValidator.validate(), matchDoctorValidation(
|
||||||
validationType: ValidationType.installed,
|
validationType: ValidationType.installed,
|
||||||
statusInfo: 'Channel unknown, Unknown, on Windows, locale en_US.UTF-8',
|
statusInfo: 'Channel unknown, 1.0.0, on Windows, locale en_US.UTF-8',
|
||||||
messages: anything,
|
messages: anything,
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('FlutterValidator handles exception thrown by version checking', () async {
|
testWithoutContext('FlutterValidator handles exception thrown by version checking', () async {
|
||||||
final MockFlutterVersion flutterVersion = MockFlutterVersion();
|
|
||||||
final FlutterValidator flutterValidator = FlutterValidator(
|
final FlutterValidator flutterValidator = FlutterValidator(
|
||||||
platform: FakePlatform(operatingSystem: 'windows', localeName: 'en_US.UTF-8'),
|
platform: FakePlatform(operatingSystem: 'windows', localeName: 'en_US.UTF-8'),
|
||||||
flutterVersion: () => flutterVersion,
|
flutterVersion: () => FakeThrowingFlutterVersion(),
|
||||||
userMessages: UserMessages(),
|
userMessages: UserMessages(),
|
||||||
artifacts: Artifacts.test(),
|
artifacts: Artifacts.test(),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
@ -97,10 +102,6 @@ void main() {
|
|||||||
flutterRoot: () => 'sdk/flutter',
|
flutterRoot: () => 'sdk/flutter',
|
||||||
);
|
);
|
||||||
|
|
||||||
when(flutterVersion.channel).thenReturn('unknown');
|
|
||||||
when(flutterVersion.frameworkVersion).thenReturn('0.0.0');
|
|
||||||
when(flutterVersion.frameworkDate).thenThrow(VersionCheckError('version error'));
|
|
||||||
|
|
||||||
expect(await flutterValidator.validate(), matchDoctorValidation(
|
expect(await flutterValidator.validate(), matchDoctorValidation(
|
||||||
validationType: ValidationType.partial,
|
validationType: ValidationType.partial,
|
||||||
statusInfo: 'Channel unknown, 0.0.0, on Windows, locale en_US.UTF-8',
|
statusInfo: 'Channel unknown, 0.0.0, on Windows, locale en_US.UTF-8',
|
||||||
@ -112,6 +113,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('FlutterValidator shows mirrors on pub and flutter cloud storage', () async {
|
testWithoutContext('FlutterValidator shows mirrors on pub and flutter cloud storage', () async {
|
||||||
|
final FakeFlutterVersion flutterVersion = FakeFlutterVersion(
|
||||||
|
frameworkVersion: '1.0.0',
|
||||||
|
);
|
||||||
final Platform platform = FakePlatform(
|
final Platform platform = FakePlatform(
|
||||||
operatingSystem: 'windows',
|
operatingSystem: 'windows',
|
||||||
localeName: 'en_US.UTF-8',
|
localeName: 'en_US.UTF-8',
|
||||||
@ -120,7 +124,6 @@ void main() {
|
|||||||
'FLUTTER_STORAGE_BASE_URL': 'https://example.com/flutter',
|
'FLUTTER_STORAGE_BASE_URL': 'https://example.com/flutter',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
final MockFlutterVersion flutterVersion = MockFlutterVersion();
|
|
||||||
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
||||||
final Artifacts artifacts = Artifacts.test();
|
final Artifacts artifacts = Artifacts.test();
|
||||||
final FlutterValidator flutterValidator = FlutterValidator(
|
final FlutterValidator flutterValidator = FlutterValidator(
|
||||||
@ -136,7 +139,7 @@ void main() {
|
|||||||
|
|
||||||
expect(await flutterValidator.validate(), matchDoctorValidation(
|
expect(await flutterValidator.validate(), matchDoctorValidation(
|
||||||
validationType: ValidationType.installed,
|
validationType: ValidationType.installed,
|
||||||
statusInfo: 'Channel unknown, Unknown, on Windows, locale en_US.UTF-8',
|
statusInfo: 'Channel unknown, 1.0.0, on Windows, locale en_US.UTF-8',
|
||||||
messages: containsAll(const <ValidationMessage>[
|
messages: containsAll(const <ValidationMessage>[
|
||||||
ValidationMessage('Pub download mirror https://example.com/pub'),
|
ValidationMessage('Pub download mirror https://example.com/pub'),
|
||||||
ValidationMessage('Flutter download mirror https://example.com/flutter'),
|
ValidationMessage('Flutter download mirror https://example.com/flutter'),
|
||||||
@ -145,10 +148,16 @@ void main() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockFlutterVersion extends Mock implements FlutterVersion {}
|
|
||||||
class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
|
class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils {
|
||||||
FakeOperatingSystemUtils({this.name});
|
FakeOperatingSystemUtils({this.name});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String name;
|
final String name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class FakeThrowingFlutterVersion extends FakeFlutterVersion {
|
||||||
|
@override
|
||||||
|
String get frameworkCommitDate {
|
||||||
|
throw VersionCheckError('version error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -44,7 +44,7 @@ void main() {
|
|||||||
MockWindowsProject windowsProject;
|
MockWindowsProject windowsProject;
|
||||||
MockLinuxProject linuxProject;
|
MockLinuxProject linuxProject;
|
||||||
FakeSystemClock systemClock;
|
FakeSystemClock systemClock;
|
||||||
FlutterVersion mockVersion;
|
FlutterVersion flutterVersion;
|
||||||
// A Windows-style filesystem. This is not populated by default, so tests
|
// A Windows-style filesystem. This is not populated by default, so tests
|
||||||
// using it instead of fs must re-run any necessary setup (e.g.,
|
// using it instead of fs must re-run any necessary setup (e.g.,
|
||||||
// setUpProject).
|
// setUpProject).
|
||||||
@ -126,15 +126,11 @@ void main() {
|
|||||||
fsWindows = MemoryFileSystem(style: FileSystemStyle.windows);
|
fsWindows = MemoryFileSystem(style: FileSystemStyle.windows);
|
||||||
systemClock = FakeSystemClock()
|
systemClock = FakeSystemClock()
|
||||||
..currentTime = DateTime(1970, 1, 1);
|
..currentTime = DateTime(1970, 1, 1);
|
||||||
mockVersion = MockFlutterVersion();
|
flutterVersion = FakeFlutterVersion(frameworkVersion: '1.0.0');
|
||||||
|
|
||||||
// Add basic properties to the Flutter project and subprojects
|
// Add basic properties to the Flutter project and subprojects
|
||||||
setUpProject(fs);
|
setUpProject(fs);
|
||||||
flutterProject.directory.childFile('.packages').createSync(recursive: true);
|
flutterProject.directory.childFile('.packages').createSync(recursive: true);
|
||||||
|
|
||||||
when(mockVersion.frameworkVersion).thenAnswer(
|
|
||||||
(Invocation _) => '1.0.0'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Makes fake plugin packages for each plugin, adds them to flutterProject,
|
// Makes fake plugin packages for each plugin, adds them to flutterProject,
|
||||||
@ -436,10 +432,6 @@ dependencies:
|
|||||||
|
|
||||||
final DateTime dateCreated = DateTime(1970, 1, 1);
|
final DateTime dateCreated = DateTime(1970, 1, 1);
|
||||||
systemClock.currentTime = dateCreated;
|
systemClock.currentTime = dateCreated;
|
||||||
const String version = '1.0.0';
|
|
||||||
when(mockVersion.frameworkVersion).thenAnswer(
|
|
||||||
(Invocation _) => version
|
|
||||||
);
|
|
||||||
|
|
||||||
await refreshPluginsList(flutterProject);
|
await refreshPluginsList(flutterProject);
|
||||||
|
|
||||||
@ -510,7 +502,7 @@ dependencies:
|
|||||||
|
|
||||||
expect(jsonContent['dependencyGraph'], expectedDependencyGraph);
|
expect(jsonContent['dependencyGraph'], expectedDependencyGraph);
|
||||||
expect(jsonContent['date_created'], dateCreated.toString());
|
expect(jsonContent['date_created'], dateCreated.toString());
|
||||||
expect(jsonContent['version'], version);
|
expect(jsonContent['version'], '1.0.0');
|
||||||
|
|
||||||
// Make sure tests are updated if a new object is added/removed.
|
// Make sure tests are updated if a new object is added/removed.
|
||||||
final List<String> expectedKeys = <String>[
|
final List<String> expectedKeys = <String>[
|
||||||
@ -525,7 +517,7 @@ dependencies:
|
|||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
SystemClock: () => systemClock,
|
SystemClock: () => systemClock,
|
||||||
FlutterVersion: () => mockVersion
|
FlutterVersion: () => flutterVersion
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Changes to the plugin list invalidates the Cocoapod lockfiles', () async {
|
testUsingContext('Changes to the plugin list invalidates the Cocoapod lockfiles', () async {
|
||||||
@ -542,7 +534,7 @@ dependencies:
|
|||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
SystemClock: () => systemClock,
|
SystemClock: () => systemClock,
|
||||||
FlutterVersion: () => mockVersion
|
FlutterVersion: () => flutterVersion
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('No changes to the plugin list does not invalidate the Cocoapod lockfiles', () async {
|
testUsingContext('No changes to the plugin list does not invalidate the Cocoapod lockfiles', () async {
|
||||||
@ -565,7 +557,7 @@ dependencies:
|
|||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
SystemClock: () => systemClock,
|
SystemClock: () => systemClock,
|
||||||
FlutterVersion: () => mockVersion
|
FlutterVersion: () => flutterVersion
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import 'package:flutter_tools/src/base/dds.dart';
|
|||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/features.dart';
|
import 'package:flutter_tools/src/features.dart';
|
||||||
import 'package:flutter_tools/src/resident_devtools_handler.dart';
|
import 'package:flutter_tools/src/resident_devtools_handler.dart';
|
||||||
|
import 'package:flutter_tools/src/version.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:package_config/package_config.dart';
|
import 'package:package_config/package_config.dart';
|
||||||
import 'package:vm_service/vm_service.dart' as vm_service;
|
import 'package:vm_service/vm_service.dart' as vm_service;
|
||||||
@ -1585,7 +1586,7 @@ void main() {
|
|||||||
expect(json.decode(globals.fs.file('flutter_01.sksl.json').readAsStringSync()), <String, Object>{
|
expect(json.decode(globals.fs.file('flutter_01.sksl.json').readAsStringSync()), <String, Object>{
|
||||||
'platform': 'android',
|
'platform': 'android',
|
||||||
'name': 'FakeDevice',
|
'name': 'FakeDevice',
|
||||||
'engineRevision': '42.2', // From FakeFlutterVersion
|
'engineRevision': 'abcdefg',
|
||||||
'data': <String, Object>{'A': 'B'}
|
'data': <String, Object>{'A': 'B'}
|
||||||
});
|
});
|
||||||
expect(fakeVmServiceHost.hasRemainingExpectations, false);
|
expect(fakeVmServiceHost.hasRemainingExpectations, false);
|
||||||
@ -1593,7 +1594,8 @@ void main() {
|
|||||||
FileSystemUtils: () => FileSystemUtils(
|
FileSystemUtils: () => FileSystemUtils(
|
||||||
fileSystem: globals.fs,
|
fileSystem: globals.fs,
|
||||||
platform: globals.platform,
|
platform: globals.platform,
|
||||||
)
|
),
|
||||||
|
FlutterVersion: () => FakeFlutterVersion(engineRevision: 'abcdefg')
|
||||||
}));
|
}));
|
||||||
|
|
||||||
testUsingContext('ResidentRunner ignores DevToolsLauncher when attaching with enableDevTools: false', () => testbed.run(() async {
|
testUsingContext('ResidentRunner ignores DevToolsLauncher when attaching with enableDevTools: false', () => testbed.run(() async {
|
||||||
|
@ -14,10 +14,10 @@ import 'package:flutter_tools/src/globals.dart' as globals;
|
|||||||
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||||
import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
|
import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
|
||||||
import 'package:flutter_tools/src/version.dart';
|
import 'package:flutter_tools/src/version.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
|
import '../../src/fakes.dart';
|
||||||
import 'utils.dart';
|
import 'utils.dart';
|
||||||
|
|
||||||
const String _kFlutterRoot = '/flutter/flutter';
|
const String _kFlutterRoot = '/flutter/flutter';
|
||||||
@ -25,20 +25,19 @@ const String _kProjectRoot = '/project';
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('FlutterCommandRunner', () {
|
group('FlutterCommandRunner', () {
|
||||||
MemoryFileSystem fs;
|
MemoryFileSystem fileSystem;
|
||||||
Platform platform;
|
Platform platform;
|
||||||
FlutterCommandRunner runner;
|
FlutterCommandRunner runner;
|
||||||
ProcessManager processManager;
|
|
||||||
|
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
Cache.disableLocking();
|
Cache.disableLocking();
|
||||||
});
|
});
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
fs = MemoryFileSystem.test();
|
fileSystem = MemoryFileSystem.test();
|
||||||
fs.directory(_kFlutterRoot).createSync(recursive: true);
|
fileSystem.directory(_kFlutterRoot).createSync(recursive: true);
|
||||||
fs.directory(_kProjectRoot).createSync(recursive: true);
|
fileSystem.directory(_kProjectRoot).createSync(recursive: true);
|
||||||
fs.currentDirectory = _kProjectRoot;
|
fileSystem.currentDirectory = _kProjectRoot;
|
||||||
|
|
||||||
platform = FakePlatform(
|
platform = FakePlatform(
|
||||||
environment: <String, String>{
|
environment: <String, String>{
|
||||||
@ -48,100 +47,60 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
runner = createTestCommandRunner(DummyFlutterCommand()) as FlutterCommandRunner;
|
runner = createTestCommandRunner(DummyFlutterCommand()) as FlutterCommandRunner;
|
||||||
processManager = MockProcessManager();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
group('run', () {
|
group('run', () {
|
||||||
testUsingContext('checks that Flutter installation is up-to-date', () async {
|
testUsingContext('checks that Flutter installation is up-to-date', () async {
|
||||||
final MockFlutterVersion version = globals.flutterVersion as MockFlutterVersion;
|
final FakeFlutterVersion version = globals.flutterVersion as FakeFlutterVersion;
|
||||||
bool versionChecked = false;
|
|
||||||
when(version.checkFlutterVersionFreshness()).thenAnswer((_) async {
|
|
||||||
versionChecked = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
await runner.run(<String>['dummy']);
|
await runner.run(<String>['dummy']);
|
||||||
|
|
||||||
expect(versionChecked, isTrue);
|
expect(version.didCheckFlutterVersionFreshness, true);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Platform: () => platform,
|
Platform: () => platform,
|
||||||
}, initializeFlutterRoot: false);
|
FlutterVersion: () => FakeFlutterVersion(),
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('does not check that Flutter installation is up-to-date with --machine flag', () async {
|
testUsingContext('does not check that Flutter installation is up-to-date with --machine flag', () async {
|
||||||
final MockFlutterVersion version = globals.flutterVersion as MockFlutterVersion;
|
final FakeFlutterVersion version = globals.flutterVersion as FakeFlutterVersion;
|
||||||
bool versionChecked = false;
|
|
||||||
when(version.checkFlutterVersionFreshness()).thenAnswer((_) async {
|
|
||||||
versionChecked = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
await runner.run(<String>['dummy', '--machine', '--version']);
|
await runner.run(<String>['dummy', '--machine', '--version']);
|
||||||
|
|
||||||
expect(versionChecked, isFalse);
|
expect(version.didCheckFlutterVersionFreshness, false);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Platform: () => platform,
|
Platform: () => platform,
|
||||||
}, initializeFlutterRoot: false);
|
FlutterVersion: () => FakeFlutterVersion(),
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('Fetches tags when --version is used', () async {
|
testUsingContext('Fetches tags when --version is used', () async {
|
||||||
final MockFlutterVersion version = globals.flutterVersion as MockFlutterVersion;
|
final FakeFlutterVersion version = globals.flutterVersion as FakeFlutterVersion;
|
||||||
|
|
||||||
await runner.run(<String>['--version']);
|
await runner.run(<String>['--version']);
|
||||||
|
|
||||||
verify(version.fetchTagsAndUpdate()).called(1);
|
expect(version.didFetchTagsAndUpdate, true);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Platform: () => platform,
|
Platform: () => platform,
|
||||||
}, initializeFlutterRoot: false);
|
FlutterVersion: () => FakeFlutterVersion(),
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('Doesnt crash on invalid .packages file', () async {
|
testUsingContext('Doesnt crash on invalid .packages file', () async {
|
||||||
fs.file('pubspec.yaml').createSync();
|
fileSystem.file('pubspec.yaml').createSync();
|
||||||
fs.file('.packages')
|
fileSystem.file('.packages')
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync('Not a valid package');
|
..writeAsStringSync('Not a valid package');
|
||||||
|
|
||||||
await runner.run(<String>['dummy']);
|
await runner.run(<String>['dummy']);
|
||||||
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Platform: () => platform,
|
Platform: () => platform,
|
||||||
}, initializeFlutterRoot: false);
|
|
||||||
|
|
||||||
group('version', () {
|
|
||||||
testUsingContext('checks that Flutter toJson output reports the flutter framework version', () async {
|
|
||||||
final ProcessResult result = ProcessResult(0, 0, 'random', '0');
|
|
||||||
|
|
||||||
when(processManager.runSync(FlutterVersion.gitLog('-n 1 --pretty=format:%H'.split(' ')),
|
|
||||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
|
||||||
when(processManager.runSync('git rev-parse --abbrev-ref --symbolic @{u}'.split(' '),
|
|
||||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
|
||||||
when(processManager.runSync('git rev-parse --abbrev-ref HEAD'.split(' '),
|
|
||||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
|
||||||
when(processManager.runSync('git ls-remote --get-url master'.split(' '),
|
|
||||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
|
||||||
when(processManager.runSync(FlutterVersion.gitLog('-n 1 --pretty=format:%ar'.split(' ')),
|
|
||||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
|
||||||
when(processManager.runSync('git fetch https://github.com/flutter/flutter.git --tags'.split(' '),
|
|
||||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
|
||||||
when(processManager.runSync('git tag --points-at random'.split(' '),
|
|
||||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
|
||||||
when(processManager.runSync('git describe --match *.*.* --long --tags random'.split(' '),
|
|
||||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
|
||||||
when(processManager.runSync(FlutterVersion.gitLog('-n 1 --pretty=format:%ad --date=iso'.split(' ')),
|
|
||||||
workingDirectory: Cache.flutterRoot)).thenReturn(result);
|
|
||||||
|
|
||||||
final FakeFlutterVersion version = FakeFlutterVersion();
|
|
||||||
|
|
||||||
// Because the hash depends on the time, we just use the 0.0.0-unknown here.
|
|
||||||
expect(version.toJson()['frameworkVersion'], '0.10.3');
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
FileSystem: () => fs,
|
|
||||||
ProcessManager: () => processManager,
|
|
||||||
Platform: () => platform,
|
|
||||||
}, initializeFlutterRoot: false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
group('getRepoPackages', () {
|
group('getRepoPackages', () {
|
||||||
@ -150,16 +109,16 @@ void main() {
|
|||||||
setUp(() {
|
setUp(() {
|
||||||
oldFlutterRoot = Cache.flutterRoot;
|
oldFlutterRoot = Cache.flutterRoot;
|
||||||
Cache.flutterRoot = _kFlutterRoot;
|
Cache.flutterRoot = _kFlutterRoot;
|
||||||
fs.directory(fs.path.join(_kFlutterRoot, 'examples'))
|
fileSystem.directory(fileSystem.path.join(_kFlutterRoot, 'examples'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fs.directory(fs.path.join(_kFlutterRoot, 'packages'))
|
fileSystem.directory(fileSystem.path.join(_kFlutterRoot, 'packages'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fs.directory(fs.path.join(_kFlutterRoot, 'dev', 'tools', 'aatool'))
|
fileSystem.directory(fileSystem.path.join(_kFlutterRoot, 'dev', 'tools', 'aatool'))
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
fs.file(fs.path.join(_kFlutterRoot, 'dev', 'tools', 'pubspec.yaml'))
|
fileSystem.file(fileSystem.path.join(_kFlutterRoot, 'dev', 'tools', 'pubspec.yaml'))
|
||||||
.createSync();
|
.createSync();
|
||||||
fs.file(fs.path.join(_kFlutterRoot, 'dev', 'tools', 'aatool', 'pubspec.yaml'))
|
fileSystem.file(fileSystem.path.join(_kFlutterRoot, 'dev', 'tools', 'aatool', 'pubspec.yaml'))
|
||||||
.createSync();
|
.createSync();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -169,16 +128,17 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('', () {
|
testUsingContext('', () {
|
||||||
final List<String> packagePaths = runner.getRepoPackages()
|
final List<String> packagePaths = runner.getRepoPackages()
|
||||||
.map((Directory d) => d.path).toList();
|
.map((Directory d) => d.path).toList();
|
||||||
expect(packagePaths, <String>[
|
expect(packagePaths, <String>[
|
||||||
fs.directory(fs.path.join(_kFlutterRoot, 'dev', 'tools', 'aatool')).path,
|
fileSystem.directory(fileSystem.path.join(_kFlutterRoot, 'dev', 'tools', 'aatool')).path,
|
||||||
fs.directory(fs.path.join(_kFlutterRoot, 'dev', 'tools')).path,
|
fileSystem.directory(fileSystem.path.join(_kFlutterRoot, 'dev', 'tools')).path,
|
||||||
]);
|
]);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Platform: () => platform,
|
Platform: () => platform,
|
||||||
}, initializeFlutterRoot: false);
|
FlutterVersion: () => FakeFlutterVersion(),
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
group('wrapping', () {
|
group('wrapping', () {
|
||||||
@ -188,7 +148,7 @@ void main() {
|
|||||||
await runner.run(<String>['fake']);
|
await runner.run(<String>['fake']);
|
||||||
expect(fakeCommand.preferences.wrapText, isTrue);
|
expect(fakeCommand.preferences.wrapText, isTrue);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Stdio: () => FakeStdio(hasFakeTerminal: true),
|
Stdio: () => FakeStdio(hasFakeTerminal: true),
|
||||||
}, initializeFlutterRoot: false);
|
}, initializeFlutterRoot: false);
|
||||||
@ -199,7 +159,7 @@ void main() {
|
|||||||
await runner.run(<String>['fake']);
|
await runner.run(<String>['fake']);
|
||||||
expect(fakeCommand.preferences.wrapText, isFalse);
|
expect(fakeCommand.preferences.wrapText, isFalse);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Stdio: () => FakeStdio(hasFakeTerminal: false),
|
Stdio: () => FakeStdio(hasFakeTerminal: false),
|
||||||
}, initializeFlutterRoot: false);
|
}, initializeFlutterRoot: false);
|
||||||
@ -210,7 +170,7 @@ void main() {
|
|||||||
await runner.run(<String>['--no-wrap', 'fake']);
|
await runner.run(<String>['--no-wrap', 'fake']);
|
||||||
expect(fakeCommand.preferences.wrapText, isFalse);
|
expect(fakeCommand.preferences.wrapText, isFalse);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Stdio: () => FakeStdio(hasFakeTerminal: true),
|
Stdio: () => FakeStdio(hasFakeTerminal: true),
|
||||||
}, initializeFlutterRoot: false);
|
}, initializeFlutterRoot: false);
|
||||||
@ -221,7 +181,7 @@ void main() {
|
|||||||
await runner.run(<String>['--wrap', 'fake']);
|
await runner.run(<String>['--wrap', 'fake']);
|
||||||
expect(fakeCommand.preferences.wrapText, isTrue);
|
expect(fakeCommand.preferences.wrapText, isTrue);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
Stdio: () => FakeStdio(hasFakeTerminal: false),
|
Stdio: () => FakeStdio(hasFakeTerminal: false),
|
||||||
}, initializeFlutterRoot: false);
|
}, initializeFlutterRoot: false);
|
||||||
@ -229,12 +189,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
class MockProcessManager extends Mock implements ProcessManager {}
|
|
||||||
|
|
||||||
class FakeFlutterVersion extends FlutterVersion {
|
|
||||||
@override
|
|
||||||
String get frameworkVersion => '0.10.3';
|
|
||||||
}
|
|
||||||
|
|
||||||
class FakeFlutterCommand extends FlutterCommand {
|
class FakeFlutterCommand extends FlutterCommand {
|
||||||
OutputPreferences preferences;
|
OutputPreferences preferences;
|
||||||
|
@ -16,8 +16,6 @@ import 'package:flutter_tools/src/build_info.dart';
|
|||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/device.dart';
|
import 'package:flutter_tools/src/device.dart';
|
||||||
import 'package:flutter_tools/src/tester/flutter_tester.dart';
|
import 'package:flutter_tools/src/tester/flutter_tester.dart';
|
||||||
import 'package:flutter_tools/src/version.dart';
|
|
||||||
import 'package:mockito/mockito.dart';
|
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
@ -100,7 +98,7 @@ void main() {
|
|||||||
artifacts: Artifacts.test(),
|
artifacts: Artifacts.test(),
|
||||||
buildDirectory: 'build',
|
buildDirectory: 'build',
|
||||||
logger: BufferLogger.test(),
|
logger: BufferLogger.test(),
|
||||||
flutterVersion: MockFlutterVersion(),
|
flutterVersion: FakeFlutterVersion(),
|
||||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
logLines = <String>[];
|
logLines = <String>[];
|
||||||
@ -183,9 +181,7 @@ FlutterTesterDevices setUpFlutterTesterDevices() {
|
|||||||
processManager: FakeProcessManager.any(),
|
processManager: FakeProcessManager.any(),
|
||||||
fileSystem: MemoryFileSystem.test(),
|
fileSystem: MemoryFileSystem.test(),
|
||||||
config: Config.test(),
|
config: Config.test(),
|
||||||
flutterVersion: MockFlutterVersion(),
|
flutterVersion: FakeFlutterVersion(),
|
||||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockFlutterVersion extends Mock implements FlutterVersion {}
|
|
||||||
|
@ -112,7 +112,7 @@ void testUsingContext(
|
|||||||
Config: () => buildConfig(globals.fs),
|
Config: () => buildConfig(globals.fs),
|
||||||
DeviceManager: () => FakeDeviceManager(),
|
DeviceManager: () => FakeDeviceManager(),
|
||||||
Doctor: () => FakeDoctor(globals.logger),
|
Doctor: () => FakeDoctor(globals.logger),
|
||||||
FlutterVersion: () => MockFlutterVersion(),
|
FlutterVersion: () => FakeFlutterVersion(),
|
||||||
HttpClient: () => FakeHttpClient.any(),
|
HttpClient: () => FakeHttpClient.any(),
|
||||||
IOSSimulatorUtils: () {
|
IOSSimulatorUtils: () {
|
||||||
final MockIOSSimulatorUtils mock = MockIOSSimulatorUtils();
|
final MockIOSSimulatorUtils mock = MockIOSSimulatorUtils();
|
||||||
@ -377,8 +377,6 @@ class FakeXcodeProjectInterpreter implements XcodeProjectInterpreter {
|
|||||||
List<String> xcrunCommand() => <String>['xcrun'];
|
List<String> xcrunCommand() => <String>['xcrun'];
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockFlutterVersion extends Mock implements FlutterVersion {}
|
|
||||||
|
|
||||||
class MockCrashReporter extends Mock implements CrashReporter {}
|
class MockCrashReporter extends Mock implements CrashReporter {}
|
||||||
|
|
||||||
class LocalFileSystemBlockingSetCurrentDirectory extends LocalFileSystem {
|
class LocalFileSystemBlockingSetCurrentDirectory extends LocalFileSystem {
|
||||||
|
@ -448,14 +448,67 @@ class FakePub extends Fake implements Pub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FakeFlutterVersion implements FlutterVersion {
|
class FakeFlutterVersion implements FlutterVersion {
|
||||||
@override
|
FakeFlutterVersion({
|
||||||
void fetchTagsAndUpdate() { }
|
this.channel = 'unknown',
|
||||||
|
this.dartSdkVersion = '12',
|
||||||
|
this.engineRevision = 'abcdefghijklmnopqrstuvwxyz',
|
||||||
|
this.engineRevisionShort = 'abcde',
|
||||||
|
this.repositoryUrl = 'https://github.com/flutter/flutter.git',
|
||||||
|
this.frameworkVersion = '0.0.0',
|
||||||
|
this.frameworkRevision = '11111111111111111111',
|
||||||
|
this.frameworkRevisionShort = '11111',
|
||||||
|
this.frameworkAge = '0 hours ago',
|
||||||
|
this.frameworkCommitDate = '12/01/01'
|
||||||
|
});
|
||||||
|
|
||||||
|
bool get didFetchTagsAndUpdate => _didFetchTagsAndUpdate;
|
||||||
|
bool _didFetchTagsAndUpdate = false;
|
||||||
|
|
||||||
|
bool get didCheckFlutterVersionFreshness => _didCheckFlutterVersionFreshness;
|
||||||
|
bool _didCheckFlutterVersionFreshness = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get channel => 'master';
|
final String channel;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> checkFlutterVersionFreshness() async { }
|
final String dartSdkVersion;
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String engineRevision;
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String engineRevisionShort;
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String repositoryUrl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String frameworkVersion;
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String frameworkRevision;
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String frameworkRevisionShort;
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String frameworkAge;
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String frameworkCommitDate;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get frameworkDate => frameworkCommitDate;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void fetchTagsAndUpdate() {
|
||||||
|
_didFetchTagsAndUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> checkFlutterVersionFreshness() async {
|
||||||
|
_didCheckFlutterVersionFreshness = true;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool checkRevisionAncestry({String tentativeDescendantRevision, String tentativeAncestorRevision}) {
|
bool checkRevisionAncestry({String tentativeDescendantRevision, String tentativeAncestorRevision}) {
|
||||||
@ -463,38 +516,13 @@ class FakeFlutterVersion implements FlutterVersion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get dartSdkVersion => '12';
|
GitTagVersion get gitTagVersion {
|
||||||
|
throw UnimplementedError();
|
||||||
@override
|
}
|
||||||
String get engineRevision => '42.2';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get engineRevisionShort => '42';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> ensureVersionFile() async { }
|
Future<void> ensureVersionFile() async { }
|
||||||
|
|
||||||
@override
|
|
||||||
String get frameworkAge => null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get frameworkCommitDate => null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get frameworkDate => null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get frameworkRevision => null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get frameworkRevisionShort => null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get frameworkVersion => null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
GitTagVersion get gitTagVersion => null;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getBranchName({bool redactUnknownBranches = false}) {
|
String getBranchName({bool redactUnknownBranches = false}) {
|
||||||
return 'master';
|
return 'master';
|
||||||
@ -505,12 +533,9 @@ class FakeFlutterVersion implements FlutterVersion {
|
|||||||
return 'v0.0.0';
|
return 'v0.0.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
String get repositoryUrl => null;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Object> toJson() {
|
Map<String, Object> toJson() {
|
||||||
return null;
|
return <String, Object>{};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import 'package:flutter_tools/src/build_info.dart';
|
|||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||||
import 'package:flutter_tools/src/ios/devices.dart';
|
import 'package:flutter_tools/src/ios/devices.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
|
import 'package:flutter_tools/src/version.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
@ -232,3 +233,4 @@ class MockStdIn extends Mock implements IOSink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MockStream extends Mock implements Stream<List<int>> {}
|
class MockStream extends Mock implements Stream<List<int>> {}
|
||||||
|
class MockFlutterVersion extends Mock implements FlutterVersion {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user