Unverified Commit da7670c2 authored by Keerti Parthasarathy's avatar Keerti Parthasarathy Committed by GitHub

Fixes for test failures in Dart 2 mode (#18122)

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