Unverified Commit d018c24b authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

MockProcessUtils->FakeProcessManager in version_test (#77985)

parent fad7c367
...@@ -23,6 +23,7 @@ import 'package:process/process.dart'; ...@@ -23,6 +23,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';
void main() { void main() {
setUpAll(() { setUpAll(() {
...@@ -206,7 +207,7 @@ void main() { ...@@ -206,7 +207,7 @@ void main() {
unawaited(commandRunner.run(<String>['analyze', '--watch'])); unawaited(commandRunner.run(<String>['analyze', '--watch']));
await stdin.stream.first; await stdin.stream.first;
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('Can run AnalysisService with customized cache location --watch', () async { testUsingContext('Can run AnalysisService with customized cache location --watch', () async {
...@@ -244,6 +245,6 @@ void main() { ...@@ -244,6 +245,6 @@ void main() {
unawaited(commandRunner.run(<String>['analyze', '--watch'])); unawaited(commandRunner.run(<String>['analyze', '--watch']));
await stdin.stream.first; await stdin.stream.first;
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
} }
...@@ -23,6 +23,7 @@ import 'package:flutter_tools/src/globals.dart' as globals; ...@@ -23,6 +23,7 @@ import 'package:flutter_tools/src/globals.dart' as globals;
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fake_process_manager.dart';
import '../../src/fakes.dart'; import '../../src/fakes.dart';
import '../../src/testbed.dart'; import '../../src/testbed.dart';
...@@ -456,7 +457,7 @@ void main() { ...@@ -456,7 +457,7 @@ void main() {
); );
await createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'test']); await createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'test']);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(), FileSystem: () => MemoryFileSystem.test(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}), Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
...@@ -481,7 +482,7 @@ void main() { ...@@ -481,7 +482,7 @@ void main() {
); );
await createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'test']); await createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'test']);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(), FileSystem: () => MemoryFileSystem.test(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}), Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
...@@ -510,7 +511,7 @@ void main() { ...@@ -510,7 +511,7 @@ void main() {
); );
await createTestCommandRunner(PackagesCommand()).run(<String>['packages', '--verbose', 'pub', 'run', '--foo', 'bar']); await createTestCommandRunner(PackagesCommand()).run(<String>['packages', '--verbose', 'pub', 'run', '--foo', 'bar']);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(), FileSystem: () => MemoryFileSystem.test(),
Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}), Platform: () => FakePlatform(operatingSystem: 'linux', environment: <String, String>{}),
......
...@@ -11,6 +11,7 @@ import 'package:test/fake.dart'; ...@@ -11,6 +11,7 @@ import 'package:test/fake.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fake_process_manager.dart';
const int kLollipopVersionCode = 21; const int kLollipopVersionCode = 21;
const String kLastLogcatTimestamp = '11-27 15:39:04.506'; const String kLastLogcatTimestamp = '11-27 15:39:04.506';
...@@ -43,7 +44,7 @@ void main() { ...@@ -43,7 +44,7 @@ void main() {
processManager, processManager,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('AdbLogReader calls adb logcat with expected flags apiVersion < 21', () async { testWithoutContext('AdbLogReader calls adb logcat with expected flags apiVersion < 21', () async {
...@@ -66,7 +67,7 @@ void main() { ...@@ -66,7 +67,7 @@ void main() {
processManager, processManager,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('AdbLogReader calls adb logcat with expected flags null apiVersion', () async { testWithoutContext('AdbLogReader calls adb logcat with expected flags null apiVersion', () async {
...@@ -89,7 +90,7 @@ void main() { ...@@ -89,7 +90,7 @@ void main() {
processManager, processManager,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('AdbLogReader calls adb logcat with expected flags when requesting past logs', () async { testWithoutContext('AdbLogReader calls adb logcat with expected flags when requesting past logs', () async {
...@@ -115,7 +116,7 @@ void main() { ...@@ -115,7 +116,7 @@ void main() {
includePastLogs: true, includePastLogs: true,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('AdbLogReader handles process early exit', () async { testWithoutContext('AdbLogReader handles process early exit', () async {
......
...@@ -11,6 +11,7 @@ import 'package:flutter_tools/src/device.dart'; ...@@ -11,6 +11,7 @@ import 'package:flutter_tools/src/device.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fake_process_manager.dart';
void main() { void main() {
testWithoutContext('AndroidDevicePortForwarder returns the generated host ' testWithoutContext('AndroidDevicePortForwarder returns the generated host '
...@@ -123,7 +124,7 @@ void main() { ...@@ -123,7 +124,7 @@ void main() {
await forwarder.dispose(); await forwarder.dispose();
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('failures to unforward port do not throw if the forward is missing', () async { testWithoutContext('failures to unforward port do not throw if the forward is missing', () async {
......
...@@ -17,6 +17,7 @@ import 'package:test/fake.dart'; ...@@ -17,6 +17,7 @@ import 'package:test/fake.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fake_process_manager.dart';
const FakeCommand kAdbVersionCommand = FakeCommand( const FakeCommand kAdbVersionCommand = FakeCommand(
command: <String>['adb', 'version'], command: <String>['adb', 'version'],
...@@ -121,7 +122,7 @@ void main() { ...@@ -121,7 +122,7 @@ void main() {
); );
expect(launchResult.started, true); expect(launchResult.started, true);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
} }
...@@ -160,7 +161,7 @@ void main() { ...@@ -160,7 +161,7 @@ void main() {
); );
expect(launchResult.started, false); expect(launchResult.started, false);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('AndroidDevice.startApp forwards all supported debugging options', () async { testWithoutContext('AndroidDevice.startApp forwards all supported debugging options', () async {
...@@ -285,7 +286,7 @@ void main() { ...@@ -285,7 +286,7 @@ void main() {
// This fails to start due to observatory discovery issues. // This fails to start due to observatory discovery issues.
expect(launchResult.started, false); expect(launchResult.started, false);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
} }
......
...@@ -23,6 +23,7 @@ import 'package:test/fake.dart'; ...@@ -23,6 +23,7 @@ import 'package:test/fake.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fake_process_manager.dart';
void main() { void main() {
group('gradle build', () { group('gradle build', () {
...@@ -372,7 +373,7 @@ void main() { ...@@ -372,7 +373,7 @@ void main() {
); );
}, },
throwsA(isA<ProcessException>())); throwsA(isA<ProcessException>()));
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('logs success event after a successful retry', () async { testUsingContext('logs success event after a successful retry', () async {
...@@ -470,7 +471,7 @@ void main() { ...@@ -470,7 +471,7 @@ void main() {
parameters: <String, String>{}, parameters: <String, String>{},
), ),
)); ));
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('performs code size analysis and sends analytics', () async { testUsingContext('performs code size analysis and sends analytics', () async {
...@@ -678,7 +679,7 @@ void main() { ...@@ -678,7 +679,7 @@ void main() {
parameters: <String, String>{}, parameters: <String, String>{},
), ),
)); ));
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('indicates that an APK has been built successfully', () async { testUsingContext('indicates that an APK has been built successfully', () async {
...@@ -742,7 +743,7 @@ void main() { ...@@ -742,7 +743,7 @@ void main() {
logger.statusText, logger.statusText,
contains('Built build/app/outputs/flutter-apk/app-release.apk (0.0MB)'), contains('Built build/app/outputs/flutter-apk/app-release.apk (0.0MB)'),
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext("doesn't indicate how to consume an AAR when printHowToConsumeAar is false", () async { testUsingContext("doesn't indicate how to consume an AAR when printHowToConsumeAar is false", () async {
...@@ -805,7 +806,7 @@ void main() { ...@@ -805,7 +806,7 @@ void main() {
logger.statusText.contains('Consuming the Module'), logger.statusText.contains('Consuming the Module'),
isFalse, isFalse,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('gradle exit code and stderr is forwarded to tool exit', () async { testUsingContext('gradle exit code and stderr is forwarded to tool exit', () async {
...@@ -861,7 +862,7 @@ void main() { ...@@ -861,7 +862,7 @@ void main() {
target: '', target: '',
buildNumber: '1.0', buildNumber: '1.0',
), throwsToolExit(exitCode: 108, message: 'Gradle task assembleAarRelease failed with exit code 108.')); ), throwsToolExit(exitCode: 108, message: 'Gradle task assembleAarRelease failed with exit code 108.'));
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('build apk uses selected local engine with arm32 ABI', () async { testUsingContext('build apk uses selected local engine with arm32 ABI', () async {
...@@ -935,7 +936,7 @@ void main() { ...@@ -935,7 +936,7 @@ void main() {
localGradleErrors: const <GradleHandledError>[], localGradleErrors: const <GradleHandledError>[],
); );
}, throwsToolExit()); }, throwsToolExit());
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('build apk uses selected local engine with arm64 ABI', () async { testUsingContext('build apk uses selected local engine with arm64 ABI', () async {
...@@ -1009,7 +1010,7 @@ void main() { ...@@ -1009,7 +1010,7 @@ void main() {
localGradleErrors: const <GradleHandledError>[], localGradleErrors: const <GradleHandledError>[],
); );
}, throwsToolExit()); }, throwsToolExit());
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('build apk uses selected local engine with x86 ABI', () async { testUsingContext('build apk uses selected local engine with x86 ABI', () async {
...@@ -1083,7 +1084,7 @@ void main() { ...@@ -1083,7 +1084,7 @@ void main() {
localGradleErrors: const <GradleHandledError>[], localGradleErrors: const <GradleHandledError>[],
); );
}, throwsToolExit()); }, throwsToolExit());
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('build apk uses selected local engine with x64 ABI', () async { testUsingContext('build apk uses selected local engine with x64 ABI', () async {
...@@ -1157,7 +1158,7 @@ void main() { ...@@ -1157,7 +1158,7 @@ void main() {
localGradleErrors: const <GradleHandledError>[], localGradleErrors: const <GradleHandledError>[],
); );
}, throwsToolExit()); }, throwsToolExit());
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('honors --no-android-gradle-daemon setting', () async { testUsingContext('honors --no-android-gradle-daemon setting', () async {
...@@ -1212,7 +1213,7 @@ void main() { ...@@ -1212,7 +1213,7 @@ void main() {
localGradleErrors: const <GradleHandledError>[], localGradleErrors: const <GradleHandledError>[],
); );
}, throwsToolExit()); }, throwsToolExit());
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('build aar uses selected local engine with arm32 ABI', () async { testUsingContext('build aar uses selected local engine with arm32 ABI', () async {
...@@ -1297,7 +1298,7 @@ void main() { ...@@ -1297,7 +1298,7 @@ void main() {
'1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/' '1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/'
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom' 'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
), exists); ), exists);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('build aar uses selected local engine with x64 ABI', () async { testUsingContext('build aar uses selected local engine with x64 ABI', () async {
...@@ -1382,7 +1383,7 @@ void main() { ...@@ -1382,7 +1383,7 @@ void main() {
'1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/' '1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/'
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom' 'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
), exists); ), exists);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('build aar uses selected local engine with x86 ABI', () async { testUsingContext('build aar uses selected local engine with x86 ABI', () async {
...@@ -1467,7 +1468,7 @@ void main() { ...@@ -1467,7 +1468,7 @@ void main() {
'1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/' '1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/'
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom' 'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
), exists); ), exists);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('build aar uses selected local engine on x64 ABI', () async { testUsingContext('build aar uses selected local engine on x64 ABI', () async {
...@@ -1552,7 +1553,7 @@ void main() { ...@@ -1552,7 +1553,7 @@ void main() {
'1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/' '1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b/'
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom' 'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
), exists); ), exists);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
}); });
} }
......
...@@ -15,6 +15,7 @@ import 'package:test/fake.dart'; ...@@ -15,6 +15,7 @@ import 'package:test/fake.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fake_process_manager.dart';
const FakeCommand kAdbVersionCommand = FakeCommand( const FakeCommand kAdbVersionCommand = FakeCommand(
command: <String>['adb', 'version'], command: <String>['adb', 'version'],
...@@ -84,7 +85,7 @@ void main() { ...@@ -84,7 +85,7 @@ void main() {
); );
expect(await androidDevice.installApp(androidApk), false); expect(await androidDevice.installApp(androidApk), false);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('Cannot install app if APK file is missing', () async { testWithoutContext('Cannot install app if APK file is missing', () async {
...@@ -128,7 +129,7 @@ void main() { ...@@ -128,7 +129,7 @@ void main() {
); );
expect(await androidDevice.installApp(androidApk, userIdentifier: '10'), true); expect(await androidDevice.installApp(androidApk, userIdentifier: '10'), true);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('Defaults to API level 16 if adb returns a null response', () async { testWithoutContext('Defaults to API level 16 if adb returns a null response', () async {
...@@ -157,7 +158,7 @@ void main() { ...@@ -157,7 +158,7 @@ void main() {
); );
expect(await androidDevice.installApp(androidApk, userIdentifier: '10'), true); expect(await androidDevice.installApp(androidApk, userIdentifier: '10'), true);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('displays error if user not found', () async { testWithoutContext('displays error if user not found', () async {
...@@ -202,7 +203,7 @@ void main() { ...@@ -202,7 +203,7 @@ void main() {
expect(await androidDevice.installApp(androidApk, userIdentifier: 'jane'), false); expect(await androidDevice.installApp(androidApk, userIdentifier: 'jane'), false);
expect(logger.errorText, contains('Error: User "jane" not found. Run "adb shell pm list users" to see list of available identifiers.')); expect(logger.errorText, contains('Error: User "jane" not found. Run "adb shell pm list users" to see list of available identifiers.'));
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('Will skip install if the correct version is up to date', () async { testWithoutContext('Will skip install if the correct version is up to date', () async {
...@@ -235,7 +236,7 @@ void main() { ...@@ -235,7 +236,7 @@ void main() {
); );
expect(await androidDevice.installApp(androidApk, userIdentifier: '10'), true); expect(await androidDevice.installApp(androidApk, userIdentifier: '10'), true);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('Will uninstall if the correct version is not up to date and install fails', () async { testWithoutContext('Will uninstall if the correct version is not up to date and install fails', () async {
...@@ -276,7 +277,7 @@ void main() { ...@@ -276,7 +277,7 @@ void main() {
); );
expect(await androidDevice.installApp(androidApk, userIdentifier: '10'), true); expect(await androidDevice.installApp(androidApk, userIdentifier: '10'), true);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('Will fail to install if the apk was never installed and it fails the first time', () async { testWithoutContext('Will fail to install if the apk was never installed and it fails the first time', () async {
...@@ -309,7 +310,7 @@ void main() { ...@@ -309,7 +310,7 @@ void main() {
); );
expect(await androidDevice.installApp(androidApk, userIdentifier: '10'), false); expect(await androidDevice.installApp(androidApk, userIdentifier: '10'), false);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
} }
......
...@@ -13,6 +13,7 @@ import 'package:flutter_tools/src/macos/xcode.dart'; ...@@ -13,6 +13,7 @@ import 'package:flutter_tools/src/macos/xcode.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fake_process_manager.dart';
const FakeCommand kWhichSysctlCommand = FakeCommand( const FakeCommand kWhichSysctlCommand = FakeCommand(
command: <String>[ command: <String>[
...@@ -296,7 +297,7 @@ void main() { ...@@ -296,7 +297,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds iOS armv7 snapshot with dwarStackTraces', () async { testWithoutContext('builds iOS armv7 snapshot with dwarStackTraces', () async {
...@@ -354,7 +355,7 @@ void main() { ...@@ -354,7 +355,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds iOS armv7 snapshot with obfuscate', () async { testWithoutContext('builds iOS armv7 snapshot with obfuscate', () async {
...@@ -410,7 +411,7 @@ void main() { ...@@ -410,7 +411,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
...@@ -465,7 +466,7 @@ void main() { ...@@ -465,7 +466,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds iOS arm64 snapshot', () async { testWithoutContext('builds iOS arm64 snapshot', () async {
...@@ -517,7 +518,7 @@ void main() { ...@@ -517,7 +518,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds shared library for android-arm (32bit)', () async { testWithoutContext('builds shared library for android-arm (32bit)', () async {
...@@ -546,7 +547,7 @@ void main() { ...@@ -546,7 +547,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds shared library for android-arm with dwarf stack traces', () async { testWithoutContext('builds shared library for android-arm with dwarf stack traces', () async {
...@@ -578,7 +579,7 @@ void main() { ...@@ -578,7 +579,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds shared library for android-arm with obfuscate', () async { testWithoutContext('builds shared library for android-arm with obfuscate', () async {
...@@ -608,7 +609,7 @@ void main() { ...@@ -608,7 +609,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds shared library for android-arm without dwarf stack traces due to empty string', () async { testWithoutContext('builds shared library for android-arm without dwarf stack traces due to empty string', () async {
...@@ -637,7 +638,7 @@ void main() { ...@@ -637,7 +638,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('builds shared library for android-arm64', () async { testWithoutContext('builds shared library for android-arm64', () async {
...@@ -664,7 +665,7 @@ void main() { ...@@ -664,7 +665,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('--no-strip in extraGenSnapshotOptions suppresses --strip', () async { testWithoutContext('--no-strip in extraGenSnapshotOptions suppresses --strip', () async {
...@@ -691,7 +692,7 @@ void main() { ...@@ -691,7 +692,7 @@ void main() {
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
}); });
} }
...@@ -21,6 +21,7 @@ import 'package:flutter_tools/src/convert.dart'; ...@@ -21,6 +21,7 @@ import 'package:flutter_tools/src/convert.dart';
import '../../../src/common.dart'; import '../../../src/common.dart';
import '../../../src/context.dart'; import '../../../src/context.dart';
import '../../../src/fake_process_manager.dart';
final Platform platform = FakePlatform(operatingSystem: 'linux', environment: const <String, String>{}); final Platform platform = FakePlatform(operatingSystem: 'linux', environment: const <String, String>{});
void main() { void main() {
...@@ -204,7 +205,7 @@ void main() { ...@@ -204,7 +205,7 @@ void main() {
await androidAot.build(environment); await androidAot.build(environment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
ProcessManager: () => processManager, ProcessManager: () => processManager,
...@@ -246,7 +247,7 @@ void main() { ...@@ -246,7 +247,7 @@ void main() {
await androidAot.build(environment); await androidAot.build(environment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
ProcessManager: () => processManager, ProcessManager: () => processManager,
......
...@@ -18,6 +18,7 @@ import 'package:flutter_tools/src/compile.dart'; ...@@ -18,6 +18,7 @@ import 'package:flutter_tools/src/compile.dart';
import '../../../src/common.dart'; import '../../../src/common.dart';
import '../../../src/context.dart'; import '../../../src/context.dart';
import '../../../src/fake_process_manager.dart';
const String kBoundaryKey = '4d2d9609-c662-4571-afde-31410f96caa6'; const String kBoundaryKey = '4d2d9609-c662-4571-afde-31410f96caa6';
const String kElfAot = '--snapshot_kind=app-aot-elf'; const String kElfAot = '--snapshot_kind=app-aot-elf';
...@@ -105,7 +106,7 @@ void main() { ...@@ -105,7 +106,7 @@ void main() {
await expectLater(() => const KernelSnapshot().build(androidEnvironment), await expectLater(() => const KernelSnapshot().build(androidEnvironment),
throwsA(isA<Exception>())); throwsA(isA<Exception>()));
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('KernelSnapshot does not use track widget creation on profile builds', () async { testWithoutContext('KernelSnapshot does not use track widget creation on profile builds', () async {
...@@ -141,7 +142,7 @@ void main() { ...@@ -141,7 +142,7 @@ void main() {
await const KernelSnapshot().build(androidEnvironment); await const KernelSnapshot().build(androidEnvironment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('KernelSnapshot correctly handles an empty string in ExtraFrontEndOptions', () async { testWithoutContext('KernelSnapshot correctly handles an empty string in ExtraFrontEndOptions', () async {
...@@ -178,7 +179,7 @@ void main() { ...@@ -178,7 +179,7 @@ void main() {
await const KernelSnapshot() await const KernelSnapshot()
.build(androidEnvironment..defines[kExtraFrontEndOptions] = ''); .build(androidEnvironment..defines[kExtraFrontEndOptions] = '');
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('KernelSnapshot correctly forwards ExtraFrontEndOptions', () async { testWithoutContext('KernelSnapshot correctly forwards ExtraFrontEndOptions', () async {
...@@ -217,7 +218,7 @@ void main() { ...@@ -217,7 +218,7 @@ void main() {
await const KernelSnapshot() await const KernelSnapshot()
.build(androidEnvironment..defines[kExtraFrontEndOptions] = 'foo,bar'); .build(androidEnvironment..defines[kExtraFrontEndOptions] = 'foo,bar');
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('KernelSnapshot can disable track-widget-creation on debug builds', () async { testWithoutContext('KernelSnapshot can disable track-widget-creation on debug builds', () async {
...@@ -254,7 +255,7 @@ void main() { ...@@ -254,7 +255,7 @@ void main() {
..defines[kBuildMode] = getNameForBuildMode(BuildMode.debug) ..defines[kBuildMode] = getNameForBuildMode(BuildMode.debug)
..defines[kTrackWidgetCreation] = 'false'); ..defines[kTrackWidgetCreation] = 'false');
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('KernelSnapshot forces platform linking on debug for darwin target platforms', () async { testWithoutContext('KernelSnapshot forces platform linking on debug for darwin target platforms', () async {
...@@ -292,7 +293,7 @@ void main() { ...@@ -292,7 +293,7 @@ void main() {
..defines[kTrackWidgetCreation] = 'false' ..defines[kTrackWidgetCreation] = 'false'
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('KernelSnapshot does use track widget creation on debug builds', () async { testWithoutContext('KernelSnapshot does use track widget creation on debug builds', () async {
...@@ -339,7 +340,7 @@ void main() { ...@@ -339,7 +340,7 @@ void main() {
await const KernelSnapshot().build(testEnvironment); await const KernelSnapshot().build(testEnvironment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('AotElfProfile Produces correct output directory', () async { testUsingContext('AotElfProfile Produces correct output directory', () async {
...@@ -364,7 +365,7 @@ void main() { ...@@ -364,7 +365,7 @@ void main() {
await const AotElfProfile(TargetPlatform.android_arm).build(androidEnvironment); await const AotElfProfile(TargetPlatform.android_arm).build(androidEnvironment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('AotElfRelease configures gen_snapshot with code size directory', () async { testUsingContext('AotElfRelease configures gen_snapshot with code size directory', () async {
...@@ -392,7 +393,7 @@ void main() { ...@@ -392,7 +393,7 @@ void main() {
await const AotElfRelease(TargetPlatform.android_arm).build(androidEnvironment); await const AotElfRelease(TargetPlatform.android_arm).build(androidEnvironment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testUsingContext('AotElfProfile throws error if missing build mode', () async { testUsingContext('AotElfProfile throws error if missing build mode', () async {
...@@ -548,7 +549,7 @@ void main() { ...@@ -548,7 +549,7 @@ void main() {
await const AotAssemblyProfile().build(iosEnvironment); await const AotAssemblyProfile().build(iosEnvironment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => macPlatform, Platform: () => macPlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
...@@ -620,7 +621,7 @@ void main() { ...@@ -620,7 +621,7 @@ void main() {
await const AotAssemblyProfile().build(iosEnvironment); await const AotAssemblyProfile().build(iosEnvironment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => macPlatform, Platform: () => macPlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
...@@ -695,7 +696,7 @@ void main() { ...@@ -695,7 +696,7 @@ void main() {
await const AotAssemblyProfile().build(iosEnvironment); await const AotAssemblyProfile().build(iosEnvironment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => macPlatform, Platform: () => macPlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
...@@ -729,6 +730,6 @@ void main() { ...@@ -729,6 +730,6 @@ void main() {
await const AotElfRelease(TargetPlatform.android_arm).build(androidEnvironment); await const AotElfRelease(TargetPlatform.android_arm).build(androidEnvironment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
} }
...@@ -18,6 +18,7 @@ import 'package:flutter_tools/src/convert.dart'; ...@@ -18,6 +18,7 @@ import 'package:flutter_tools/src/convert.dart';
import '../../../src/common.dart'; import '../../../src/common.dart';
import '../../../src/context.dart'; import '../../../src/context.dart';
import '../../../src/fake_process_manager.dart';
void main() { void main() {
Environment environment; Environment environment;
...@@ -76,7 +77,7 @@ void main() { ...@@ -76,7 +77,7 @@ void main() {
await const DebugUnpackMacOS().build(environment); await const DebugUnpackMacOS().build(environment);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
ProcessManager: () => processManager, ProcessManager: () => processManager,
......
...@@ -20,6 +20,7 @@ import 'package:fake_async/fake_async.dart'; ...@@ -20,6 +20,7 @@ import 'package:fake_async/fake_async.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/mocks.dart' as mocks; import '../../src/mocks.dart' as mocks;
void main() { void main() {
...@@ -93,7 +94,7 @@ void main() { ...@@ -93,7 +94,7 @@ void main() {
checkUpToDate: true, checkUpToDate: true,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b'); expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b');
}); });
...@@ -131,7 +132,7 @@ void main() { ...@@ -131,7 +132,7 @@ void main() {
checkUpToDate: true, checkUpToDate: true,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b'); expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b');
}); });
...@@ -169,7 +170,7 @@ void main() { ...@@ -169,7 +170,7 @@ void main() {
checkUpToDate: true, checkUpToDate: true,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b'); expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b');
}); });
...@@ -206,7 +207,7 @@ void main() { ...@@ -206,7 +207,7 @@ void main() {
checkUpToDate: true, checkUpToDate: true,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b'); expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b');
}); });
...@@ -245,7 +246,7 @@ void main() { ...@@ -245,7 +246,7 @@ void main() {
checkUpToDate: true, checkUpToDate: true,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b'); expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b');
}); });
...@@ -286,7 +287,7 @@ void main() { ...@@ -286,7 +287,7 @@ void main() {
checkUpToDate: true, checkUpToDate: true,
); );
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b'); expect(fileSystem.file('.dart_tool/version').readAsStringSync(), 'b');
}); });
......
...@@ -22,6 +22,7 @@ import 'package:flutter_tools/src/base/platform.dart'; ...@@ -22,6 +22,7 @@ import 'package:flutter_tools/src/base/platform.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart'; import '../src/context.dart';
import '../src/fake_process_manager.dart';
void main() { void main() {
FakePlatform platform; FakePlatform platform;
...@@ -155,7 +156,7 @@ void main() { ...@@ -155,7 +156,7 @@ void main() {
testUsingContext('Can pass additional arguments to tester binary', () async { testUsingContext('Can pass additional arguments to tester binary', () async {
await device.start(compiledEntrypointPath: 'example.dill'); await device.start(compiledEntrypointPath: 'example.dill');
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
}); });
......
...@@ -20,6 +20,7 @@ import 'package:flutter_tools/src/ios/ios_deploy.dart'; ...@@ -20,6 +20,7 @@ import 'package:flutter_tools/src/ios/ios_deploy.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/fakes.dart'; import '../../src/fakes.dart';
void main () { void main () {
...@@ -80,7 +81,7 @@ void main () { ...@@ -80,7 +81,7 @@ void main () {
expect(await iosDeployDebugger.launchAndAttach(), isTrue); expect(await iosDeployDebugger.launchAndAttach(), isTrue);
expect(await iosDeployDebugger.logLines.toList(), <String>['Did finish launching.']); expect(await iosDeployDebugger.logLines.toList(), <String>['Did finish launching.']);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
expect(appDeltaDirectory, exists); expect(appDeltaDirectory, exists);
}); });
}); });
...@@ -294,7 +295,7 @@ void main () { ...@@ -294,7 +295,7 @@ void main () {
); );
expect(exitCode, 0); expect(exitCode, 0);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('returns non-zero exit code when ios-deploy does the same', () async { testWithoutContext('returns non-zero exit code when ios-deploy does the same', () async {
...@@ -317,7 +318,7 @@ void main () { ...@@ -317,7 +318,7 @@ void main () {
); );
expect(exitCode, 1); expect(exitCode, 1);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
}); });
} }
......
...@@ -21,6 +21,7 @@ import 'package:meta/meta.dart'; ...@@ -21,6 +21,7 @@ import 'package:meta/meta.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/fakes.dart'; import '../../src/fakes.dart';
const Map<String, String> kDyLdLibEntry = <String, String>{ const Map<String, String> kDyLdLibEntry = <String, String>{
...@@ -64,7 +65,7 @@ void main() { ...@@ -64,7 +65,7 @@ void main() {
final bool wasInstalled = await device.installApp(iosApp); final bool wasInstalled = await device.installApp(iosApp);
expect(wasInstalled, true); expect(wasInstalled, true);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('IOSDevice.installApp calls ios-deploy correctly with network', () async { testWithoutContext('IOSDevice.installApp calls ios-deploy correctly with network', () async {
...@@ -94,7 +95,7 @@ void main() { ...@@ -94,7 +95,7 @@ void main() {
final bool wasInstalled = await device.installApp(iosApp); final bool wasInstalled = await device.installApp(iosApp);
expect(wasInstalled, true); expect(wasInstalled, true);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('IOSDevice.uninstallApp calls ios-deploy correctly', () async { testWithoutContext('IOSDevice.uninstallApp calls ios-deploy correctly', () async {
...@@ -116,7 +117,7 @@ void main() { ...@@ -116,7 +117,7 @@ void main() {
final bool wasUninstalled = await device.uninstallApp(iosApp); final bool wasUninstalled = await device.uninstallApp(iosApp);
expect(wasUninstalled, true); expect(wasUninstalled, true);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
group('isAppInstalled', () { group('isAppInstalled', () {
...@@ -141,7 +142,7 @@ void main() { ...@@ -141,7 +142,7 @@ void main() {
final bool isAppInstalled = await device.isAppInstalled(iosApp); final bool isAppInstalled = await device.isAppInstalled(iosApp);
expect(isAppInstalled, false); expect(isAppInstalled, false);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('returns true when app is installed', () async { testWithoutContext('returns true when app is installed', () async {
...@@ -165,7 +166,7 @@ void main() { ...@@ -165,7 +166,7 @@ void main() {
final bool isAppInstalled = await device.isAppInstalled(iosApp); final bool isAppInstalled = await device.isAppInstalled(iosApp);
expect(isAppInstalled, isTrue); expect(isAppInstalled, isTrue);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('returns false when app is not installed', () async { testWithoutContext('returns false when app is not installed', () async {
...@@ -190,7 +191,7 @@ void main() { ...@@ -190,7 +191,7 @@ void main() {
final bool isAppInstalled = await device.isAppInstalled(iosApp); final bool isAppInstalled = await device.isAppInstalled(iosApp);
expect(isAppInstalled, isFalse); expect(isAppInstalled, isFalse);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
expect(logger.traceText, contains('${iosApp.id} not installed on ${device.id}')); expect(logger.traceText, contains('${iosApp.id} not installed on ${device.id}'));
}); });
...@@ -218,7 +219,7 @@ void main() { ...@@ -218,7 +219,7 @@ void main() {
final bool isAppInstalled = await device.isAppInstalled(iosApp); final bool isAppInstalled = await device.isAppInstalled(iosApp);
expect(isAppInstalled, isFalse); expect(isAppInstalled, isFalse);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
expect(logger.traceText, contains(stderr)); expect(logger.traceText, contains(stderr));
}); });
}); });
......
...@@ -11,6 +11,7 @@ import 'package:mockito/mockito.dart'; ...@@ -11,6 +11,7 @@ import 'package:mockito/mockito.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fake_process_manager.dart';
const Map<String, String> kDyLdLibEntry = <String, String>{ const Map<String, String> kDyLdLibEntry = <String, String>{
'DYLD_LIBRARY_PATH': '/path/to/libs', 'DYLD_LIBRARY_PATH': '/path/to/libs',
...@@ -49,7 +50,7 @@ void main() { ...@@ -49,7 +50,7 @@ void main() {
// First port tried (49154) should fail, then succeed on the next // First port tried (49154) should fail, then succeed on the next
expect(hostPort, 49154 + 1); expect(hostPort, 49154 + 1);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
} }
......
...@@ -163,7 +163,7 @@ void main() { ...@@ -163,7 +163,7 @@ void main() {
expect(fileSystem.directory('build/ios/iphoneos'), exists); expect(fileSystem.directory('build/ios/iphoneos'), exists);
expect(launchResult.started, true); expect(launchResult.started, true);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
...@@ -252,7 +252,7 @@ void main() { ...@@ -252,7 +252,7 @@ void main() {
expect(launchResult?.started, true); expect(launchResult?.started, true);
expect(fileSystem.directory('build/ios/iphoneos'), exists); expect(fileSystem.directory('build/ios/iphoneos'), exists);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
...@@ -316,7 +316,7 @@ void main() { ...@@ -316,7 +316,7 @@ void main() {
expect(logger.statusText, expect(logger.statusText,
contains('Xcode build failed due to concurrent builds, will retry in 2 seconds')); contains('Xcode build failed due to concurrent builds, will retry in 2 seconds'));
expect(launchResult.started, true); expect(launchResult.started, true);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
......
...@@ -23,6 +23,7 @@ import 'package:mockito/mockito.dart'; ...@@ -23,6 +23,7 @@ import 'package:mockito/mockito.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/fakes.dart'; import '../../src/fakes.dart';
// The command used to actually launch the app with args in release/profile. // The command used to actually launch the app with args in release/profile.
...@@ -200,7 +201,7 @@ void main() { ...@@ -200,7 +201,7 @@ void main() {
expect(launchResult.started, true); expect(launchResult.started, true);
expect(launchResult.hasObservatory, false); expect(launchResult.hasObservatory, false);
expect(await device.stopApp(iosApp), false); expect(await device.stopApp(iosApp), false);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('IOSDevice.startApp forwards all supported debugging options', () async { testWithoutContext('IOSDevice.startApp forwards all supported debugging options', () async {
...@@ -290,7 +291,7 @@ void main() { ...@@ -290,7 +291,7 @@ void main() {
expect(launchResult.started, true); expect(launchResult.started, true);
expect(await device.stopApp(iosApp), false); expect(await device.stopApp(iosApp), false);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
} }
......
...@@ -20,6 +20,7 @@ import 'package:mockito/mockito.dart'; ...@@ -20,6 +20,7 @@ import 'package:mockito/mockito.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/fakes.dart'; import '../../src/fakes.dart';
FakePlatform _kNoColorTerminalPlatform() => FakePlatform(stdoutSupportsAnsi: false); FakePlatform _kNoColorTerminalPlatform() => FakePlatform(stdoutSupportsAnsi: false);
...@@ -471,7 +472,7 @@ Exited (sigterm)''', ...@@ -471,7 +472,7 @@ Exited (sigterm)''',
]); ]);
await removeFinderExtendedAttributes(iosProjectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger); await removeFinderExtendedAttributes(iosProjectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger);
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('ignores errors', () async { testWithoutContext('ignores errors', () async {
...@@ -488,7 +489,7 @@ Exited (sigterm)''', ...@@ -488,7 +489,7 @@ Exited (sigterm)''',
await removeFinderExtendedAttributes(iosProjectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger); await removeFinderExtendedAttributes(iosProjectDirectory, ProcessUtils(processManager: processManager, logger: logger), logger);
expect(logger.traceText, contains('Failed to remove xattr com.apple.FinderInfo')); expect(logger.traceText, contains('Failed to remove xattr com.apple.FinderInfo'));
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
}); });
} }
...@@ -39,6 +39,7 @@ import 'package:mockito/mockito.dart'; ...@@ -39,6 +39,7 @@ import 'package:mockito/mockito.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/fakes.dart'; import '../src/fakes.dart';
import '../src/testbed.dart'; import '../src/testbed.dart';
......
...@@ -34,6 +34,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; ...@@ -34,6 +34,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.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/fakes.dart'; import '../src/fakes.dart';
import '../src/testbed.dart'; import '../src/testbed.dart';
......
...@@ -20,6 +20,7 @@ import 'package:mockito/mockito.dart'; ...@@ -20,6 +20,7 @@ import 'package:mockito/mockito.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart'; import '../src/context.dart';
import '../src/fake_process_manager.dart';
final SystemClock _testClock = SystemClock.fixed(DateTime(2015, 1, 1)); final SystemClock _testClock = SystemClock.fixed(DateTime(2015, 1, 1));
final DateTime _stampUpToDate = _testClock.ago(FlutterVersion.checkAgeConsideredUpToDate ~/ 2); final DateTime _stampUpToDate = _testClock.ago(FlutterVersion.checkAgeConsideredUpToDate ~/ 2);
...@@ -578,168 +579,97 @@ void main() { ...@@ -578,168 +579,97 @@ void main() {
}); });
testUsingContext('determine does not call fetch --tags', () { testUsingContext('determine does not call fetch --tags', () {
final MockProcessUtils processUtils = MockProcessUtils(); final FakeProcessManager fakeProcessManager = FakeProcessManager.list(<FakeCommand>[
when(processUtils.runSync( const FakeCommand(
<String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags'], command: <String>['git', 'tag', '--points-at', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'), ),
environment: anyNamed('environment'), const FakeCommand(
)).thenReturn(RunResult(ProcessResult(105, 0, '', ''), <String>['git', 'fetch'])); command: <String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'],
when(processUtils.runSync( stdout: 'v0.1.2-3-1234abcd',
<String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'], ),
workingDirectory: anyNamed('workingDirectory'), ]);
environment: anyNamed('environment'), final ProcessUtils processUtils = ProcessUtils(
)).thenReturn(RunResult(ProcessResult(106, 0, 'v0.1.2-3-1234abcd', ''), <String>['git', 'describe'])); processManager: fakeProcessManager,
when(processUtils.runSync( logger: BufferLogger.test(),
<String>['git', 'tag', '--points-at', 'HEAD'], );
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenReturn(
RunResult(ProcessResult(110, 0, '', ''),
<String>['git', 'tag', '--points-at', 'HEAD'],
));
GitTagVersion.determine(processUtils, workingDirectory: '.'); GitTagVersion.determine(processUtils, workingDirectory: '.');
expect(fakeProcessManager, hasNoRemainingExpectations);
verifyNever(processUtils.runSync(
<String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
));
verifyNever(processUtils.runSync(
<String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
));
verify(processUtils.runSync(
<String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
}); });
testUsingContext('determine does not fetch tags on dev/stable/beta', () { testUsingContext('determine does not fetch tags on dev/stable/beta', () {
final MockProcessUtils processUtils = MockProcessUtils(); final FakeProcessManager fakeProcessManager = FakeProcessManager.list(<FakeCommand>[
when(processUtils.runSync( const FakeCommand(
<String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'], command: <String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'), stdout: 'dev',
environment: anyNamed('environment'), ),
)).thenReturn(RunResult(ProcessResult(105, 0, 'dev', ''), <String>['git', 'fetch'])); const FakeCommand(
when(processUtils.runSync( command: <String>['git', 'tag', '--points-at', 'HEAD'],
<String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags'], ),
workingDirectory: anyNamed('workingDirectory'), const FakeCommand(
environment: anyNamed('environment'), command: <String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'],
)).thenReturn(RunResult(ProcessResult(106, 0, '', ''), <String>['git', 'fetch'])); stdout: 'v0.1.2-3-1234abcd',
when(processUtils.runSync( ),
<String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'], ]);
workingDirectory: anyNamed('workingDirectory'), final ProcessUtils processUtils = ProcessUtils(
environment: anyNamed('environment'), processManager: fakeProcessManager,
)).thenReturn(RunResult(ProcessResult(107, 0, 'v0.1.2-3-1234abcd', ''), <String>['git', 'describe'])); logger: BufferLogger.test(),
when(processUtils.runSync( );
<String>['git', 'tag', '--points-at', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenReturn(
RunResult(ProcessResult(108, 0, '', ''),
<String>['git', 'tag', '--points-at', 'HEAD'],
));
GitTagVersion.determine(processUtils, workingDirectory: '.', fetchTags: true); GitTagVersion.determine(processUtils, workingDirectory: '.', fetchTags: true);
expect(fakeProcessManager, hasNoRemainingExpectations);
verify(processUtils.runSync(
<String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
verifyNever(processUtils.runSync(
<String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
));
verify(processUtils.runSync(
<String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
}); });
testUsingContext('determine calls fetch --tags on master', () { testUsingContext('determine calls fetch --tags on master', () {
final MockProcessUtils processUtils = MockProcessUtils(); final FakeProcessManager fakeProcessManager = FakeProcessManager.list(<FakeCommand>[
when(processUtils.runSync( const FakeCommand(
<String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'], command: <String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'), stdout: 'master',
environment: anyNamed('environment'), ),
)).thenReturn(RunResult(ProcessResult(108, 0, 'master', ''), <String>['git', 'fetch'])); const FakeCommand(
when(processUtils.runSync( command: <String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags', '-f'],
<String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags', '-f'], ),
workingDirectory: anyNamed('workingDirectory'), const FakeCommand(
environment: anyNamed('environment'), command: <String>['git', 'tag', '--points-at', 'HEAD'],
)).thenReturn(RunResult(ProcessResult(109, 0, '', ''), <String>['git', 'fetch'])); ),
when(processUtils.runSync( const FakeCommand(
<String>['git', 'tag', '--points-at', 'HEAD'], command: <String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'), stdout: 'v0.1.2-3-1234abcd',
environment: anyNamed('environment'), ),
)).thenReturn( ]);
RunResult(ProcessResult(110, 0, '', ''), final ProcessUtils processUtils = ProcessUtils(
<String>['git', 'tag', '--points-at', 'HEAD'], processManager: fakeProcessManager,
)); logger: BufferLogger.test(),
when(processUtils.runSync( );
<String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenReturn(RunResult(ProcessResult(111, 0, 'v0.1.2-3-1234abcd', ''), <String>['git', 'describe']));
GitTagVersion.determine(processUtils, workingDirectory: '.', fetchTags: true); GitTagVersion.determine(processUtils, workingDirectory: '.', fetchTags: true);
expect(fakeProcessManager, hasNoRemainingExpectations);
verify(processUtils.runSync(
<String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
verify(processUtils.runSync(
<String>['git', 'fetch', 'https://github.com/flutter/flutter.git', '--tags', '-f'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
verify(processUtils.runSync(
<String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
}); });
testUsingContext('determine uses overridden git url', () { testUsingContext('determine uses overridden git url', () {
final MockProcessUtils processUtils = MockProcessUtils(); final FakeProcessManager fakeProcessManager = FakeProcessManager.list(<FakeCommand>[
when(processUtils.runSync( const FakeCommand(
<String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'], command: <String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'), stdout: 'master',
environment: anyNamed('environment'), ),
)).thenReturn(RunResult(ProcessResult(108, 0, 'master', ''), <String>['git', 'fetch'])); const FakeCommand(
when(processUtils.runSync( command: <String>['git', 'fetch', 'https://githubmirror.com/flutter.git', '--tags', '-f'],
<String>['git', 'fetch', 'https://githubmirror.com/flutter.git', '--tags', '-f'], ),
workingDirectory: anyNamed('workingDirectory'), const FakeCommand(
environment: anyNamed('environment'), command: <String>['git', 'tag', '--points-at', 'HEAD'],
)).thenReturn(RunResult(ProcessResult(109, 0, '', ''), <String>['git', 'fetch'])); ),
when(processUtils.runSync( const FakeCommand(
<String>['git', 'tag', '--points-at', 'HEAD'], command: <String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'), stdout: 'v0.1.2-3-1234abcd',
environment: anyNamed('environment'), ),
)).thenReturn( ]);
RunResult(ProcessResult(110, 0, '', ''), final ProcessUtils processUtils = ProcessUtils(
<String>['git', 'tag', '--points-at', 'HEAD'], processManager: fakeProcessManager,
)); logger: BufferLogger.test(),
when(processUtils.runSync( );
<String>['git', 'describe', '--match', '*.*.*', '--long', '--tags', 'HEAD'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenReturn(RunResult(ProcessResult(111, 0, 'v0.1.2-3-1234abcd', ''), <String>['git', 'describe']));
GitTagVersion.determine(processUtils, workingDirectory: '.', fetchTags: true); GitTagVersion.determine(processUtils, workingDirectory: '.', fetchTags: true);
expect(fakeProcessManager, hasNoRemainingExpectations);
verify(processUtils.runSync(
<String>['git', 'fetch', 'https://githubmirror.com/flutter.git', '--tags', '-f'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => FakePlatform(environment: <String, String>{ Platform: () => FakePlatform(environment: <String, String>{
'FLUTTER_GIT_URL': 'https://githubmirror.com/flutter.git', 'FLUTTER_GIT_URL': 'https://githubmirror.com/flutter.git',
...@@ -873,5 +803,4 @@ void fakeData( ...@@ -873,5 +803,4 @@ void fakeData(
} }
class MockProcessManager extends Mock implements ProcessManager {} class MockProcessManager extends Mock implements ProcessManager {}
class MockProcessUtils extends Mock implements ProcessUtils {}
class MockCache extends Mock implements Cache {} class MockCache extends Mock implements Cache {}
...@@ -14,6 +14,7 @@ import 'package:flutter_tools/src/web/web_device.dart'; ...@@ -14,6 +14,7 @@ import 'package:flutter_tools/src/web/web_device.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/fakes.dart'; import '../../src/fakes.dart';
void main() { void main() {
...@@ -206,7 +207,7 @@ void main() { ...@@ -206,7 +207,7 @@ void main() {
// Verify caching works correctly. // Verify caching works correctly.
expect(await chromeDevice.sdkNameAndVersion, 'ABC'); expect(await chromeDevice.sdkNameAndVersion, 'ABC');
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('Chrome and Edge version check invokes registry query on windows.', () async { testWithoutContext('Chrome and Edge version check invokes registry query on windows.', () async {
...@@ -252,7 +253,7 @@ void main() { ...@@ -252,7 +253,7 @@ void main() {
// Verify caching works correctly. // Verify caching works correctly.
expect(await chromeDevice.sdkNameAndVersion, 'Google Chrome 74.0.0'); expect(await chromeDevice.sdkNameAndVersion, 'Google Chrome 74.0.0');
expect(processManager.hasRemainingExpectations, false); expect(processManager, hasNoRemainingExpectations);
}); });
testWithoutContext('Edge is not supported on versions less than 73', () async { testWithoutContext('Edge is not supported on versions less than 73', () async {
......
...@@ -215,6 +215,9 @@ abstract class FakeProcessManager implements ProcessManager { ...@@ -215,6 +215,9 @@ abstract class FakeProcessManager implements ProcessManager {
/// This is always `true` for [FakeProcessManager.any]. /// This is always `true` for [FakeProcessManager.any].
bool get hasRemainingExpectations; bool get hasRemainingExpectations;
/// The expected [FakeCommand]s that have not yet run.
List<FakeCommand> get _remainingExpectations;
@protected @protected
FakeCommand findCommand( FakeCommand findCommand(
List<String> command, List<String> command,
...@@ -353,6 +356,9 @@ class _FakeAnyProcessManager extends FakeProcessManager { ...@@ -353,6 +356,9 @@ class _FakeAnyProcessManager extends FakeProcessManager {
@override @override
bool get hasRemainingExpectations => true; bool get hasRemainingExpectations => true;
@override
List<FakeCommand> get _remainingExpectations => <FakeCommand>[];
} }
class _SequenceProcessManager extends FakeProcessManager { class _SequenceProcessManager extends FakeProcessManager {
...@@ -382,4 +388,35 @@ class _SequenceProcessManager extends FakeProcessManager { ...@@ -382,4 +388,35 @@ class _SequenceProcessManager extends FakeProcessManager {
@override @override
bool get hasRemainingExpectations => _commands.isNotEmpty; bool get hasRemainingExpectations => _commands.isNotEmpty;
@override
List<FakeCommand> get _remainingExpectations => _commands;
}
/// Matcher that successfully matches against a [FakeProcessManager] with
/// no remaining expectations ([item.hasRemainingExpectations] returns false).
const Matcher hasNoRemainingExpectations = _HasNoRemainingExpectations();
class _HasNoRemainingExpectations extends Matcher {
const _HasNoRemainingExpectations();
@override
bool matches(dynamic item, Map<dynamic, dynamic> matchState) =>
item is FakeProcessManager && !item.hasRemainingExpectations;
@override
Description describe(Description description) =>
description.add('a fake process manager with no remaining expectations');
@override
Description describeMismatch(
dynamic item,
Description description,
Map<dynamic, dynamic> matchState,
bool verbose,
) {
final FakeProcessManager fakeProcessManager = item as FakeProcessManager;
return description.add(
'has remaining expectations:\n${fakeProcessManager._remainingExpectations.map((FakeCommand command) => command.command).join('\n')}');
}
} }
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