Fixes for test failures in Dart 2 mode (#18122)
This commit is contained in:
committed by
GitHub
parent
12eeb94c89
commit
da7670c2ee
@@ -237,7 +237,7 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
|
||||
);
|
||||
|
||||
process.stdin.addStream(stdin);
|
||||
await waitGroup<Null>(<Future<Null>>[
|
||||
await waitGroup<void>(<Future<void>>[
|
||||
stdout.addStream(process.stdout),
|
||||
stderr.addStream(process.stderr),
|
||||
]);
|
||||
|
||||
@@ -120,8 +120,8 @@ class Fingerprint {
|
||||
final String version = content['version'];
|
||||
if (version != FlutterVersion.instance.frameworkRevision)
|
||||
throw new ArgumentError('Incompatible fingerprint version: $version');
|
||||
_checksums = content['files'] ?? <String, String>{};
|
||||
_properties = content['properties'] ?? <String, String>{};
|
||||
_checksums = content['files']?.cast<String,String>() ?? <String, String>{};
|
||||
_properties = content['properties']?.cast<String,String>() ?? <String, String>{};
|
||||
}
|
||||
|
||||
Map<String, String> _checksums;
|
||||
|
||||
@@ -441,7 +441,8 @@ class DevFS {
|
||||
_entries.forEach((Uri deviceUri, DevFSContent content) {
|
||||
if (!content._exists) {
|
||||
final Future<Map<String, dynamic>> operation =
|
||||
_operations.deleteFile(fsName, deviceUri);
|
||||
_operations.deleteFile(fsName, deviceUri)
|
||||
.then((dynamic v) => v?.cast<String,dynamic>());
|
||||
if (operation != null)
|
||||
_pendingOperations.add(operation);
|
||||
toRemove.add(deviceUri);
|
||||
@@ -533,7 +534,8 @@ class DevFS {
|
||||
// Make service protocol requests for each.
|
||||
dirtyEntries.forEach((Uri deviceUri, DevFSContent content) {
|
||||
final Future<Map<String, dynamic>> operation =
|
||||
_operations.writeFile(fsName, deviceUri, content);
|
||||
_operations.writeFile(fsName, deviceUri, content)
|
||||
.then((dynamic v) => v?.cast<String, dynamic>());
|
||||
if (operation != null)
|
||||
_pendingOperations.add(operation);
|
||||
});
|
||||
|
||||
@@ -88,7 +88,7 @@ Use the 'android' tool to install them:
|
||||
setUp(() {
|
||||
hardware = 'unknown';
|
||||
buildCharacteristics = 'unused';
|
||||
when(mockProcessManager.run(argThat(contains('getprop')),
|
||||
when(mockProcessManager.run(typedArgThat(contains('getprop')),
|
||||
stderrEncoding: anyNamed('stderrEncoding'),
|
||||
stdoutEncoding: anyNamed('stdoutEncoding'))).thenAnswer((_) {
|
||||
final StringBuffer buf = new StringBuffer()
|
||||
|
||||
@@ -73,7 +73,8 @@ void main() {
|
||||
|
||||
final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
|
||||
when(processManager.canRun(sdk.sdkManagerPath)).thenReturn(true);
|
||||
when(processManager.runSync(<String>[sdk.sdkManagerPath, '--version'], environment: argThat(isNotNull)))
|
||||
when(processManager.runSync(<String>[sdk.sdkManagerPath, '--version'],
|
||||
environment: typedArgThat(isNotNull, named: 'environment')))
|
||||
.thenReturn(new ProcessResult(1, 0, '26.1.1\n', ''));
|
||||
expect(sdk.sdkManagerVersion, '26.1.1');
|
||||
}, overrides: <Type, Generator>{
|
||||
@@ -87,7 +88,8 @@ void main() {
|
||||
|
||||
final AndroidSdk sdk = AndroidSdk.locateAndroidSdk();
|
||||
when(processManager.canRun(sdk.sdkManagerPath)).thenReturn(true);
|
||||
when(processManager.runSync(<String>[sdk.sdkManagerPath, '--version'], environment: argThat(isNotNull)))
|
||||
when(processManager.runSync(<String>[sdk.sdkManagerPath, '--version'],
|
||||
environment: typedArgThat(isNotNull, named: 'environment')))
|
||||
.thenReturn(new ProcessResult(1, 1, '26.1.1\n', 'Mystery error'));
|
||||
expect(sdk.sdkManagerVersion, isNull);
|
||||
}, overrides: <Type, Generator>{
|
||||
|
||||
@@ -120,7 +120,7 @@ void main() {
|
||||
GenSnapshot: () => genSnapshot,
|
||||
};
|
||||
|
||||
Future<Null> writeFingerprint({ Map<String, String> files = const <String, String>{} }) {
|
||||
Future<void> writeFingerprint({ Map<String, String> files = const <String, String>{} }) {
|
||||
return fs.file('output.snapshot.d.fingerprint').writeAsString(json.encode(<String, dynamic>{
|
||||
'version': kVersion,
|
||||
'properties': <String, String>{
|
||||
|
||||
@@ -61,7 +61,7 @@ void main() {
|
||||
});
|
||||
expect(response['id'], isNull);
|
||||
expect(response['event'], 'daemon.logMessage');
|
||||
final Map<String, String> logMessage = response['params'];
|
||||
final Map<String, String> logMessage = response['params'].cast<String, String>();
|
||||
expect(logMessage['level'], 'error');
|
||||
expect(logMessage['message'], 'daemon.logMessage test');
|
||||
responses.close();
|
||||
|
||||
@@ -142,7 +142,7 @@ void main() {
|
||||
|
||||
testUsingContext('creates swift Podfile if swift', () {
|
||||
when(mockXcodeProjectInterpreter.isInstalled).thenReturn(true);
|
||||
when(mockXcodeProjectInterpreter.getBuildSettings(any, any)).thenReturn(<String, String>{
|
||||
when(mockXcodeProjectInterpreter.getBuildSettings(typed(any), typed(any))).thenReturn(<String, String>{
|
||||
'SWIFT_VERSION': '4.0',
|
||||
});
|
||||
|
||||
@@ -204,7 +204,7 @@ void main() {
|
||||
iosEngineDir: 'engine/path',
|
||||
);
|
||||
verifyNever(mockProcessManager.run(
|
||||
argThat(containsAllInOrder(<String>['pod', 'install'])),
|
||||
typedArgThat(containsAllInOrder(<String>['pod', 'install'])),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
));
|
||||
@@ -226,7 +226,7 @@ void main() {
|
||||
} catch(e) {
|
||||
expect(e, const isInstanceOf<ToolExit>());
|
||||
verifyNever(mockProcessManager.run(
|
||||
argThat(containsAllInOrder(<String>['pod', 'install'])),
|
||||
typedArgThat(containsAllInOrder(<String>['pod', 'install'])),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
));
|
||||
@@ -437,7 +437,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
||||
);
|
||||
expect(didInstall, isFalse);
|
||||
verifyNever(mockProcessManager.run(
|
||||
argThat(containsAllInOrder(<String>['pod', 'install'])),
|
||||
typedArgThat(containsAllInOrder(<String>['pod', 'install'])),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment'),
|
||||
));
|
||||
|
||||
@@ -72,11 +72,12 @@ void main() {
|
||||
when(mockProcessManager.runSync(<String>['which', 'openssl']))
|
||||
.thenReturn(exitsHappy);
|
||||
when(mockProcessManager.runSync(
|
||||
argThat(contains('find-identity')),
|
||||
typedArgThat(contains('find-identity')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenReturn(exitsHappy);
|
||||
|
||||
|
||||
Map<String, String> signingConfigs;
|
||||
try {
|
||||
signingConfigs = await getCodeSigningIdentityDevelopmentTeam(iosApp: app);
|
||||
@@ -96,7 +97,7 @@ void main() {
|
||||
when(mockProcessManager.runSync(<String>['which', 'openssl']))
|
||||
.thenReturn(exitsHappy);
|
||||
when(mockProcessManager.runSync(
|
||||
argThat(contains('find-identity')),
|
||||
typedArgThat(contains('find-identity')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenReturn(new ProcessResult(
|
||||
@@ -123,7 +124,7 @@ void main() {
|
||||
final MockStream mockStdErr = new MockStream();
|
||||
|
||||
when(mockProcessManager.start(
|
||||
argThat(contains('openssl')),
|
||||
typedArgThat(contains('openssl')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockProcess));
|
||||
@@ -155,7 +156,7 @@ void main() {
|
||||
when(mockProcessManager.runSync(<String>['which', 'openssl']))
|
||||
.thenReturn(exitsHappy);
|
||||
when(mockProcessManager.runSync(
|
||||
argThat(contains('find-identity')),
|
||||
typedArgThat(contains('find-identity')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenReturn(new ProcessResult(
|
||||
@@ -182,7 +183,7 @@ void main() {
|
||||
final MockStream mockStdErr = new MockStream();
|
||||
|
||||
when(mockProcessManager.start(
|
||||
argThat(contains('openssl')),
|
||||
typedArgThat(contains('openssl')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockProcess));
|
||||
@@ -218,7 +219,7 @@ void main() {
|
||||
when(mockProcessManager.runSync(<String>['which', 'openssl']))
|
||||
.thenReturn(exitsHappy);
|
||||
when(mockProcessManager.runSync(
|
||||
argThat(contains('find-identity')),
|
||||
typedArgThat(contains('find-identity')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenReturn(new ProcessResult(
|
||||
@@ -249,7 +250,7 @@ void main() {
|
||||
final MockStream mockOpenSslStdErr = new MockStream();
|
||||
|
||||
when(mockProcessManager.start(
|
||||
argThat(contains('openssl')),
|
||||
typedArgThat(contains('openssl')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess));
|
||||
@@ -292,7 +293,7 @@ void main() {
|
||||
when(mockProcessManager.runSync(<String>['which', 'openssl']))
|
||||
.thenReturn(exitsHappy);
|
||||
when(mockProcessManager.runSync(
|
||||
argThat(contains('find-identity')),
|
||||
typedArgThat(contains('find-identity')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenReturn(new ProcessResult(
|
||||
@@ -323,7 +324,7 @@ void main() {
|
||||
final MockStream mockOpenSslStdErr = new MockStream();
|
||||
|
||||
when(mockProcessManager.start(
|
||||
argThat(contains('openssl')),
|
||||
typedArgThat(contains('openssl')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess));
|
||||
@@ -360,7 +361,7 @@ void main() {
|
||||
when(mockProcessManager.runSync(<String>['which', 'openssl']))
|
||||
.thenReturn(exitsHappy);
|
||||
when(mockProcessManager.runSync(
|
||||
argThat(contains('find-identity')),
|
||||
typedArgThat(contains('find-identity')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenReturn(new ProcessResult(
|
||||
@@ -389,7 +390,7 @@ void main() {
|
||||
final MockStream mockOpenSslStdErr = new MockStream();
|
||||
|
||||
when(mockProcessManager.start(
|
||||
argThat(contains('openssl')),
|
||||
typedArgThat(contains('openssl')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess));
|
||||
@@ -430,7 +431,7 @@ void main() {
|
||||
when(mockProcessManager.runSync(<String>['which', 'openssl']))
|
||||
.thenReturn(exitsHappy);
|
||||
when(mockProcessManager.runSync(
|
||||
argThat(contains('find-identity')),
|
||||
typedArgThat(contains('find-identity')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenReturn(new ProcessResult(
|
||||
@@ -462,7 +463,7 @@ void main() {
|
||||
final MockStream mockOpenSslStdErr = new MockStream();
|
||||
|
||||
when(mockProcessManager.start(
|
||||
argThat(contains('openssl')),
|
||||
typedArgThat(contains('openssl')),
|
||||
environment: anyNamed('environment'),
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
)).thenAnswer((Invocation invocation) => new Future<Process>.value(mockOpenSslProcess));
|
||||
|
||||
@@ -82,7 +82,7 @@ void main() {
|
||||
|
||||
testUsingContext('idevicescreenshot captures and returns screenshot', () async {
|
||||
when(mockOutputFile.path).thenReturn(outputPath);
|
||||
when(mockProcessManager.run(any, environment: null, workingDirectory: null)).thenAnswer(
|
||||
when(mockProcessManager.run(typed(any), environment: null, workingDirectory: null)).thenAnswer(
|
||||
(Invocation invocation) => new Future<ProcessResult>.value(new ProcessResult(4, 0, '', '')));
|
||||
|
||||
await iMobileDevice.takeScreenshot(mockOutputFile);
|
||||
|
||||
@@ -175,7 +175,7 @@ void main() {
|
||||
mockProcessManager = new MockProcessManager();
|
||||
// Let everything else return exit code 0 so process.dart doesn't crash.
|
||||
when(
|
||||
mockProcessManager.run(any, environment: null, workingDirectory: null)
|
||||
mockProcessManager.run(typed(any), environment: null, workingDirectory: null)
|
||||
).thenAnswer((Invocation invocation) =>
|
||||
new Future<ProcessResult>.value(new ProcessResult(2, 0, '', ''))
|
||||
);
|
||||
@@ -229,7 +229,7 @@ void main() {
|
||||
|
||||
setUp(() {
|
||||
mockProcessManager = new MockProcessManager();
|
||||
when(mockProcessManager.start(any, environment: null, workingDirectory: null))
|
||||
when(mockProcessManager.start(typed(any), environment: null, workingDirectory: null))
|
||||
.thenAnswer((Invocation invocation) => new Future<Process>.value(new MockProcess()));
|
||||
});
|
||||
|
||||
@@ -237,7 +237,7 @@ void main() {
|
||||
final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 9.3');
|
||||
await launchDeviceLogTool(device);
|
||||
expect(
|
||||
verify(mockProcessManager.start(captureAny, environment: null, workingDirectory: null)).captured.single,
|
||||
verify(mockProcessManager.start(typed(captureAny), environment: null, workingDirectory: null)).captured.single,
|
||||
contains('tail'),
|
||||
);
|
||||
},
|
||||
@@ -249,7 +249,7 @@ void main() {
|
||||
final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 11.0');
|
||||
await launchDeviceLogTool(device);
|
||||
expect(
|
||||
verify(mockProcessManager.start(captureAny, environment: null, workingDirectory: null)).captured.single,
|
||||
verify(mockProcessManager.start(typed(captureAny), environment: null, workingDirectory: null)).captured.single,
|
||||
contains('/usr/bin/log'),
|
||||
);
|
||||
},
|
||||
@@ -271,7 +271,7 @@ void main() {
|
||||
final IOSSimulator device = new IOSSimulator('x', name: 'iPhone SE', category: 'iOS 9.3');
|
||||
await launchSystemLogTool(device);
|
||||
expect(
|
||||
verify(mockProcessManager.start(captureAny, environment: null, workingDirectory: null)).captured.single,
|
||||
verify(mockProcessManager.start(typed(captureAny), environment: null, workingDirectory: null)).captured.single,
|
||||
contains('tail'),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -282,7 +282,7 @@ Information about project "Runner":
|
||||
}
|
||||
|
||||
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, typed(any))).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
|
||||
const BuildInfo buildInfo = const BuildInfo(BuildMode.debug, null,
|
||||
previewDart2: true,
|
||||
@@ -302,7 +302,7 @@ Information about project "Runner":
|
||||
});
|
||||
|
||||
testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, typed(any))).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
|
||||
const BuildInfo buildInfo = const BuildInfo(BuildMode.debug, null,
|
||||
previewDart2: true,
|
||||
@@ -323,7 +323,7 @@ Information about project "Runner":
|
||||
});
|
||||
|
||||
testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, typed(any))).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
|
||||
const BuildInfo buildInfo = const BuildInfo(BuildMode.debug, null,
|
||||
previewDart2: true,
|
||||
@@ -343,7 +343,7 @@ Information about project "Runner":
|
||||
});
|
||||
|
||||
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, typed(any))).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile'));
|
||||
const BuildInfo buildInfo = const BuildInfo(BuildMode.debug, null,
|
||||
previewDart2: true,
|
||||
|
||||
@@ -60,7 +60,9 @@ void main() {
|
||||
verify(clock.now()).called(2);
|
||||
|
||||
expect(
|
||||
verify(usage.sendTiming(captureAny, captureAny, captureAny, label: captureAny)).captured,
|
||||
verify(usage.sendTiming(
|
||||
typed(captureAny), typed(captureAny), typed(captureAny),
|
||||
label: captureAnyNamed('label'))).captured,
|
||||
<dynamic>['flutter', 'dummy', const Duration(milliseconds: 1000), null]
|
||||
);
|
||||
},
|
||||
@@ -77,7 +79,9 @@ void main() {
|
||||
new DummyFlutterCommand(noUsagePath: true);
|
||||
await flutterCommand.run();
|
||||
verify(clock.now()).called(2);
|
||||
verifyNever(usage.sendTiming(captureAny, captureAny, captureAny, label: captureAny));
|
||||
verifyNever(usage.sendTiming(
|
||||
typed(captureAny), typed(captureAny), typed(captureAny),
|
||||
label: captureAnyNamed('label')));
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
Clock: () => clock,
|
||||
@@ -101,7 +105,9 @@ void main() {
|
||||
await flutterCommand.run();
|
||||
verify(clock.now()).called(2);
|
||||
expect(
|
||||
verify(usage.sendTiming(captureAny, captureAny, captureAny, label: captureAny)).captured,
|
||||
verify(usage.sendTiming(
|
||||
typed(captureAny), typed(captureAny), typed(captureAny),
|
||||
label: captureAnyNamed('label'))).captured,
|
||||
<dynamic>[
|
||||
'flutter',
|
||||
'dummy',
|
||||
@@ -130,8 +136,15 @@ void main() {
|
||||
verify(clock.now()).called(2);
|
||||
|
||||
expect(
|
||||
verify(usage.sendTiming(captureAny, captureAny, captureAny, label: captureAny)).captured,
|
||||
<dynamic>['flutter', 'dummy', const Duration(milliseconds: 1000), 'fail']
|
||||
verify(usage.sendTiming(
|
||||
typed(captureAny), typed(captureAny), typed(captureAny),
|
||||
label: captureAnyNamed('label'))).captured,
|
||||
<dynamic>[
|
||||
'flutter',
|
||||
'dummy',
|
||||
const Duration(milliseconds: 1000),
|
||||
'fail'
|
||||
]
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user