implicit-casts:false on flutter_tools (#45153)
* implicit-casts:false on flutter_tools * use castStringKeyedMap * address review comments * address review comments * fix issues after rebase
This commit is contained in:
parent
033b897be5
commit
980f14e0c5
@ -5,7 +5,7 @@ include: ../../analysis_options.yaml
|
|||||||
|
|
||||||
analyzer:
|
analyzer:
|
||||||
strong-mode:
|
strong-mode:
|
||||||
implicit-casts: true
|
implicit-casts: false
|
||||||
implicit-dynamic: false
|
implicit-dynamic: false
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
|
@ -208,12 +208,12 @@ class AndroidAot extends AotElfBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AndroidAot instances used by the bundle rules below.
|
// AndroidAot instances used by the bundle rules below.
|
||||||
const Target androidArmProfile = AndroidAot(TargetPlatform.android_arm, BuildMode.profile);
|
const AndroidAot androidArmProfile = AndroidAot(TargetPlatform.android_arm, BuildMode.profile);
|
||||||
const Target androidArm64Profile = AndroidAot(TargetPlatform.android_arm64, BuildMode.profile);
|
const AndroidAot androidArm64Profile = AndroidAot(TargetPlatform.android_arm64, BuildMode.profile);
|
||||||
const Target androidx64Profile = AndroidAot(TargetPlatform.android_x64, BuildMode.profile);
|
const AndroidAot androidx64Profile = AndroidAot(TargetPlatform.android_x64, BuildMode.profile);
|
||||||
const Target androidArmRelease = AndroidAot(TargetPlatform.android_arm, BuildMode.release);
|
const AndroidAot androidArmRelease = AndroidAot(TargetPlatform.android_arm, BuildMode.release);
|
||||||
const Target androidArm64Release = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
|
const AndroidAot androidArm64Release = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
|
||||||
const Target androidx64Release = AndroidAot(TargetPlatform.android_x64, BuildMode.release);
|
const AndroidAot androidx64Release = AndroidAot(TargetPlatform.android_x64, BuildMode.release);
|
||||||
|
|
||||||
/// A rule paired with [AndroidAot] that copies the produced so files into the output directory.
|
/// A rule paired with [AndroidAot] that copies the produced so files into the output directory.
|
||||||
class AndroidAotBundle extends Target {
|
class AndroidAotBundle extends Target {
|
||||||
|
@ -169,7 +169,7 @@ class AssembleCommand extends FlutterCommand {
|
|||||||
final Target target = targets.length == 1 ? targets.single : _CompositeTarget(targets);
|
final Target target = targets.length == 1 ? targets.single : _CompositeTarget(targets);
|
||||||
final BuildResult result = await buildSystem.build(target, environment, buildSystemConfig: BuildSystemConfig(
|
final BuildResult result = await buildSystem.build(target, environment, buildSystemConfig: BuildSystemConfig(
|
||||||
resourcePoolSize: argResults.wasParsed('resource-pool-size')
|
resourcePoolSize: argResults.wasParsed('resource-pool-size')
|
||||||
? int.tryParse(argResults['resource-pool-size'])
|
? int.tryParse(stringArg('resource-pool-size'))
|
||||||
: null,
|
: null,
|
||||||
));
|
));
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
@ -223,7 +223,7 @@ class AttachCommand extends FlutterCommand {
|
|||||||
FuchsiaIsolateDiscoveryProtocol isolateDiscoveryProtocol;
|
FuchsiaIsolateDiscoveryProtocol isolateDiscoveryProtocol;
|
||||||
try {
|
try {
|
||||||
isolateDiscoveryProtocol = device.getIsolateDiscoveryProtocol(module);
|
isolateDiscoveryProtocol = device.getIsolateDiscoveryProtocol(module);
|
||||||
observatoryUri = Stream<Uri>.fromFuture(isolateDiscoveryProtocol.uri).asBroadcastStream();
|
observatoryUri = Stream<Uri>.value(await isolateDiscoveryProtocol.uri).asBroadcastStream();
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
isolateDiscoveryProtocol?.dispose();
|
isolateDiscoveryProtocol?.dispose();
|
||||||
final List<ForwardedPort> ports = device.portForwarder.forwardedPorts.toList();
|
final List<ForwardedPort> ports = device.portForwarder.forwardedPorts.toList();
|
||||||
|
@ -74,7 +74,7 @@ class BuildFuchsiaCommand extends BuildSubCommand {
|
|||||||
await buildFuchsia(
|
await buildFuchsia(
|
||||||
fuchsiaProject: flutterProject.fuchsia,
|
fuchsiaProject: flutterProject.fuchsia,
|
||||||
target: targetFile,
|
target: targetFile,
|
||||||
targetPlatform: getTargetPlatformForName(argResults['target-platform']),
|
targetPlatform: getTargetPlatformForName(stringArg('target-platform')),
|
||||||
buildInfo: buildInfo,
|
buildInfo: buildInfo,
|
||||||
runnerPackageSource: stringArg('runner-source'),
|
runnerPackageSource: stringArg('runner-source'),
|
||||||
);
|
);
|
||||||
|
@ -204,10 +204,11 @@ class Plugin {
|
|||||||
if (!(value is YamlMap)) {
|
if (!(value is YamlMap)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (value.containsKey('default_package')) {
|
final YamlMap yamlValue = value as YamlMap;
|
||||||
|
if (yamlValue.containsKey('default_package')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !validate(value);
|
return !validate(yamlValue);
|
||||||
}
|
}
|
||||||
final List<String> errors = <String>[];
|
final List<String> errors = <String>[];
|
||||||
if (isInvalid(AndroidPlugin.kConfigKey, AndroidPlugin.validate)) {
|
if (isInvalid(AndroidPlugin.kConfigKey, AndroidPlugin.validate)) {
|
||||||
@ -246,7 +247,7 @@ class Plugin {
|
|||||||
if (!platformsYaml.containsKey(platformKey)) {
|
if (!platformsYaml.containsKey(platformKey)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (platformsYaml[platformKey].containsKey('default_package')) {
|
if ((platformsYaml[platformKey] as YamlMap).containsKey('default_package')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -276,13 +277,13 @@ Plugin _pluginFromPubspec(String name, Uri packageRoot) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final String packageRootPath = fs.path.fromUri(packageRoot);
|
final String packageRootPath = fs.path.fromUri(packageRoot);
|
||||||
final YamlMap dependencies = pubspec['dependencies'];
|
final YamlMap dependencies = pubspec['dependencies'] as YamlMap;
|
||||||
printTrace('Found plugin $name at $packageRootPath');
|
printTrace('Found plugin $name at $packageRootPath');
|
||||||
return Plugin.fromYaml(
|
return Plugin.fromYaml(
|
||||||
name,
|
name,
|
||||||
packageRootPath,
|
packageRootPath,
|
||||||
flutterConfig['plugin'] as YamlMap,
|
flutterConfig['plugin'] as YamlMap,
|
||||||
dependencies == null ? <String>[] : <String>[...dependencies.keys],
|
dependencies == null ? <String>[] : <String>[...dependencies.keys.cast<String>()],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,14 +5,13 @@
|
|||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:flutter_tools/src/base/common.dart';
|
import 'package:flutter_tools/src/base/common.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/assemble.dart';
|
import 'package:flutter_tools/src/commands/assemble.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
|
import '../../src/context.dart';
|
||||||
import '../../src/testbed.dart';
|
import '../../src/testbed.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@ -29,9 +28,8 @@ void main() {
|
|||||||
});
|
});
|
||||||
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand());
|
final CommandRunner<void> commandRunner = createTestCommandRunner(AssembleCommand());
|
||||||
await commandRunner.run(<String>['assemble', '-o Output', 'debug_macos_bundle_flutter_assets']);
|
await commandRunner.run(<String>['assemble', '-o Output', 'debug_macos_bundle_flutter_assets']);
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
|
|
||||||
expect(bufferLogger.traceText, contains('build succeeded.'));
|
expect(testLogger.traceText, contains('build succeeded.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
testbed.test('Throws ToolExit if not provided with output', () async {
|
testbed.test('Throws ToolExit if not provided with output', () async {
|
||||||
@ -57,7 +55,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testbed.test('Does not log stack traces during build failure', () async {
|
testbed.test('Does not log stack traces during build failure', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final StackTrace testStackTrace = StackTrace.current;
|
final StackTrace testStackTrace = StackTrace.current;
|
||||||
when(buildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
when(buildSystem.build(any, any, buildSystemConfig: anyNamed('buildSystemConfig')))
|
||||||
.thenAnswer((Invocation invocation) async {
|
.thenAnswer((Invocation invocation) async {
|
||||||
@ -69,8 +66,8 @@ void main() {
|
|||||||
|
|
||||||
await expectLater(commandRunner.run(<String>['assemble', '-o Output', 'debug_macos_bundle_flutter_assets']),
|
await expectLater(commandRunner.run(<String>['assemble', '-o Output', 'debug_macos_bundle_flutter_assets']),
|
||||||
throwsA(isInstanceOf<ToolExit>()));
|
throwsA(isInstanceOf<ToolExit>()));
|
||||||
expect(bufferLogger.errorText, contains('bar'));
|
expect(testLogger.errorText, contains('bar'));
|
||||||
expect(bufferLogger.errorText, isNot(contains(testStackTrace.toString())));
|
expect(testLogger.errorText, isNot(contains(testStackTrace.toString())));
|
||||||
});
|
});
|
||||||
|
|
||||||
testbed.test('Only writes input and output files when the values change', () async {
|
testbed.test('Only writes input and output files when the values change', () async {
|
||||||
|
@ -306,7 +306,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
)..called(1);
|
)..called(1);
|
||||||
|
|
||||||
final List<FlutterDevice> flutterDevices = verificationResult.captured.first;
|
final List<FlutterDevice> flutterDevices = verificationResult.captured.first as List<FlutterDevice>;
|
||||||
expect(flutterDevices, hasLength(1));
|
expect(flutterDevices, hasLength(1));
|
||||||
|
|
||||||
// Validate that the attach call built a flutter device with the right
|
// Validate that the attach call built a flutter device with the right
|
||||||
|
@ -47,7 +47,7 @@ void main() {
|
|||||||
'--no-pub',
|
'--no-pub',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
final Environment environment = verify(buildSystem.build(any, captureAny)).captured.single;
|
final Environment environment = verify(buildSystem.build(any, captureAny)).captured.single as Environment;
|
||||||
expect(environment.defines, <String, String>{
|
expect(environment.defines, <String, String>{
|
||||||
kTargetFile: fs.path.absolute(fs.path.join('lib', 'main.dart')),
|
kTargetFile: fs.path.absolute(fs.path.join('lib', 'main.dart')),
|
||||||
kBuildMode: 'release',
|
kBuildMode: 'release',
|
||||||
|
@ -7,14 +7,12 @@ import 'package:file/memory.dart';
|
|||||||
import 'package:flutter_tools/src/base/common.dart';
|
import 'package:flutter_tools/src/base/common.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build.dart';
|
import 'package:flutter_tools/src/commands/build.dart';
|
||||||
import 'package:flutter_tools/src/commands/build_linux.dart';
|
import 'package:flutter_tools/src/commands/build_linux.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/features.dart';
|
import 'package:flutter_tools/src/features.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
|
||||||
import 'package:flutter_tools/src/linux/makefile.dart';
|
import 'package:flutter_tools/src/linux/makefile.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
@ -142,7 +140,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Linux build does not spew stdout to status logger', () async {
|
testUsingContext('Linux build does not spew stdout to status logger', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final BuildCommand command = BuildCommand();
|
final BuildCommand command = BuildCommand();
|
||||||
applyMocksToCommand(command);
|
applyMocksToCommand(command);
|
||||||
setUpMockProjectFilesForBuild();
|
setUpMockProjectFilesForBuild();
|
||||||
@ -151,8 +148,8 @@ void main() {
|
|||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
const <String>['build', 'linux', '--debug']
|
const <String>['build', 'linux', '--debug']
|
||||||
);
|
);
|
||||||
expect(bufferLogger.statusText, isNot(contains('STDOUT STUFF')));
|
expect(testLogger.statusText, isNot(contains('STDOUT STUFF')));
|
||||||
expect(bufferLogger.traceText, contains('STDOUT STUFF'));
|
expect(testLogger.traceText, contains('STDOUT STUFF'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem(),
|
FileSystem: () => MemoryFileSystem(),
|
||||||
ProcessManager: () => mockProcessManager,
|
ProcessManager: () => mockProcessManager,
|
||||||
@ -230,8 +227,7 @@ BINARY_NAME=fizz_bar
|
|||||||
const <String>['build', 'linux']
|
const <String>['build', 'linux']
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger bufferLogger = logger;
|
expect(testLogger.statusText, contains('🚧'));
|
||||||
expect(bufferLogger.statusText, contains('🚧'));
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem(),
|
FileSystem: () => MemoryFileSystem(),
|
||||||
ProcessManager: () => mockProcessManager,
|
ProcessManager: () => mockProcessManager,
|
||||||
|
@ -7,7 +7,6 @@ import 'package:file/memory.dart';
|
|||||||
import 'package:flutter_tools/src/base/common.dart';
|
import 'package:flutter_tools/src/base/common.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
@ -15,7 +14,6 @@ import 'package:flutter_tools/src/commands/build.dart';
|
|||||||
import 'package:flutter_tools/src/commands/build_macos.dart';
|
import 'package:flutter_tools/src/commands/build_macos.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/features.dart';
|
import 'package:flutter_tools/src/features.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
|
||||||
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
@ -128,7 +126,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('macOS build does not spew stdout to status logger', () async {
|
testUsingContext('macOS build does not spew stdout to status logger', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final BuildCommand command = BuildCommand();
|
final BuildCommand command = BuildCommand();
|
||||||
applyMocksToCommand(command);
|
applyMocksToCommand(command);
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
@ -137,8 +134,8 @@ void main() {
|
|||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
const <String>['build', 'macos', '--debug']
|
const <String>['build', 'macos', '--debug']
|
||||||
);
|
);
|
||||||
expect(bufferLogger.statusText, isNot(contains('STDOUT STUFF')));
|
expect(testLogger.statusText, isNot(contains('STDOUT STUFF')));
|
||||||
expect(bufferLogger.traceText, contains('STDOUT STUFF'));
|
expect(testLogger.traceText, contains('STDOUT STUFF'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem(),
|
FileSystem: () => MemoryFileSystem(),
|
||||||
ProcessManager: () => mockProcessManager,
|
ProcessManager: () => mockProcessManager,
|
||||||
|
@ -71,7 +71,7 @@ void main() {
|
|||||||
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
||||||
stayResident: true,
|
stayResident: true,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
);
|
) as ResidentWebRunner;
|
||||||
expect(await runner.run(), 1);
|
expect(await runner.run(), 1);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -6,14 +6,12 @@ import 'package:file/memory.dart';
|
|||||||
import 'package:flutter_tools/src/base/common.dart';
|
import 'package:flutter_tools/src/base/common.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build.dart';
|
import 'package:flutter_tools/src/commands/build.dart';
|
||||||
import 'package:flutter_tools/src/commands/build_windows.dart';
|
import 'package:flutter_tools/src/commands/build_windows.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/features.dart';
|
import 'package:flutter_tools/src/features.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
|
||||||
import 'package:flutter_tools/src/windows/visual_studio.dart';
|
import 'package:flutter_tools/src/windows/visual_studio.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
@ -109,7 +107,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Windows build does not spew stdout to status logger', () async {
|
testUsingContext('Windows build does not spew stdout to status logger', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final BuildCommand command = BuildCommand();
|
final BuildCommand command = BuildCommand();
|
||||||
applyMocksToCommand(command);
|
applyMocksToCommand(command);
|
||||||
fs.file(solutionPath).createSync(recursive: true);
|
fs.file(solutionPath).createSync(recursive: true);
|
||||||
@ -130,8 +127,8 @@ void main() {
|
|||||||
await createTestCommandRunner(command).run(
|
await createTestCommandRunner(command).run(
|
||||||
const <String>['build', 'windows']
|
const <String>['build', 'windows']
|
||||||
);
|
);
|
||||||
expect(bufferLogger.statusText, isNot(contains('STDOUT STUFF')));
|
expect(testLogger.statusText, isNot(contains('STDOUT STUFF')));
|
||||||
expect(bufferLogger.traceText, contains('STDOUT STUFF'));
|
expect(testLogger.traceText, contains('STDOUT STUFF'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows),
|
FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows),
|
||||||
ProcessManager: () => mockProcessManager,
|
ProcessManager: () => mockProcessManager,
|
||||||
@ -199,8 +196,7 @@ void main() {
|
|||||||
const <String>['build', 'windows']
|
const <String>['build', 'windows']
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger bufferLogger = logger;
|
expect(testLogger.statusText, contains('🚧'));
|
||||||
expect(bufferLogger.statusText, contains('🚧'));
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows),
|
FileSystem: () => MemoryFileSystem(style: FileSystemStyle.windows),
|
||||||
ProcessManager: () => mockProcessManager,
|
ProcessManager: () => mockProcessManager,
|
||||||
|
@ -69,11 +69,10 @@ void main() {
|
|||||||
final MockFile mockFile = MockFile();
|
final MockFile mockFile = MockFile();
|
||||||
when(mockFile.existsSync()).thenReturn(true);
|
when(mockFile.existsSync()).thenReturn(true);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
when(mockFile.deleteSync(recursive: true)).thenThrow(const FileSystemException('Deletion failed'));
|
when(mockFile.deleteSync(recursive: true)).thenThrow(const FileSystemException('Deletion failed'));
|
||||||
final CleanCommand command = CleanCommand();
|
final CleanCommand command = CleanCommand();
|
||||||
command.deleteFile(mockFile);
|
command.deleteFile(mockFile);
|
||||||
expect(logger.errorText, contains('A program may still be using a file'));
|
expect(testLogger.errorText, contains('A program may still be using a file'));
|
||||||
verify(mockFile.deleteSync(recursive: true)).called(1);
|
verify(mockFile.deleteSync(recursive: true)).called(1);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Platform: () => windowsPlatform,
|
Platform: () => windowsPlatform,
|
||||||
@ -88,10 +87,9 @@ void main() {
|
|||||||
when(mockFile.existsSync()).thenThrow(const FileSystemException('OS error: Access Denied'));
|
when(mockFile.existsSync()).thenThrow(const FileSystemException('OS error: Access Denied'));
|
||||||
when(mockFile.path).thenReturn('foo.dart');
|
when(mockFile.path).thenReturn('foo.dart');
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
final CleanCommand command = CleanCommand();
|
final CleanCommand command = CleanCommand();
|
||||||
command.deleteFile(mockFile);
|
command.deleteFile(mockFile);
|
||||||
expect(logger.errorText, contains('Cannot clean foo.dart'));
|
expect(testLogger.errorText, contains('Cannot clean foo.dart'));
|
||||||
verifyNever(mockFile.deleteSync(recursive: true));
|
verifyNever(mockFile.deleteSync(recursive: true));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Platform: () => windowsPlatform,
|
Platform: () => windowsPlatform,
|
||||||
|
@ -10,7 +10,6 @@ import 'package:flutter_tools/src/android/android_studio.dart';
|
|||||||
import 'package:flutter_tools/src/base/common.dart';
|
import 'package:flutter_tools/src/base/common.dart';
|
||||||
import 'package:flutter_tools/src/base/config.dart';
|
import 'package:flutter_tools/src/base/config.dart';
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/config.dart';
|
import 'package:flutter_tools/src/commands/config.dart';
|
||||||
@ -62,12 +61,11 @@ void main() {
|
|||||||
|
|
||||||
group('config', () {
|
group('config', () {
|
||||||
testUsingContext('machine flag', () async {
|
testUsingContext('machine flag', () async {
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
final ConfigCommand command = ConfigCommand();
|
final ConfigCommand command = ConfigCommand();
|
||||||
await command.handleMachine();
|
await command.handleMachine();
|
||||||
|
|
||||||
expect(logger.statusText, isNotEmpty);
|
expect(testLogger.statusText, isNotEmpty);
|
||||||
final dynamic jsonObject = json.decode(logger.statusText);
|
final dynamic jsonObject = json.decode(testLogger.statusText);
|
||||||
expect(jsonObject, isMap);
|
expect(jsonObject, isMap);
|
||||||
|
|
||||||
expect(jsonObject.containsKey('android-studio-dir'), true);
|
expect(jsonObject.containsKey('android-studio-dir'), true);
|
||||||
@ -156,7 +154,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('warns the user to reload IDE', () async {
|
testUsingContext('warns the user to reload IDE', () async {
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
final ConfigCommand configCommand = ConfigCommand();
|
final ConfigCommand configCommand = ConfigCommand();
|
||||||
final CommandRunner<void> commandRunner = createTestCommandRunner(configCommand);
|
final CommandRunner<void> commandRunner = createTestCommandRunner(configCommand);
|
||||||
|
|
||||||
@ -165,13 +162,12 @@ void main() {
|
|||||||
'--enable-web'
|
'--enable-web'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(logger.statusText, contains('You may need to restart any open editors'));
|
expect(testLogger.statusText, contains('You may need to restart any open editors'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Usage: () => mockUsage,
|
Usage: () => mockUsage,
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('displays which config settings are available on stable', () async {
|
testUsingContext('displays which config settings are available on stable', () async {
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
when(mockFlutterVersion.channel).thenReturn('stable');
|
when(mockFlutterVersion.channel).thenReturn('stable');
|
||||||
final ConfigCommand configCommand = ConfigCommand();
|
final ConfigCommand configCommand = ConfigCommand();
|
||||||
final CommandRunner<void> commandRunner = createTestCommandRunner(configCommand);
|
final CommandRunner<void> commandRunner = createTestCommandRunner(configCommand);
|
||||||
@ -188,10 +184,10 @@ void main() {
|
|||||||
'config',
|
'config',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(logger.statusText, contains('enable-web: true (Unavailable)'));
|
expect(testLogger.statusText, contains('enable-web: true (Unavailable)'));
|
||||||
expect(logger.statusText, contains('enable-linux-desktop: true (Unavailable)'));
|
expect(testLogger.statusText, contains('enable-linux-desktop: true (Unavailable)'));
|
||||||
expect(logger.statusText, contains('enable-windows-desktop: true (Unavailable)'));
|
expect(testLogger.statusText, contains('enable-windows-desktop: true (Unavailable)'));
|
||||||
expect(logger.statusText, contains('enable-macos-desktop: true (Unavailable)'));
|
expect(testLogger.statusText, contains('enable-macos-desktop: true (Unavailable)'));
|
||||||
verifyNoAnalytics();
|
verifyNoAnalytics();
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
AndroidStudio: () => mockAndroidStudio,
|
AndroidStudio: () => mockAndroidStudio,
|
||||||
|
@ -6,6 +6,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:flutter_tools/src/android/android_workflow.dart';
|
import 'package:flutter_tools/src/android/android_workflow.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
|
import 'package:flutter_tools/src/base/utils.dart';
|
||||||
import 'package:flutter_tools/src/commands/daemon.dart';
|
import 'package:flutter_tools/src/commands/daemon.dart';
|
||||||
import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
|
import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
import 'package:flutter_tools/src/globals.dart';
|
||||||
@ -65,7 +66,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'].cast<String, String>();
|
final Map<String, String> logMessage = castStringKeyedMap(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');
|
||||||
await responses.close();
|
await responses.close();
|
||||||
@ -232,7 +233,7 @@ void main() {
|
|||||||
expect(response['event'], 'device.added');
|
expect(response['event'], 'device.added');
|
||||||
expect(response['params'], isMap);
|
expect(response['params'], isMap);
|
||||||
|
|
||||||
final Map<String, dynamic> params = response['params'];
|
final Map<String, dynamic> params = castStringKeyedMap(response['params']);
|
||||||
expect(params['platform'], isNotEmpty); // the mock device has a platform of 'android-arm'
|
expect(params['platform'], isNotEmpty); // the mock device has a platform of 'android-arm'
|
||||||
|
|
||||||
await responses.close();
|
await responses.close();
|
||||||
|
@ -485,7 +485,7 @@ void main() {
|
|||||||
platformArgs: anyNamed('platformArgs'),
|
platformArgs: anyNamed('platformArgs'),
|
||||||
prebuiltApplication: anyNamed('prebuiltApplication'),
|
prebuiltApplication: anyNamed('prebuiltApplication'),
|
||||||
)).thenAnswer((Invocation invocation) async {
|
)).thenAnswer((Invocation invocation) async {
|
||||||
debuggingOptions = invocation.namedArguments[#debuggingOptions];
|
debuggingOptions = invocation.namedArguments[#debuggingOptions] as DebuggingOptions;
|
||||||
return mockLaunchResult;
|
return mockLaunchResult;
|
||||||
});
|
});
|
||||||
when(mockDevice.isAppInstalled(any))
|
when(mockDevice.isAppInstalled(any))
|
||||||
|
@ -3,15 +3,14 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/codegen.dart';
|
import 'package:flutter_tools/src/codegen.dart';
|
||||||
import 'package:flutter_tools/src/commands/generate.dart';
|
import 'package:flutter_tools/src/commands/generate.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
|
import '../../src/context.dart';
|
||||||
import '../../src/mocks.dart';
|
import '../../src/mocks.dart';
|
||||||
import '../../src/testbed.dart';
|
import '../../src/testbed.dart';
|
||||||
|
|
||||||
@ -47,7 +46,6 @@ void main() {
|
|||||||
|
|
||||||
test('Outputs error information from flutter generate', () => testbed.run(() async {
|
test('Outputs error information from flutter generate', () => testbed.run(() async {
|
||||||
final GenerateCommand command = GenerateCommand();
|
final GenerateCommand command = GenerateCommand();
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
applyMocksToCommand(command);
|
applyMocksToCommand(command);
|
||||||
fs.file(fs.path.join('lib', 'main.dart'))
|
fs.file(fs.path.join('lib', 'main.dart'))
|
||||||
..createSync(recursive: true);
|
..createSync(recursive: true);
|
||||||
@ -71,10 +69,10 @@ void main() {
|
|||||||
await createTestCommandRunner(command)
|
await createTestCommandRunner(command)
|
||||||
.run(const <String>['generate']);
|
.run(const <String>['generate']);
|
||||||
|
|
||||||
expect(bufferLogger.errorText, contains('a'));
|
expect(testLogger.errorText, contains('a'));
|
||||||
expect(bufferLogger.errorText, contains('b'));
|
expect(testLogger.errorText, contains('b'));
|
||||||
expect(bufferLogger.errorText, contains('foo builder'));
|
expect(testLogger.errorText, contains('foo builder'));
|
||||||
expect(bufferLogger.errorText, isNot(contains('Error reading error')));
|
expect(testLogger.errorText, isNot(contains('Error reading error')));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ void main() {
|
|||||||
|
|
||||||
when(cache.isUpToDate()).thenReturn(false);
|
when(cache.isUpToDate()).thenReturn(false);
|
||||||
when(cache.updateAll(any)).thenAnswer((Invocation invocation) {
|
when(cache.updateAll(any)).thenAnswer((Invocation invocation) {
|
||||||
artifacts = invocation.positionalArguments.first;
|
artifacts = invocation.positionalArguments.first as Set<DevelopmentArtifact>;
|
||||||
return Future<void>.value(null);
|
return Future<void>.value(null);
|
||||||
});
|
});
|
||||||
flutterVersion = MockFlutterVersion();
|
flutterVersion = MockFlutterVersion();
|
||||||
|
@ -117,7 +117,7 @@ class MockProcessManager extends Mock implements ProcessManager {
|
|||||||
return ProcessResult(0, 0, 'v10.0.0\r\nv20.0.0', '');
|
return ProcessResult(0, 0, 'v10.0.0\r\nv20.0.0', '');
|
||||||
}
|
}
|
||||||
if (command[0] == 'git' && command[1] == 'checkout') {
|
if (command[0] == 'git' && command[1] == 'checkout') {
|
||||||
version = command[2];
|
version = command[2] as String;
|
||||||
}
|
}
|
||||||
return ProcessResult(0, 0, '', '');
|
return ProcessResult(0, 0, '', '');
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ void main() {
|
|||||||
fs.file('.packages').createSync();
|
fs.file('.packages').createSync();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
final CommandRunner<void> runner = createTestCommandRunner(BuildBundleCommand());
|
||||||
when(buildSystem.build(any, any)).thenAnswer((Invocation invocation) async {
|
when(buildSystem.build(any, any)).thenAnswer((Invocation invocation) async {
|
||||||
final Environment environment = invocation.positionalArguments[1];
|
final Environment environment = invocation.positionalArguments[1] as Environment;
|
||||||
expect(environment.defines, <String, String>{
|
expect(environment.defines, <String, String>{
|
||||||
kTargetFile: fs.path.join('lib', 'main.dart'),
|
kTargetFile: fs.path.join('lib', 'main.dart'),
|
||||||
kBuildMode: 'debug',
|
kBuildMode: 'debug',
|
||||||
|
@ -1379,7 +1379,7 @@ class LoggingProcessManager extends LocalProcessManager {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Process> start(
|
Future<Process> start(
|
||||||
List<dynamic> command, {
|
List<String> command, {
|
||||||
String workingDirectory,
|
String workingDirectory,
|
||||||
Map<String, String> environment,
|
Map<String, String> environment,
|
||||||
bool includeParentEnvironment = true,
|
bool includeParentEnvironment = true,
|
||||||
|
@ -81,7 +81,7 @@ void main() {
|
|||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
final ProcessResult result = await _runFlutterTest('filtering', automatedTestsDirectory, flutterTestDirectory,
|
final ProcessResult result = await _runFlutterTest('filtering', automatedTestsDirectory, flutterTestDirectory,
|
||||||
extraArguments: const <String>['--name', 'inc.*de']);
|
extraArguments: const <String>['--name', 'inc.*de']);
|
||||||
if (!result.stdout.contains('+1: All tests passed')) {
|
if (!(result.stdout as String).contains('+1: All tests passed')) {
|
||||||
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
|
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
|
||||||
}
|
}
|
||||||
expect(result.exitCode, 0);
|
expect(result.exitCode, 0);
|
||||||
@ -91,7 +91,7 @@ void main() {
|
|||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
final ProcessResult result = await _runFlutterTest('filtering', automatedTestsDirectory, flutterTestDirectory,
|
final ProcessResult result = await _runFlutterTest('filtering', automatedTestsDirectory, flutterTestDirectory,
|
||||||
extraArguments: const <String>['--plain-name', 'include']);
|
extraArguments: const <String>['--plain-name', 'include']);
|
||||||
if (!result.stdout.contains('+1: All tests passed')) {
|
if (!(result.stdout as String).contains('+1: All tests passed')) {
|
||||||
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
|
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
|
||||||
}
|
}
|
||||||
expect(result.exitCode, 0);
|
expect(result.exitCode, 0);
|
||||||
@ -101,14 +101,15 @@ void main() {
|
|||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
final ProcessResult result = await _runFlutterTest('trivial', automatedTestsDirectory, flutterTestDirectory,
|
final ProcessResult result = await _runFlutterTest('trivial', automatedTestsDirectory, flutterTestDirectory,
|
||||||
extraArguments: const <String>['--verbose']);
|
extraArguments: const <String>['--verbose']);
|
||||||
if ((!result.stdout.contains('+1: All tests passed')) ||
|
final String stdout = result.stdout as String;
|
||||||
(!result.stdout.contains('test 0: starting shell process')) ||
|
if ((!stdout.contains('+1: All tests passed')) ||
|
||||||
(!result.stdout.contains('test 0: deleting temporary directory')) ||
|
(!stdout.contains('test 0: starting shell process')) ||
|
||||||
(!result.stdout.contains('test 0: finished')) ||
|
(!stdout.contains('test 0: deleting temporary directory')) ||
|
||||||
(!result.stdout.contains('test package returned with exit code 0'))) {
|
(!stdout.contains('test 0: finished')) ||
|
||||||
|
(!stdout.contains('test package returned with exit code 0'))) {
|
||||||
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
|
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
|
||||||
}
|
}
|
||||||
if (result.stderr.isNotEmpty) {
|
if ((result.stderr as String).isNotEmpty) {
|
||||||
fail('unexpected error output from test:\n\n${result.stderr}\n-- end stderr --\n\n');
|
fail('unexpected error output from test:\n\n${result.stderr}\n-- end stderr --\n\n');
|
||||||
}
|
}
|
||||||
expect(result.exitCode, 0);
|
expect(result.exitCode, 0);
|
||||||
@ -118,14 +119,15 @@ void main() {
|
|||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
final ProcessResult result = await _runFlutterTest(null, automatedTestsDirectory, flutterTestDirectory + '/child_directory',
|
final ProcessResult result = await _runFlutterTest(null, automatedTestsDirectory, flutterTestDirectory + '/child_directory',
|
||||||
extraArguments: const <String>['--verbose']);
|
extraArguments: const <String>['--verbose']);
|
||||||
if ((!result.stdout.contains('+2: All tests passed')) ||
|
final String stdout = result.stdout as String;
|
||||||
(!result.stdout.contains('test 0: starting shell process')) ||
|
if ((!stdout.contains('+2: All tests passed')) ||
|
||||||
(!result.stdout.contains('test 0: deleting temporary directory')) ||
|
(!stdout.contains('test 0: starting shell process')) ||
|
||||||
(!result.stdout.contains('test 0: finished')) ||
|
(!stdout.contains('test 0: deleting temporary directory')) ||
|
||||||
(!result.stdout.contains('test package returned with exit code 0'))) {
|
(!stdout.contains('test 0: finished')) ||
|
||||||
|
(!stdout.contains('test package returned with exit code 0'))) {
|
||||||
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
|
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
|
||||||
}
|
}
|
||||||
if (result.stderr.isNotEmpty) {
|
if ((result.stderr as String).isNotEmpty) {
|
||||||
fail('unexpected error output from test:\n\n${result.stderr}\n-- end stderr --\n\n');
|
fail('unexpected error output from test:\n\n${result.stderr}\n-- end stderr --\n\n');
|
||||||
}
|
}
|
||||||
expect(result.exitCode, 0);
|
expect(result.exitCode, 0);
|
||||||
@ -160,7 +162,7 @@ Future<void> _testFile(
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(exec.exitCode, exitCode);
|
expect(exec.exitCode, exitCode);
|
||||||
final List<String> output = exec.stdout.split('\n');
|
final List<String> output = (exec.stdout as String).split('\n');
|
||||||
if (output.first == 'Waiting for another flutter command to release the startup lock...') {
|
if (output.first == 'Waiting for another flutter command to release the startup lock...') {
|
||||||
output.removeAt(0);
|
output.removeAt(0);
|
||||||
}
|
}
|
||||||
@ -168,7 +170,7 @@ Future<void> _testFile(
|
|||||||
output.removeAt(0);
|
output.removeAt(0);
|
||||||
}
|
}
|
||||||
output.add('<<stderr>>');
|
output.add('<<stderr>>');
|
||||||
output.addAll(exec.stderr.split('\n'));
|
output.addAll((exec.stderr as String).split('\n'));
|
||||||
final List<String> expectations = fs.file(fullTestExpectation).readAsLinesSync();
|
final List<String> expectations = fs.file(fullTestExpectation).readAsLinesSync();
|
||||||
bool allowSkip = false;
|
bool allowSkip = false;
|
||||||
int expectationLineNumber = 0;
|
int expectationLineNumber = 0;
|
||||||
|
@ -94,7 +94,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Usage records one feature in experiment setting', () async {
|
testUsingContext('Usage records one feature in experiment setting', () async {
|
||||||
when<bool>(mockFlutterConfig.getValue(flutterWebFeature.configSetting))
|
when<bool>(mockFlutterConfig.getValue(flutterWebFeature.configSetting) as bool)
|
||||||
.thenReturn(true);
|
.thenReturn(true);
|
||||||
final Usage usage = Usage();
|
final Usage usage = Usage();
|
||||||
usage.sendCommand('test');
|
usage.sendCommand('test');
|
||||||
@ -112,11 +112,11 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Usage records multiple features in experiment setting', () async {
|
testUsingContext('Usage records multiple features in experiment setting', () async {
|
||||||
when<bool>(mockFlutterConfig.getValue(flutterWebFeature.configSetting))
|
when<bool>(mockFlutterConfig.getValue(flutterWebFeature.configSetting) as bool)
|
||||||
.thenReturn(true);
|
.thenReturn(true);
|
||||||
when<bool>(mockFlutterConfig.getValue(flutterLinuxDesktopFeature.configSetting))
|
when<bool>(mockFlutterConfig.getValue(flutterLinuxDesktopFeature.configSetting) as bool)
|
||||||
.thenReturn(true);
|
.thenReturn(true);
|
||||||
when<bool>(mockFlutterConfig.getValue(flutterMacOSDesktopFeature.configSetting))
|
when<bool>(mockFlutterConfig.getValue(flutterMacOSDesktopFeature.configSetting) as bool)
|
||||||
.thenReturn(true);
|
.thenReturn(true);
|
||||||
final Usage usage = Usage();
|
final Usage usage = Usage();
|
||||||
usage.sendCommand('test');
|
usage.sendCommand('test');
|
||||||
@ -201,7 +201,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('compound command usage path', () async {
|
testUsingContext('compound command usage path', () async {
|
||||||
final BuildCommand buildCommand = BuildCommand();
|
final BuildCommand buildCommand = BuildCommand();
|
||||||
final FlutterCommand buildApkCommand = buildCommand.subcommands['apk'];
|
final FlutterCommand buildApkCommand = buildCommand.subcommands['apk'] as FlutterCommand;
|
||||||
expect(await buildApkCommand.usagePath, 'build/apk');
|
expect(await buildApkCommand.usagePath, 'build/apk');
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Usage: () => mockUsage,
|
Usage: () => mockUsage,
|
||||||
|
@ -3,13 +3,11 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/android/gradle_utils.dart';
|
|
||||||
import 'package:flutter_tools/src/android/gradle_errors.dart';
|
import 'package:flutter_tools/src/android/gradle_errors.dart';
|
||||||
|
import 'package:flutter_tools/src/android/gradle_utils.dart';
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
@ -57,8 +55,7 @@ at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)''';
|
|||||||
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
||||||
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText,
|
||||||
expect(logger.errorText,
|
|
||||||
contains(
|
contains(
|
||||||
'Gradle threw an error while trying to update itself. '
|
'Gradle threw an error while trying to update itself. '
|
||||||
'Retrying the update...'
|
'Retrying the update...'
|
||||||
@ -86,8 +83,7 @@ at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)''';
|
|||||||
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
||||||
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText,
|
||||||
expect(logger.errorText,
|
|
||||||
contains(
|
contains(
|
||||||
'Gradle threw an error while trying to update itself. '
|
'Gradle threw an error while trying to update itself. '
|
||||||
'Retrying the update...'
|
'Retrying the update...'
|
||||||
@ -106,8 +102,7 @@ Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached
|
|||||||
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
||||||
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText,
|
||||||
expect(logger.errorText,
|
|
||||||
contains(
|
contains(
|
||||||
'Gradle threw an error while trying to update itself. '
|
'Gradle threw an error while trying to update itself. '
|
||||||
'Retrying the update...'
|
'Retrying the update...'
|
||||||
@ -142,8 +137,7 @@ Exception in thread "main" javax.net.ssl.SSLHandshakeException: Remote host clos
|
|||||||
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
||||||
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText,
|
||||||
expect(logger.errorText,
|
|
||||||
contains(
|
contains(
|
||||||
'Gradle threw an error while trying to update itself. '
|
'Gradle threw an error while trying to update itself. '
|
||||||
'Retrying the update...'
|
'Retrying the update...'
|
||||||
@ -170,8 +164,7 @@ Exception in thread "main" java.io.FileNotFoundException: https://downloads.grad
|
|||||||
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
||||||
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText,
|
||||||
expect(logger.errorText,
|
|
||||||
contains(
|
contains(
|
||||||
'Gradle threw an error while trying to update itself. '
|
'Gradle threw an error while trying to update itself. '
|
||||||
'Retrying the update...'
|
'Retrying the update...'
|
||||||
@ -209,8 +202,7 @@ Exception in thread "main" java.net.SocketException: Connection reset
|
|||||||
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
expect(testErrorMessage(errorMessage, networkErrorHandler), isTrue);
|
||||||
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
expect(await networkErrorHandler.handler(), equals(GradleBuildStatus.retry));
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText,
|
||||||
expect(logger.errorText,
|
|
||||||
contains(
|
contains(
|
||||||
'Gradle threw an error while trying to update itself. '
|
'Gradle threw an error while trying to update itself. '
|
||||||
'Retrying the update...'
|
'Retrying the update...'
|
||||||
@ -228,13 +220,12 @@ Command: /home/android/gradlew assembleRelease
|
|||||||
expect(testErrorMessage(errorMessage, permissionDeniedErrorHandler), isTrue);
|
expect(testErrorMessage(errorMessage, permissionDeniedErrorHandler), isTrue);
|
||||||
expect(await permissionDeniedErrorHandler.handler(), equals(GradleBuildStatus.exit));
|
expect(await permissionDeniedErrorHandler.handler(), equals(GradleBuildStatus.exit));
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains('Gradle does not have execution permission.'),
|
contains('Gradle does not have execution permission.'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'You should change the ownership of the project directory to your user, '
|
'You should change the ownership of the project directory to your user, '
|
||||||
'or move the project to a directory with execute permissions.'
|
'or move the project to a directory with execute permissions.'
|
||||||
@ -302,8 +293,7 @@ Command: /home/android/gradlew assembleRelease
|
|||||||
usesAndroidX: false,
|
usesAndroidX: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.statusText,
|
||||||
expect(logger.statusText,
|
|
||||||
contains(
|
contains(
|
||||||
'AndroidX incompatibilities may have caused this build to fail. '
|
'AndroidX incompatibilities may have caused this build to fail. '
|
||||||
'Please migrate your app to AndroidX. See https://goo.gl/CP92wY.'
|
'Please migrate your app to AndroidX. See https://goo.gl/CP92wY.'
|
||||||
@ -361,8 +351,7 @@ Command: /home/android/gradlew assembleRelease
|
|||||||
shouldBuildPluginAsAar: false,
|
shouldBuildPluginAsAar: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.statusText,
|
||||||
expect(logger.statusText,
|
|
||||||
contains(
|
contains(
|
||||||
'The built failed likely due to AndroidX incompatibilities in a plugin. '
|
'The built failed likely due to AndroidX incompatibilities in a plugin. '
|
||||||
'The tool is about to try using Jetfier to solve the incompatibility.'
|
'The tool is about to try using Jetfier to solve the incompatibility.'
|
||||||
@ -396,13 +385,12 @@ Command: /home/android/gradlew assembleRelease
|
|||||||
testUsingContext('handler', () async {
|
testUsingContext('handler', () async {
|
||||||
expect(await permissionDeniedErrorHandler.handler(), equals(GradleBuildStatus.exit));
|
expect(await permissionDeniedErrorHandler.handler(), equals(GradleBuildStatus.exit));
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains('Gradle does not have execution permission.'),
|
contains('Gradle does not have execution permission.'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'You should change the ownership of the project directory to your user, '
|
'You should change the ownership of the project directory to your user, '
|
||||||
'or move the project to a directory with execute permissions.'
|
'or move the project to a directory with execute permissions.'
|
||||||
@ -427,9 +415,8 @@ Command: /home/android/gradlew assembleRelease
|
|||||||
project: FlutterProject.current(),
|
project: FlutterProject.current(),
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'Unable to download needed Android SDK components, as the '
|
'Unable to download needed Android SDK components, as the '
|
||||||
'following licenses have not been accepted:\n'
|
'following licenses have not been accepted:\n'
|
||||||
@ -508,16 +495,15 @@ assembleFooTest
|
|||||||
project: FlutterProject.current(),
|
project: FlutterProject.current(),
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'Gradle project does not define a task suitable '
|
'Gradle project does not define a task suitable '
|
||||||
'for the requested build.'
|
'for the requested build.'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'The android/app/build.gradle file defines product '
|
'The android/app/build.gradle file defines product '
|
||||||
'flavors: flavor1, flavor_2 '
|
'flavors: flavor1, flavor_2 '
|
||||||
@ -557,16 +543,15 @@ assembleProfile
|
|||||||
project: FlutterProject.current(),
|
project: FlutterProject.current(),
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'Gradle project does not define a task suitable '
|
'Gradle project does not define a task suitable '
|
||||||
'for the requested build.'
|
'for the requested build.'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'The android/app/build.gradle file does not define any custom product flavors. '
|
'The android/app/build.gradle file does not define any custom product flavors. '
|
||||||
'You cannot use the --flavor option.'
|
'You cannot use the --flavor option.'
|
||||||
|
@ -1604,9 +1604,8 @@ plugin2=${plugin2.path}
|
|||||||
localGradleErrors: const <GradleHandledError>[],
|
localGradleErrors: const <GradleHandledError>[],
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains('Built build/app/outputs/apk/release/app-release.apk (0.0MB)'),
|
contains('Built build/app/outputs/apk/release/app-release.apk (0.0MB)'),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1652,13 +1651,12 @@ plugin2=${plugin2.path}
|
|||||||
target: '',
|
target: '',
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains('Built build/outputs/repo'),
|
contains('Built build/outputs/repo'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
logger.statusText.contains('Consuming the Module'),
|
testLogger.statusText.contains('Consuming the Module'),
|
||||||
isFalse,
|
isFalse,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1745,7 +1743,7 @@ plugin2=${plugin2.path}
|
|||||||
environment: anyNamed('environment'),
|
environment: anyNamed('environment'),
|
||||||
workingDirectory: anyNamed('workingDirectory')
|
workingDirectory: anyNamed('workingDirectory')
|
||||||
),
|
),
|
||||||
).captured.last;
|
).captured.last as List<String>;
|
||||||
|
|
||||||
expect(actualGradlewCall, contains('/android/gradlew'));
|
expect(actualGradlewCall, contains('/android/gradlew'));
|
||||||
expect(actualGradlewCall, contains('-Plocal-engine-out=out/android_arm'));
|
expect(actualGradlewCall, contains('-Plocal-engine-out=out/android_arm'));
|
||||||
@ -1821,7 +1819,7 @@ plugin2=${plugin2.path}
|
|||||||
environment: anyNamed('environment'),
|
environment: anyNamed('environment'),
|
||||||
workingDirectory: anyNamed('workingDirectory'),
|
workingDirectory: anyNamed('workingDirectory'),
|
||||||
),
|
),
|
||||||
).captured.last;
|
).captured.last as List<String>;
|
||||||
|
|
||||||
expect(actualGradlewCall, contains('/.android/gradlew'));
|
expect(actualGradlewCall, contains('/.android/gradlew'));
|
||||||
expect(actualGradlewCall, contains('-Plocal-engine-out=out/android_arm'));
|
expect(actualGradlewCall, contains('-Plocal-engine-out=out/android_arm'));
|
||||||
@ -1847,9 +1845,8 @@ plugin2=${plugin2.path}
|
|||||||
repoDirectory: fs.directory('build/'),
|
repoDirectory: fs.directory('build/'),
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'\n'
|
'\n'
|
||||||
'Consuming the Module\n'
|
'Consuming the Module\n'
|
||||||
@ -1900,9 +1897,8 @@ plugin2=${plugin2.path}
|
|||||||
repoDirectory: fs.directory('build/'),
|
repoDirectory: fs.directory('build/'),
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'\n'
|
'\n'
|
||||||
'Consuming the Module\n'
|
'Consuming the Module\n'
|
||||||
@ -1940,9 +1936,8 @@ plugin2=${plugin2.path}
|
|||||||
repoDirectory: fs.directory('build/'),
|
repoDirectory: fs.directory('build/'),
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'\n'
|
'\n'
|
||||||
'Consuming the Module\n'
|
'Consuming the Module\n'
|
||||||
@ -1980,9 +1975,8 @@ plugin2=${plugin2.path}
|
|||||||
repoDirectory: fs.directory('build/'),
|
repoDirectory: fs.directory('build/'),
|
||||||
);
|
);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText,
|
testLogger.statusText,
|
||||||
contains(
|
contains(
|
||||||
'\n'
|
'\n'
|
||||||
'Consuming the Module\n'
|
'Consuming the Module\n'
|
||||||
@ -2047,7 +2041,7 @@ FlutterProject generateFakeAppBundle(String directoryName, String fileName) {
|
|||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform fakePlatform(String name) {
|
FakePlatform fakePlatform(String name) {
|
||||||
return FakePlatform.fromPlatform(const LocalPlatform())
|
return FakePlatform.fromPlatform(const LocalPlatform())
|
||||||
..operatingSystem = name
|
..operatingSystem = name
|
||||||
..stdoutSupportsAnsi = false;
|
..stdoutSupportsAnsi = false;
|
||||||
|
@ -11,7 +11,6 @@ import 'package:flutter_tools/src/android/android_sdk.dart';
|
|||||||
import 'package:flutter_tools/src/application_package.dart';
|
import 'package:flutter_tools/src/application_package.dart';
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/base/os.dart';
|
import 'package:flutter_tools/src/base/os.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
@ -179,25 +178,22 @@ void main() {
|
|||||||
testUsingContext('Error when parsing manifest with no Activity that has enabled set to true nor has no value for its enabled field', () {
|
testUsingContext('Error when parsing manifest with no Activity that has enabled set to true nor has no value for its enabled field', () {
|
||||||
final ApkManifestData data = ApkManifestData.parseFromXmlDump(_aaptDataWithNoEnabledActivity);
|
final ApkManifestData data = ApkManifestData.parseFromXmlDump(_aaptDataWithNoEnabledActivity);
|
||||||
expect(data, isNull);
|
expect(data, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.errorText, 'Error running io.flutter.examples.hello_world. Default activity not found\n');
|
testLogger.errorText, 'Error running io.flutter.examples.hello_world. Default activity not found\n');
|
||||||
}, overrides: noColorTerminalOverride);
|
}, overrides: noColorTerminalOverride);
|
||||||
|
|
||||||
testUsingContext('Error when parsing manifest with no Activity that has action set to android.intent.action.MAIN', () {
|
testUsingContext('Error when parsing manifest with no Activity that has action set to android.intent.action.MAIN', () {
|
||||||
final ApkManifestData data = ApkManifestData.parseFromXmlDump(_aaptDataWithNoMainActivity);
|
final ApkManifestData data = ApkManifestData.parseFromXmlDump(_aaptDataWithNoMainActivity);
|
||||||
expect(data, isNull);
|
expect(data, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.errorText, 'Error running io.flutter.examples.hello_world. Default activity not found\n');
|
testLogger.errorText, 'Error running io.flutter.examples.hello_world. Default activity not found\n');
|
||||||
}, overrides: noColorTerminalOverride);
|
}, overrides: noColorTerminalOverride);
|
||||||
|
|
||||||
testUsingContext('Error when parsing manifest with no Activity that has category set to android.intent.category.LAUNCHER', () {
|
testUsingContext('Error when parsing manifest with no Activity that has category set to android.intent.category.LAUNCHER', () {
|
||||||
final ApkManifestData data = ApkManifestData.parseFromXmlDump(_aaptDataWithNoLauncherActivity);
|
final ApkManifestData data = ApkManifestData.parseFromXmlDump(_aaptDataWithNoLauncherActivity);
|
||||||
expect(data, isNull);
|
expect(data, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.errorText, 'Error running io.flutter.examples.hello_world. Default activity not found\n');
|
testLogger.errorText, 'Error running io.flutter.examples.hello_world. Default activity not found\n');
|
||||||
}, overrides: noColorTerminalOverride);
|
}, overrides: noColorTerminalOverride);
|
||||||
|
|
||||||
testUsingContext('Parsing manifest with Activity that has multiple category, android.intent.category.LAUNCHER and android.intent.category.DEFAULT', () {
|
testUsingContext('Parsing manifest with Activity that has multiple category, android.intent.category.LAUNCHER and android.intent.category.DEFAULT', () {
|
||||||
@ -219,11 +215,10 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('Error on non-existing file', () {
|
testUsingContext('Error on non-existing file', () {
|
||||||
final PrebuiltIOSApp iosApp =
|
final PrebuiltIOSApp iosApp =
|
||||||
IOSApp.fromPrebuiltApp(fs.file('not_existing.ipa'));
|
IOSApp.fromPrebuiltApp(fs.file('not_existing.ipa')) as PrebuiltIOSApp;
|
||||||
expect(iosApp, isNull);
|
expect(iosApp, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.errorText,
|
testLogger.errorText,
|
||||||
'File "not_existing.ipa" does not exist. Use an app bundle or an ipa.\n',
|
'File "not_existing.ipa" does not exist. Use an app bundle or an ipa.\n',
|
||||||
);
|
);
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
@ -231,20 +226,18 @@ void main() {
|
|||||||
testUsingContext('Error on non-app-bundle folder', () {
|
testUsingContext('Error on non-app-bundle folder', () {
|
||||||
fs.directory('regular_folder').createSync();
|
fs.directory('regular_folder').createSync();
|
||||||
final PrebuiltIOSApp iosApp =
|
final PrebuiltIOSApp iosApp =
|
||||||
IOSApp.fromPrebuiltApp(fs.file('regular_folder'));
|
IOSApp.fromPrebuiltApp(fs.file('regular_folder')) as PrebuiltIOSApp;
|
||||||
expect(iosApp, isNull);
|
expect(iosApp, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.errorText, 'Folder "regular_folder" is not an app bundle.\n');
|
testLogger.errorText, 'Folder "regular_folder" is not an app bundle.\n');
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
|
|
||||||
testUsingContext('Error on no info.plist', () {
|
testUsingContext('Error on no info.plist', () {
|
||||||
fs.directory('bundle.app').createSync();
|
fs.directory('bundle.app').createSync();
|
||||||
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('bundle.app'));
|
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('bundle.app')) as PrebuiltIOSApp;
|
||||||
expect(iosApp, isNull);
|
expect(iosApp, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.errorText,
|
testLogger.errorText,
|
||||||
'Invalid prebuilt iOS app. Does not contain Info.plist.\n',
|
'Invalid prebuilt iOS app. Does not contain Info.plist.\n',
|
||||||
);
|
);
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
@ -252,11 +245,10 @@ void main() {
|
|||||||
testUsingContext('Error on bad info.plist', () {
|
testUsingContext('Error on bad info.plist', () {
|
||||||
fs.directory('bundle.app').createSync();
|
fs.directory('bundle.app').createSync();
|
||||||
fs.file('bundle.app/Info.plist').writeAsStringSync(badPlistData);
|
fs.file('bundle.app/Info.plist').writeAsStringSync(badPlistData);
|
||||||
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('bundle.app'));
|
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('bundle.app')) as PrebuiltIOSApp;
|
||||||
expect(iosApp, isNull);
|
expect(iosApp, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.errorText,
|
testLogger.errorText,
|
||||||
contains(
|
contains(
|
||||||
'Invalid prebuilt iOS app. Info.plist does not contain bundle identifier\n'),
|
'Invalid prebuilt iOS app. Info.plist does not contain bundle identifier\n'),
|
||||||
);
|
);
|
||||||
@ -265,9 +257,8 @@ void main() {
|
|||||||
testUsingContext('Success with app bundle', () {
|
testUsingContext('Success with app bundle', () {
|
||||||
fs.directory('bundle.app').createSync();
|
fs.directory('bundle.app').createSync();
|
||||||
fs.file('bundle.app/Info.plist').writeAsStringSync(plistData);
|
fs.file('bundle.app/Info.plist').writeAsStringSync(plistData);
|
||||||
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('bundle.app'));
|
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('bundle.app')) as PrebuiltIOSApp;
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText, isEmpty);
|
||||||
expect(logger.errorText, isEmpty);
|
|
||||||
expect(iosApp.bundleDir.path, 'bundle.app');
|
expect(iosApp.bundleDir.path, 'bundle.app');
|
||||||
expect(iosApp.id, 'fooBundleId');
|
expect(iosApp.id, 'fooBundleId');
|
||||||
expect(iosApp.bundleName, 'bundle.app');
|
expect(iosApp.bundleName, 'bundle.app');
|
||||||
@ -276,11 +267,10 @@ void main() {
|
|||||||
testUsingContext('Bad ipa zip-file, no payload dir', () {
|
testUsingContext('Bad ipa zip-file, no payload dir', () {
|
||||||
fs.file('app.ipa').createSync();
|
fs.file('app.ipa').createSync();
|
||||||
when(os.unzip(fs.file('app.ipa'), any)).thenAnswer((Invocation _) { });
|
when(os.unzip(fs.file('app.ipa'), any)).thenAnswer((Invocation _) { });
|
||||||
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('app.ipa'));
|
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('app.ipa')) as PrebuiltIOSApp;
|
||||||
expect(iosApp, isNull);
|
expect(iosApp, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.errorText,
|
testLogger.errorText,
|
||||||
'Invalid prebuilt iOS ipa. Does not contain a "Payload" directory.\n',
|
'Invalid prebuilt iOS ipa. Does not contain a "Payload" directory.\n',
|
||||||
);
|
);
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
@ -288,11 +278,11 @@ void main() {
|
|||||||
testUsingContext('Bad ipa zip-file, two app bundles', () {
|
testUsingContext('Bad ipa zip-file, two app bundles', () {
|
||||||
fs.file('app.ipa').createSync();
|
fs.file('app.ipa').createSync();
|
||||||
when(os.unzip(any, any)).thenAnswer((Invocation invocation) {
|
when(os.unzip(any, any)).thenAnswer((Invocation invocation) {
|
||||||
final File zipFile = invocation.positionalArguments[0];
|
final File zipFile = invocation.positionalArguments[0] as File;
|
||||||
if (zipFile.path != 'app.ipa') {
|
if (zipFile.path != 'app.ipa') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Directory targetDirectory = invocation.positionalArguments[1];
|
final Directory targetDirectory = invocation.positionalArguments[1] as Directory;
|
||||||
final String bundlePath1 =
|
final String bundlePath1 =
|
||||||
fs.path.join(targetDirectory.path, 'Payload', 'bundle1.app');
|
fs.path.join(targetDirectory.path, 'Payload', 'bundle1.app');
|
||||||
final String bundlePath2 =
|
final String bundlePath2 =
|
||||||
@ -300,21 +290,20 @@ void main() {
|
|||||||
fs.directory(bundlePath1).createSync(recursive: true);
|
fs.directory(bundlePath1).createSync(recursive: true);
|
||||||
fs.directory(bundlePath2).createSync(recursive: true);
|
fs.directory(bundlePath2).createSync(recursive: true);
|
||||||
});
|
});
|
||||||
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('app.ipa'));
|
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('app.ipa')) as PrebuiltIOSApp;
|
||||||
expect(iosApp, isNull);
|
expect(iosApp, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText,
|
||||||
expect(logger.errorText,
|
|
||||||
'Invalid prebuilt iOS ipa. Does not contain a single app bundle.\n');
|
'Invalid prebuilt iOS ipa. Does not contain a single app bundle.\n');
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
|
|
||||||
testUsingContext('Success with ipa', () {
|
testUsingContext('Success with ipa', () {
|
||||||
fs.file('app.ipa').createSync();
|
fs.file('app.ipa').createSync();
|
||||||
when(os.unzip(any, any)).thenAnswer((Invocation invocation) {
|
when(os.unzip(any, any)).thenAnswer((Invocation invocation) {
|
||||||
final File zipFile = invocation.positionalArguments[0];
|
final File zipFile = invocation.positionalArguments[0] as File;
|
||||||
if (zipFile.path != 'app.ipa') {
|
if (zipFile.path != 'app.ipa') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Directory targetDirectory = invocation.positionalArguments[1];
|
final Directory targetDirectory = invocation.positionalArguments[1] as Directory;
|
||||||
final Directory bundleAppDir = fs.directory(
|
final Directory bundleAppDir = fs.directory(
|
||||||
fs.path.join(targetDirectory.path, 'Payload', 'bundle.app'));
|
fs.path.join(targetDirectory.path, 'Payload', 'bundle.app'));
|
||||||
bundleAppDir.createSync(recursive: true);
|
bundleAppDir.createSync(recursive: true);
|
||||||
@ -322,9 +311,8 @@ void main() {
|
|||||||
.file(fs.path.join(bundleAppDir.path, 'Info.plist'))
|
.file(fs.path.join(bundleAppDir.path, 'Info.plist'))
|
||||||
.writeAsStringSync(plistData);
|
.writeAsStringSync(plistData);
|
||||||
});
|
});
|
||||||
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('app.ipa'));
|
final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(fs.file('app.ipa')) as PrebuiltIOSApp;
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText, isEmpty);
|
||||||
expect(logger.errorText, isEmpty);
|
|
||||||
expect(iosApp.bundleDir.path, endsWith('bundle.app'));
|
expect(iosApp.bundleDir.path, endsWith('bundle.app'));
|
||||||
expect(iosApp.id, 'fooBundleId');
|
expect(iosApp.id, 'fooBundleId');
|
||||||
expect(iosApp.bundleName, 'bundle.app');
|
expect(iosApp.bundleName, 'bundle.app');
|
||||||
@ -334,7 +322,7 @@ void main() {
|
|||||||
fs.file('pubspec.yaml').createSync();
|
fs.file('pubspec.yaml').createSync();
|
||||||
fs.file('.packages').createSync();
|
fs.file('.packages').createSync();
|
||||||
final BuildableIOSApp iosApp = await IOSApp.fromIosProject(
|
final BuildableIOSApp iosApp = await IOSApp.fromIosProject(
|
||||||
FlutterProject.fromDirectory(fs.currentDirectory).ios);
|
FlutterProject.fromDirectory(fs.currentDirectory).ios) as BuildableIOSApp;
|
||||||
|
|
||||||
expect(iosApp, null);
|
expect(iosApp, null);
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
@ -344,7 +332,7 @@ void main() {
|
|||||||
fs.file('.packages').createSync();
|
fs.file('.packages').createSync();
|
||||||
fs.file('ios/FooBar.xcodeproj').createSync(recursive: true);
|
fs.file('ios/FooBar.xcodeproj').createSync(recursive: true);
|
||||||
final BuildableIOSApp iosApp = await IOSApp.fromIosProject(
|
final BuildableIOSApp iosApp = await IOSApp.fromIosProject(
|
||||||
FlutterProject.fromDirectory(fs.currentDirectory).ios);
|
FlutterProject.fromDirectory(fs.currentDirectory).ios) as BuildableIOSApp;
|
||||||
|
|
||||||
expect(iosApp, null);
|
expect(iosApp, null);
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
@ -354,7 +342,7 @@ void main() {
|
|||||||
fs.file('.packages').createSync();
|
fs.file('.packages').createSync();
|
||||||
fs.file('ios/Runner.xcodeproj').createSync(recursive: true);
|
fs.file('ios/Runner.xcodeproj').createSync(recursive: true);
|
||||||
final BuildableIOSApp iosApp = await IOSApp.fromIosProject(
|
final BuildableIOSApp iosApp = await IOSApp.fromIosProject(
|
||||||
FlutterProject.fromDirectory(fs.currentDirectory).ios);
|
FlutterProject.fromDirectory(fs.currentDirectory).ios) as BuildableIOSApp;
|
||||||
|
|
||||||
expect(iosApp, null);
|
expect(iosApp, null);
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
@ -370,11 +358,10 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('Error on non-existing file', () {
|
testUsingContext('Error on non-existing file', () {
|
||||||
final PrebuiltFuchsiaApp fuchsiaApp =
|
final PrebuiltFuchsiaApp fuchsiaApp =
|
||||||
FuchsiaApp.fromPrebuiltApp(fs.file('not_existing.far'));
|
FuchsiaApp.fromPrebuiltApp(fs.file('not_existing.far')) as PrebuiltFuchsiaApp;
|
||||||
expect(fuchsiaApp, isNull);
|
expect(fuchsiaApp, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.errorText,
|
testLogger.errorText,
|
||||||
'File "not_existing.far" does not exist or is not a .far file. Use far archive.\n',
|
'File "not_existing.far" does not exist or is not a .far file. Use far archive.\n',
|
||||||
);
|
);
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
@ -382,27 +369,25 @@ void main() {
|
|||||||
testUsingContext('Error on non-far file', () {
|
testUsingContext('Error on non-far file', () {
|
||||||
fs.directory('regular_folder').createSync();
|
fs.directory('regular_folder').createSync();
|
||||||
final PrebuiltFuchsiaApp fuchsiaApp =
|
final PrebuiltFuchsiaApp fuchsiaApp =
|
||||||
FuchsiaApp.fromPrebuiltApp(fs.file('regular_folder'));
|
FuchsiaApp.fromPrebuiltApp(fs.file('regular_folder')) as PrebuiltFuchsiaApp;
|
||||||
expect(fuchsiaApp, isNull);
|
expect(fuchsiaApp, isNull);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
expect(
|
expect(
|
||||||
logger.errorText,
|
testLogger.errorText,
|
||||||
'File "regular_folder" does not exist or is not a .far file. Use far archive.\n',
|
'File "regular_folder" does not exist or is not a .far file. Use far archive.\n',
|
||||||
);
|
);
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
|
|
||||||
testUsingContext('Success with far file', () {
|
testUsingContext('Success with far file', () {
|
||||||
fs.file('bundle.far').createSync();
|
fs.file('bundle.far').createSync();
|
||||||
final PrebuiltFuchsiaApp fuchsiaApp = FuchsiaApp.fromPrebuiltApp(fs.file('bundle.far'));
|
final PrebuiltFuchsiaApp fuchsiaApp = FuchsiaApp.fromPrebuiltApp(fs.file('bundle.far')) as PrebuiltFuchsiaApp;
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText, isEmpty);
|
||||||
expect(logger.errorText, isEmpty);
|
|
||||||
expect(fuchsiaApp.id, 'bundle.far');
|
expect(fuchsiaApp.id, 'bundle.far');
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
|
|
||||||
testUsingContext('returns null when there is no fuchsia', () async {
|
testUsingContext('returns null when there is no fuchsia', () async {
|
||||||
fs.file('pubspec.yaml').createSync();
|
fs.file('pubspec.yaml').createSync();
|
||||||
fs.file('.packages').createSync();
|
fs.file('.packages').createSync();
|
||||||
final BuildableFuchsiaApp fuchsiaApp = FuchsiaApp.fromFuchsiaProject(FlutterProject.fromDirectory(fs.currentDirectory).fuchsia);
|
final BuildableFuchsiaApp fuchsiaApp = FuchsiaApp.fromFuchsiaProject(FlutterProject.fromDirectory(fs.currentDirectory).fuchsia) as BuildableFuchsiaApp;
|
||||||
|
|
||||||
expect(fuchsiaApp, null);
|
expect(fuchsiaApp, null);
|
||||||
}, overrides: overrides);
|
}, overrides: overrides);
|
||||||
@ -658,7 +643,7 @@ class MockPlistUtils extends Mock implements PlistParser {
|
|||||||
if (!file.existsSync()) {
|
if (!file.existsSync()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return json.decode(file.readAsStringSync())[key];
|
return json.decode(file.readAsStringSync())[key] as String;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import 'dart:convert' show json;
|
|||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
|
import 'package:flutter_tools/src/base/utils.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/fingerprint.dart';
|
import 'package:flutter_tools/src/base/fingerprint.dart';
|
||||||
@ -301,7 +302,7 @@ void main() {
|
|||||||
fs.file('b.dart').writeAsStringSync('This is b');
|
fs.file('b.dart').writeAsStringSync('This is b');
|
||||||
final Fingerprint fingerprint = Fingerprint.fromBuildInputs(<String, String>{}, <String>['a.dart', 'b.dart']);
|
final Fingerprint fingerprint = Fingerprint.fromBuildInputs(<String, String>{}, <String>['a.dart', 'b.dart']);
|
||||||
|
|
||||||
final Map<String, dynamic> jsonObject = json.decode(fingerprint.toJson());
|
final Map<String, dynamic> jsonObject = castStringKeyedMap(json.decode(fingerprint.toJson()));
|
||||||
expect(jsonObject['files'], hasLength(2));
|
expect(jsonObject['files'], hasLength(2));
|
||||||
expect(jsonObject['files']['a.dart'], '8a21a15fad560b799f6731d436c1b698');
|
expect(jsonObject['files']['a.dart'], '8a21a15fad560b799f6731d436c1b698');
|
||||||
expect(jsonObject['files']['b.dart'], '6f144e08b58cd0925328610fad7ac07c');
|
expect(jsonObject['files']['b.dart'], '6f144e08b58cd0925328610fad7ac07c');
|
||||||
@ -313,14 +314,14 @@ void main() {
|
|||||||
testUsingContext('includes framework version', () {
|
testUsingContext('includes framework version', () {
|
||||||
final Fingerprint fingerprint = Fingerprint.fromBuildInputs(<String, String>{}, <String>[]);
|
final Fingerprint fingerprint = Fingerprint.fromBuildInputs(<String, String>{}, <String>[]);
|
||||||
|
|
||||||
final Map<String, dynamic> jsonObject = json.decode(fingerprint.toJson());
|
final Map<String, dynamic> jsonObject = castStringKeyedMap(json.decode(fingerprint.toJson()));
|
||||||
expect(jsonObject['version'], mockVersion.frameworkRevision);
|
expect(jsonObject['version'], mockVersion.frameworkRevision);
|
||||||
}, overrides: <Type, Generator>{FlutterVersion: () => mockVersion});
|
}, overrides: <Type, Generator>{FlutterVersion: () => mockVersion});
|
||||||
|
|
||||||
testUsingContext('includes provided properties', () {
|
testUsingContext('includes provided properties', () {
|
||||||
final Fingerprint fingerprint = Fingerprint.fromBuildInputs(<String, String>{'a': 'A', 'b': 'B'}, <String>[]);
|
final Fingerprint fingerprint = Fingerprint.fromBuildInputs(<String, String>{'a': 'A', 'b': 'B'}, <String>[]);
|
||||||
|
|
||||||
final Map<String, dynamic> jsonObject = json.decode(fingerprint.toJson());
|
final Map<String, dynamic> jsonObject = castStringKeyedMap(json.decode(fingerprint.toJson()));
|
||||||
expect(jsonObject['properties'], hasLength(2));
|
expect(jsonObject['properties'], hasLength(2));
|
||||||
expect(jsonObject['properties']['a'], 'A');
|
expect(jsonObject['properties']['a'], 'A');
|
||||||
expect(jsonObject['properties']['b'], 'B');
|
expect(jsonObject['properties']['b'], 'B');
|
||||||
@ -348,7 +349,7 @@ void main() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
final Fingerprint fingerprint = Fingerprint.fromJson(jsonString);
|
final Fingerprint fingerprint = Fingerprint.fromJson(jsonString);
|
||||||
final Map<String, dynamic> content = json.decode(fingerprint.toJson());
|
final Map<String, dynamic> content = castStringKeyedMap(json.decode(fingerprint.toJson()));
|
||||||
expect(content, hasLength(3));
|
expect(content, hasLength(3));
|
||||||
expect(content['version'], mockVersion.frameworkRevision);
|
expect(content['version'], mockVersion.frameworkRevision);
|
||||||
expect(content['properties'], hasLength(3));
|
expect(content['properties'], hasLength(3));
|
||||||
|
@ -705,10 +705,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('sequential startProgress calls with BufferLogger', () async {
|
testUsingContext('sequential startProgress calls with BufferLogger', () async {
|
||||||
final BufferLogger logger = context.get<Logger>();
|
testLogger.startProgress('AAA', timeout: timeoutConfiguration.fastOperation)..stop();
|
||||||
logger.startProgress('AAA', timeout: timeoutConfiguration.fastOperation)..stop();
|
testLogger.startProgress('BBB', timeout: timeoutConfiguration.fastOperation)..stop();
|
||||||
logger.startProgress('BBB', timeout: timeoutConfiguration.fastOperation)..stop();
|
expect(testLogger.statusText, 'AAA\nBBB\n');
|
||||||
expect(logger.statusText, 'AAA\nBBB\n');
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Logger: () => BufferLogger(),
|
Logger: () => BufferLogger(),
|
||||||
Platform: _kNoAnsiPlatform,
|
Platform: _kNoAnsiPlatform,
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:typed_data';
|
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
@ -365,25 +364,25 @@ class FakeHttpClientResponse implements io.HttpClientResponse {
|
|||||||
String get reasonPhrase => '<reason phrase>';
|
String get reasonPhrase => '<reason phrase>';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
StreamSubscription<Uint8List> listen(
|
StreamSubscription<List<int>> listen(
|
||||||
void onData(Uint8List event), {
|
void onData(List<int> event), {
|
||||||
Function onError,
|
Function onError,
|
||||||
void onDone(),
|
void onDone(),
|
||||||
bool cancelOnError,
|
bool cancelOnError,
|
||||||
}) {
|
}) {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return Stream<Uint8List>.fromFuture(Future<Uint8List>.error(
|
return Stream<List<int>>.fromFuture(Future<List<int>>.error(
|
||||||
const io.SocketException('test'),
|
const io.SocketException('test'),
|
||||||
)).listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
)).listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
||||||
} else {
|
} else {
|
||||||
return Stream<Uint8List>.fromFuture(Future<Uint8List>.value(
|
return Stream<List<int>>.fromFuture(Future<List<int>>.value(
|
||||||
utf8.encode(data) as Uint8List,
|
utf8.encode(data),
|
||||||
)).listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
)).listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<dynamic> forEach(void Function(Uint8List element) action) async {
|
Future<dynamic> forEach(void Function(List<int> element) action) async {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return Future<void>.error(const io.SocketException('test'));
|
return Future<void>.error(const io.SocketException('test'));
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
|
import 'package:flutter_tools/src/base/utils.dart';
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/build_system/exceptions.dart';
|
import 'package:flutter_tools/src/build_system/exceptions.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
@ -133,7 +134,7 @@ void main() {
|
|||||||
final File stampFile = fs.file(fs.path.join(environment.buildDir.path, 'foo.stamp'));
|
final File stampFile = fs.file(fs.path.join(environment.buildDir.path, 'foo.stamp'));
|
||||||
expect(stampFile.existsSync(), true);
|
expect(stampFile.existsSync(), true);
|
||||||
|
|
||||||
final Map<String, Object> stampContents = json.decode(stampFile.readAsStringSync());
|
final Map<String, dynamic> stampContents = castStringKeyedMap(json.decode(stampFile.readAsStringSync()));
|
||||||
expect(stampContents['inputs'], <Object>['/foo.dart']);
|
expect(stampContents['inputs'], <Object>['/foo.dart']);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -2,14 +2,15 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/build_system/file_hash_store.dart';
|
import 'package:flutter_tools/src/build_system/file_hash_store.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
|
import '../../src/context.dart';
|
||||||
import '../../src/testbed.dart';
|
import '../../src/testbed.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@ -34,7 +35,7 @@ void main() {
|
|||||||
|
|
||||||
expect(fs.file(fs.path.join(environment.buildDir.path, '.filecache')).existsSync(), true);
|
expect(fs.file(fs.path.join(environment.buildDir.path, '.filecache')).existsSync(), true);
|
||||||
|
|
||||||
final List<int> buffer = fs.file(fs.path.join(environment.buildDir.path, '.filecache'))
|
final Uint8List buffer = fs.file(fs.path.join(environment.buildDir.path, '.filecache'))
|
||||||
.readAsBytesSync();
|
.readAsBytesSync();
|
||||||
final FileStorage fileStorage = FileStorage.fromBuffer(buffer);
|
final FileStorage fileStorage = FileStorage.fromBuffer(buffer);
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ void main() {
|
|||||||
await fileCache.hashFiles(<File>[file]);
|
await fileCache.hashFiles(<File>[file]);
|
||||||
fileCache.persist();
|
fileCache.persist();
|
||||||
final String currentHash = fileCache.currentHashes[file.path];
|
final String currentHash = fileCache.currentHashes[file.path];
|
||||||
final List<int> buffer = fs.file(fs.path.join(environment.buildDir.path, '.filecache'))
|
final Uint8List buffer = fs.file(fs.path.join(environment.buildDir.path, '.filecache'))
|
||||||
.readAsBytesSync();
|
.readAsBytesSync();
|
||||||
FileStorage fileStorage = FileStorage.fromBuffer(buffer);
|
FileStorage fileStorage = FileStorage.fromBuffer(buffer);
|
||||||
|
|
||||||
@ -97,7 +98,6 @@ void main() {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
test('handles failure to persist file cache', () => testbed.run(() async {
|
test('handles failure to persist file cache', () => testbed.run(() async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final FakeForwardingFileSystem fakeForwardingFileSystem = FakeForwardingFileSystem(fs);
|
final FakeForwardingFileSystem fakeForwardingFileSystem = FakeForwardingFileSystem(fs);
|
||||||
final FileHashStore fileCache = FileHashStore(environment, fakeForwardingFileSystem);
|
final FileHashStore fileCache = FileHashStore(environment, fakeForwardingFileSystem);
|
||||||
final String cacheFile = environment.buildDir.childFile('.filecache').path;
|
final String cacheFile = environment.buildDir.childFile('.filecache').path;
|
||||||
@ -109,11 +109,10 @@ void main() {
|
|||||||
fakeForwardingFileSystem.files[cacheFile] = mockFile;
|
fakeForwardingFileSystem.files[cacheFile] = mockFile;
|
||||||
fileCache.persist();
|
fileCache.persist();
|
||||||
|
|
||||||
expect(bufferLogger.errorText, contains('Out of space!'));
|
expect(testLogger.errorText, contains('Out of space!'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('handles failure to restore file cache', () => testbed.run(() async {
|
test('handles failure to restore file cache', () => testbed.run(() async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final FakeForwardingFileSystem fakeForwardingFileSystem = FakeForwardingFileSystem(fs);
|
final FakeForwardingFileSystem fakeForwardingFileSystem = FakeForwardingFileSystem(fs);
|
||||||
final FileHashStore fileCache = FileHashStore(environment, fakeForwardingFileSystem);
|
final FileHashStore fileCache = FileHashStore(environment, fakeForwardingFileSystem);
|
||||||
final String cacheFile = environment.buildDir.childFile('.filecache').path;
|
final String cacheFile = environment.buildDir.childFile('.filecache').path;
|
||||||
@ -124,14 +123,14 @@ void main() {
|
|||||||
fakeForwardingFileSystem.files[cacheFile] = mockFile;
|
fakeForwardingFileSystem.files[cacheFile] = mockFile;
|
||||||
fileCache.initialize();
|
fileCache.initialize();
|
||||||
|
|
||||||
expect(bufferLogger.errorText, contains('Out of space!'));
|
expect(testLogger.errorText, contains('Out of space!'));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
class FakeForwardingFileSystem extends ForwardingFileSystem {
|
class FakeForwardingFileSystem extends ForwardingFileSystem {
|
||||||
FakeForwardingFileSystem(FileSystem fileSystem) : super(fileSystem);
|
FakeForwardingFileSystem(FileSystem fileSystem) : super(fileSystem);
|
||||||
|
|
||||||
final Map<String, FileSystemEntity> files = <String, FileSystemEntity>{};
|
final Map<String, File> files = <String, File>{};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
File file(dynamic path) => files[path] ?? super.file(path);
|
File file(dynamic path) => files[path] ?? super.file(path);
|
||||||
|
@ -115,7 +115,7 @@ void main() {
|
|||||||
snapshotType: captureAnyNamed('snapshotType'),
|
snapshotType: captureAnyNamed('snapshotType'),
|
||||||
darwinArch: anyNamed('darwinArch'),
|
darwinArch: anyNamed('darwinArch'),
|
||||||
additionalArgs: anyNamed('additionalArgs')
|
additionalArgs: anyNamed('additionalArgs')
|
||||||
)).captured.single;
|
)).captured.single as SnapshotType;
|
||||||
|
|
||||||
expect(snapshotType.platform, TargetPlatform.android_arm64);
|
expect(snapshotType.platform, TargetPlatform.android_arm64);
|
||||||
expect(snapshotType.mode, BuildMode.release);
|
expect(snapshotType.mode, BuildMode.release);
|
||||||
|
@ -118,7 +118,7 @@ flutter_tools:lib/''');
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
test('kernel_snapshot handles null result from kernel compilation', () => testbed.run(() async {
|
test('kernel_snapshot handles null result from kernel compilation', () => testbed.run(() async {
|
||||||
final FakeKernelCompilerFactory fakeKernelCompilerFactory = kernelCompilerFactory;
|
final FakeKernelCompilerFactory fakeKernelCompilerFactory = kernelCompilerFactory as FakeKernelCompilerFactory;
|
||||||
fakeKernelCompilerFactory.kernelCompiler = MockKernelCompiler();
|
fakeKernelCompilerFactory.kernelCompiler = MockKernelCompiler();
|
||||||
when(fakeKernelCompilerFactory.kernelCompiler.compile(
|
when(fakeKernelCompilerFactory.kernelCompiler.compile(
|
||||||
sdkRoot: anyNamed('sdkRoot'),
|
sdkRoot: anyNamed('sdkRoot'),
|
||||||
|
@ -90,7 +90,7 @@ void main() {
|
|||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
when(processManager.run(any)).thenAnswer((Invocation invocation) async {
|
when(processManager.run(any)).thenAnswer((Invocation invocation) async {
|
||||||
final List<String> arguments = invocation.positionalArguments.first;
|
final List<String> arguments = invocation.positionalArguments.first as List<String>;
|
||||||
final String sourcePath = arguments[arguments.length - 2];
|
final String sourcePath = arguments[arguments.length - 2];
|
||||||
final String targetPath = arguments.last;
|
final String targetPath = arguments.last;
|
||||||
final Directory source = fs.directory(sourcePath);
|
final Directory source = fs.directory(sourcePath);
|
||||||
|
@ -25,7 +25,7 @@ void main() {
|
|||||||
|
|
||||||
test('Copies assets to expected directory after building', () => testbed.run(() async {
|
test('Copies assets to expected directory after building', () => testbed.run(() async {
|
||||||
when(buildSystem.build(any, any)).thenAnswer((Invocation invocation) async {
|
when(buildSystem.build(any, any)).thenAnswer((Invocation invocation) async {
|
||||||
final Environment environment = invocation.positionalArguments[1];
|
final Environment environment = invocation.positionalArguments[1] as Environment;
|
||||||
environment.outputDir.childFile('kernel_blob.bin').createSync(recursive: true);
|
environment.outputDir.childFile('kernel_blob.bin').createSync(recursive: true);
|
||||||
environment.outputDir.childFile('isolate_snapshot_data').createSync();
|
environment.outputDir.childFile('isolate_snapshot_data').createSync();
|
||||||
environment.outputDir.childFile('vm_snapshot_data').createSync();
|
environment.outputDir.childFile('vm_snapshot_data').createSync();
|
||||||
|
@ -332,7 +332,7 @@ void main() {
|
|||||||
|
|
||||||
when(processManager.run(any, environment: captureAnyNamed('environment')))
|
when(processManager.run(any, environment: captureAnyNamed('environment')))
|
||||||
.thenAnswer((Invocation invocation) {
|
.thenAnswer((Invocation invocation) {
|
||||||
final List<String> args = invocation.positionalArguments[0];
|
final List<String> args = invocation.positionalArguments[0] as List<String>;
|
||||||
expect(args.length, 6);
|
expect(args.length, 6);
|
||||||
expect(args[1], '-b');
|
expect(args[1], '-b');
|
||||||
expect(args[2].endsWith('resolve_dependencies.gradle'), isTrue);
|
expect(args[2].endsWith('resolve_dependencies.gradle'), isTrue);
|
||||||
|
@ -10,7 +10,6 @@ import 'package:flutter_tools/src/android/android_builder.dart';
|
|||||||
import 'package:flutter_tools/src/android/android_sdk.dart';
|
import 'package:flutter_tools/src/android/android_sdk.dart';
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build_apk.dart';
|
import 'package:flutter_tools/src/commands/build_apk.dart';
|
||||||
@ -362,9 +361,8 @@ flutter:
|
|||||||
);
|
);
|
||||||
}, throwsToolExit());
|
}, throwsToolExit());
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.statusText, contains('Your app isn\'t using AndroidX'));
|
||||||
expect(logger.statusText, contains('Your app isn\'t using AndroidX'));
|
expect(testLogger.statusText, contains(
|
||||||
expect(logger.statusText, contains(
|
|
||||||
'To avoid potential build failures, you can quickly migrate your app by '
|
'To avoid potential build failures, you can quickly migrate your app by '
|
||||||
'following the steps on https://goo.gl/CP92wY'
|
'following the steps on https://goo.gl/CP92wY'
|
||||||
)
|
)
|
||||||
@ -414,10 +412,9 @@ flutter:
|
|||||||
);
|
);
|
||||||
}, throwsToolExit());
|
}, throwsToolExit());
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.statusText.contains('[!] Your app isn\'t using AndroidX'), isFalse);
|
||||||
expect(logger.statusText.contains('[!] Your app isn\'t using AndroidX'), isFalse);
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText.contains(
|
testLogger.statusText.contains(
|
||||||
'To avoid potential build failures, you can quickly migrate your app by '
|
'To avoid potential build failures, you can quickly migrate your app by '
|
||||||
'following the steps on https://goo.gl/CP92wY'
|
'following the steps on https://goo.gl/CP92wY'
|
||||||
),
|
),
|
||||||
|
@ -10,7 +10,6 @@ import 'package:flutter_tools/src/android/android_builder.dart';
|
|||||||
import 'package:flutter_tools/src/android/android_sdk.dart';
|
import 'package:flutter_tools/src/android/android_sdk.dart';
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/build_appbundle.dart';
|
import 'package:flutter_tools/src/commands/build_appbundle.dart';
|
||||||
@ -348,9 +347,8 @@ flutter:
|
|||||||
);
|
);
|
||||||
}, throwsToolExit());
|
}, throwsToolExit());
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.statusText, contains('Your app isn\'t using AndroidX'));
|
||||||
expect(logger.statusText, contains('Your app isn\'t using AndroidX'));
|
expect(testLogger.statusText, contains(
|
||||||
expect(logger.statusText, contains(
|
|
||||||
'To avoid potential build failures, you can quickly migrate your app by '
|
'To avoid potential build failures, you can quickly migrate your app by '
|
||||||
'following the steps on https://goo.gl/CP92wY'
|
'following the steps on https://goo.gl/CP92wY'
|
||||||
)
|
)
|
||||||
@ -400,10 +398,9 @@ flutter:
|
|||||||
);
|
);
|
||||||
}, throwsToolExit());
|
}, throwsToolExit());
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.statusText.contains('Your app isn\'t using AndroidX'), isFalse);
|
||||||
expect(logger.statusText.contains('Your app isn\'t using AndroidX'), isFalse);
|
|
||||||
expect(
|
expect(
|
||||||
logger.statusText.contains(
|
testLogger.statusText.contains(
|
||||||
'To avoid potential build failures, you can quickly migrate your app by '
|
'To avoid potential build failures, you can quickly migrate your app by '
|
||||||
'following the steps on https://goo.gl/CP92wY'
|
'following the steps on https://goo.gl/CP92wY'
|
||||||
),
|
),
|
||||||
|
@ -5,13 +5,11 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/base/terminal.dart';
|
import 'package:flutter_tools/src/base/terminal.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/compile.dart';
|
import 'package:flutter_tools/src/compile.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
@ -41,14 +39,13 @@ void main() {
|
|||||||
when(mockProcessManager.canRun(any)).thenReturn(true);
|
when(mockProcessManager.canRun(any)).thenReturn(true);
|
||||||
when(mockProcessManager.start(any)).thenAnswer(
|
when(mockProcessManager.start(any)).thenAnswer(
|
||||||
(Invocation invocation) {
|
(Invocation invocation) {
|
||||||
latestCommand = invocation.positionalArguments.first;
|
latestCommand = invocation.positionalArguments.first as List<String>;
|
||||||
return Future<Process>.value(mockFrontendServer);
|
return Future<Process>.value(mockFrontendServer);
|
||||||
});
|
});
|
||||||
when(mockFrontendServer.exitCode).thenAnswer((_) async => 0);
|
when(mockFrontendServer.exitCode).thenAnswer((_) async => 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('batch compile single dart successful compilation', () async {
|
testUsingContext('batch compile single dart successful compilation', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
when(mockFrontendServer.stdout)
|
when(mockFrontendServer.stdout)
|
||||||
.thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture(
|
.thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture(
|
||||||
Future<List<int>>.value(utf8.encode(
|
Future<List<int>>.value(utf8.encode(
|
||||||
@ -64,7 +61,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
||||||
expect(bufferLogger.errorText, equals('\nCompiler message:\nline1\nline2\n'));
|
expect(testLogger.errorText, equals('\nCompiler message:\nline1\nline2\n'));
|
||||||
expect(output.outputFilename, equals('/path/to/main.dart.dill'));
|
expect(output.outputFilename, equals('/path/to/main.dart.dill'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => mockProcessManager,
|
ProcessManager: () => mockProcessManager,
|
||||||
@ -136,7 +133,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('batch compile single dart failed compilation', () async {
|
testUsingContext('batch compile single dart failed compilation', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
when(mockFrontendServer.stdout)
|
when(mockFrontendServer.stdout)
|
||||||
.thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture(
|
.thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture(
|
||||||
Future<List<int>>.value(utf8.encode(
|
Future<List<int>>.value(utf8.encode(
|
||||||
@ -152,7 +148,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
||||||
expect(bufferLogger.errorText, equals('\nCompiler message:\nline1\nline2\n'));
|
expect(testLogger.errorText, equals('\nCompiler message:\nline1\nline2\n'));
|
||||||
expect(output, equals(null));
|
expect(output, equals(null));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => mockProcessManager,
|
ProcessManager: () => mockProcessManager,
|
||||||
@ -162,7 +158,6 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('batch compile single dart abnormal compiler termination', () async {
|
testUsingContext('batch compile single dart abnormal compiler termination', () async {
|
||||||
when(mockFrontendServer.exitCode).thenAnswer((_) async => 255);
|
when(mockFrontendServer.exitCode).thenAnswer((_) async => 255);
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
|
|
||||||
when(mockFrontendServer.stdout)
|
when(mockFrontendServer.stdout)
|
||||||
.thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture(
|
.thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture(
|
||||||
@ -179,7 +174,7 @@ void main() {
|
|||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
);
|
);
|
||||||
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
||||||
expect(bufferLogger.errorText, equals('\nCompiler message:\nline1\nline2\n'));
|
expect(testLogger.errorText, equals('\nCompiler message:\nline1\nline2\n'));
|
||||||
expect(output, equals(null));
|
expect(output, equals(null));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => mockProcessManager,
|
ProcessManager: () => mockProcessManager,
|
||||||
|
@ -12,7 +12,6 @@ import 'package:flutter_tools/src/base/terminal.dart';
|
|||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/compile.dart';
|
import 'package:flutter_tools/src/compile.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
@ -59,8 +58,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('compile expression can compile single expression', () async {
|
testUsingContext('compile expression can compile single expression', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
|
|
||||||
final Completer<List<int>> compileResponseCompleter =
|
final Completer<List<int>> compileResponseCompleter =
|
||||||
Completer<List<int>>();
|
Completer<List<int>>();
|
||||||
final Completer<List<int>> compileExpressionResponseCompleter =
|
final Completer<List<int>> compileExpressionResponseCompleter =
|
||||||
@ -85,7 +82,7 @@ void main() {
|
|||||||
expect(mockFrontendServerStdIn.getAndClear(),
|
expect(mockFrontendServerStdIn.getAndClear(),
|
||||||
'compile /path/to/main.dart\n');
|
'compile /path/to/main.dart\n');
|
||||||
verifyNoMoreInteractions(mockFrontendServerStdIn);
|
verifyNoMoreInteractions(mockFrontendServerStdIn);
|
||||||
expect(bufferLogger.errorText,
|
expect(testLogger.errorText,
|
||||||
equals('\nCompiler message:\nline1\nline2\n'));
|
equals('\nCompiler message:\nline1\nline2\n'));
|
||||||
expect(output.outputFilename, equals('/path/to/main.dart.dill'));
|
expect(output.outputFilename, equals('/path/to/main.dart.dill'));
|
||||||
|
|
||||||
@ -111,7 +108,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('compile expressions without awaiting', () async {
|
testUsingContext('compile expressions without awaiting', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final Completer<List<int>> compileResponseCompleter = Completer<List<int>>();
|
final Completer<List<int>> compileResponseCompleter = Completer<List<int>>();
|
||||||
final Completer<List<int>> compileExpressionResponseCompleter1 = Completer<List<int>>();
|
final Completer<List<int>> compileExpressionResponseCompleter1 = Completer<List<int>>();
|
||||||
final Completer<List<int>> compileExpressionResponseCompleter2 = Completer<List<int>>();
|
final Completer<List<int>> compileExpressionResponseCompleter2 = Completer<List<int>>();
|
||||||
@ -132,7 +128,7 @@ void main() {
|
|||||||
null, /* invalidatedFiles */
|
null, /* invalidatedFiles */
|
||||||
outputPath: '/build/',
|
outputPath: '/build/',
|
||||||
).then((CompilerOutput outputCompile) {
|
).then((CompilerOutput outputCompile) {
|
||||||
expect(bufferLogger.errorText,
|
expect(testLogger.errorText,
|
||||||
equals('\nCompiler message:\nline1\nline2\n'));
|
equals('\nCompiler message:\nline1\nline2\n'));
|
||||||
expect(outputCompile.outputFilename, equals('/path/to/main.dart.dill'));
|
expect(outputCompile.outputFilename, equals('/path/to/main.dart.dill'));
|
||||||
|
|
||||||
|
@ -7,13 +7,11 @@ import 'dart:async';
|
|||||||
import 'package:flutter_tools/src/base/async_guard.dart';
|
import 'package:flutter_tools/src/base/async_guard.dart';
|
||||||
import 'package:flutter_tools/src/base/common.dart';
|
import 'package:flutter_tools/src/base/common.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/base/terminal.dart';
|
import 'package:flutter_tools/src/base/terminal.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/compile.dart';
|
import 'package:flutter_tools/src/compile.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
@ -53,8 +51,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('incremental compile single dart compile', () async {
|
testUsingContext('incremental compile single dart compile', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
|
|
||||||
when(mockFrontendServer.stdout)
|
when(mockFrontendServer.stdout)
|
||||||
.thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture(
|
.thenAnswer((Invocation invocation) => Stream<List<int>>.fromFuture(
|
||||||
Future<List<int>>.value(utf8.encode(
|
Future<List<int>>.value(utf8.encode(
|
||||||
@ -69,7 +65,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(mockFrontendServerStdIn.getAndClear(), 'compile /path/to/main.dart\n');
|
expect(mockFrontendServerStdIn.getAndClear(), 'compile /path/to/main.dart\n');
|
||||||
verifyNoMoreInteractions(mockFrontendServerStdIn);
|
verifyNoMoreInteractions(mockFrontendServerStdIn);
|
||||||
expect(bufferLogger.errorText, equals('\nCompiler message:\nline1\nline2\n'));
|
expect(testLogger.errorText, equals('\nCompiler message:\nline1\nline2\n'));
|
||||||
expect(output.outputFilename, equals('/path/to/main.dart.dill'));
|
expect(output.outputFilename, equals('/path/to/main.dart.dill'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => mockProcessManager,
|
ProcessManager: () => mockProcessManager,
|
||||||
@ -112,7 +108,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('incremental compile and recompile', () async {
|
testUsingContext('incremental compile and recompile', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final StreamController<List<int>> streamController = StreamController<List<int>>();
|
final StreamController<List<int>> streamController = StreamController<List<int>>();
|
||||||
when(mockFrontendServer.stdout)
|
when(mockFrontendServer.stdout)
|
||||||
.thenAnswer((Invocation invocation) => streamController.stream);
|
.thenAnswer((Invocation invocation) => streamController.stream);
|
||||||
@ -141,7 +136,7 @@ void main() {
|
|||||||
'^reject\\n\$');
|
'^reject\\n\$');
|
||||||
verifyNoMoreInteractions(mockFrontendServerStdIn);
|
verifyNoMoreInteractions(mockFrontendServerStdIn);
|
||||||
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
||||||
expect(bufferLogger.errorText, equals(
|
expect(testLogger.errorText, equals(
|
||||||
'\nCompiler message:\nline0\nline1\n'
|
'\nCompiler message:\nline0\nline1\n'
|
||||||
'\nCompiler message:\nline1\nline2\n'
|
'\nCompiler message:\nline1\nline2\n'
|
||||||
'\nCompiler message:\nline1\nline2\n'
|
'\nCompiler message:\nline1\nline2\n'
|
||||||
@ -153,8 +148,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('incremental compile and recompile twice', () async {
|
testUsingContext('incremental compile and recompile twice', () async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
|
|
||||||
final StreamController<List<int>> streamController = StreamController<List<int>>();
|
final StreamController<List<int>> streamController = StreamController<List<int>>();
|
||||||
when(mockFrontendServer.stdout)
|
when(mockFrontendServer.stdout)
|
||||||
.thenAnswer((Invocation invocation) => streamController.stream);
|
.thenAnswer((Invocation invocation) => streamController.stream);
|
||||||
@ -171,7 +164,7 @@ void main() {
|
|||||||
|
|
||||||
verifyNoMoreInteractions(mockFrontendServerStdIn);
|
verifyNoMoreInteractions(mockFrontendServerStdIn);
|
||||||
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
||||||
expect(bufferLogger.errorText, equals(
|
expect(testLogger.errorText, equals(
|
||||||
'\nCompiler message:\nline0\nline1\n'
|
'\nCompiler message:\nline0\nline1\n'
|
||||||
'\nCompiler message:\nline1\nline2\n'
|
'\nCompiler message:\nline1\nline2\n'
|
||||||
'\nCompiler message:\nline2\nline3\n'
|
'\nCompiler message:\nline2\nline3\n'
|
||||||
|
@ -11,7 +11,6 @@ import 'package:file/memory.dart';
|
|||||||
import 'package:flutter_tools/runner.dart' as tools;
|
import 'package:flutter_tools/runner.dart' as tools;
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/doctor.dart';
|
import 'package:flutter_tools/src/doctor.dart';
|
||||||
@ -181,8 +180,7 @@ void main() {
|
|||||||
expect(method, null);
|
expect(method, null);
|
||||||
expect(uri, null);
|
expect(uri, null);
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.statusText, '');
|
||||||
expect(logger.statusText, '');
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Stdio: () => const _NoStderr(),
|
Stdio: () => const _NoStderr(),
|
||||||
});
|
});
|
||||||
@ -260,8 +258,7 @@ Future<void> verifyCrashReportSent(RequestInfo crashInfo, {
|
|||||||
expect(crashInfo.fields['error_message'], 'Bad state: Test bad state error');
|
expect(crashInfo.fields['error_message'], 'Bad state: Test bad state error');
|
||||||
expect(crashInfo.fields['comments'], 'crash');
|
expect(crashInfo.fields['comments'], 'crash');
|
||||||
|
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.statusText, 'Sending crash report to Google.\n'
|
||||||
expect(logger.statusText, 'Sending crash report to Google.\n'
|
|
||||||
'Crash report sent (report ID: test-report-id)\n');
|
'Crash report sent (report ID: test-report-id)\n');
|
||||||
|
|
||||||
// Verify that we've written the crash report to disk.
|
// Verify that we've written the crash report to disk.
|
||||||
@ -295,11 +292,11 @@ class MockCrashReportSender extends MockClient {
|
|||||||
})
|
})
|
||||||
.where((List<String> pair) => pair != null),
|
.where((List<String> pair) => pair != null),
|
||||||
key: (dynamic key) {
|
key: (dynamic key) {
|
||||||
final List<String> pair = key;
|
final List<String> pair = key as List<String>;
|
||||||
return pair[0];
|
return pair[0];
|
||||||
},
|
},
|
||||||
value: (dynamic value) {
|
value: (dynamic value) {
|
||||||
final List<String> pair = value;
|
final List<String> pair = value as List<String>;
|
||||||
return pair[1];
|
return pair[1];
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -34,7 +34,7 @@ void main() {
|
|||||||
testUsingContext('pub get 69', () async {
|
testUsingContext('pub get 69', () async {
|
||||||
String error;
|
String error;
|
||||||
|
|
||||||
final MockProcessManager processMock = context.get<ProcessManager>();
|
final MockProcessManager processMock = context.get<ProcessManager>() as MockProcessManager;
|
||||||
|
|
||||||
FakeAsync().run((FakeAsync time) {
|
FakeAsync().run((FakeAsync time) {
|
||||||
expect(processMock.lastPubEnvironment, isNull);
|
expect(processMock.lastPubEnvironment, isNull);
|
||||||
@ -158,7 +158,7 @@ void main() {
|
|||||||
testUsingContext('pub cache in environment is used', () async {
|
testUsingContext('pub cache in environment is used', () async {
|
||||||
String error;
|
String error;
|
||||||
|
|
||||||
final MockProcessManager processMock = context.get<ProcessManager>();
|
final MockProcessManager processMock = context.get<ProcessManager>() as MockProcessManager;
|
||||||
|
|
||||||
FakeAsync().run((FakeAsync time) {
|
FakeAsync().run((FakeAsync time) {
|
||||||
MockDirectory.findCache = true;
|
MockDirectory.findCache = true;
|
||||||
@ -410,7 +410,7 @@ class MockFileSystem extends ForwardingFileSystem {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Directory directory(dynamic path) {
|
Directory directory(dynamic path) {
|
||||||
return MockDirectory(path);
|
return MockDirectory(path as String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,19 +5,17 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/project.dart';
|
|
||||||
import 'package:mockito/mockito.dart';
|
|
||||||
import 'package:process/process.dart';
|
|
||||||
|
|
||||||
import 'package:flutter_tools/src/application_package.dart';
|
import 'package:flutter_tools/src/application_package.dart';
|
||||||
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/os.dart';
|
import 'package:flutter_tools/src/base/os.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/desktop_device.dart';
|
import 'package:flutter_tools/src/desktop_device.dart';
|
||||||
import 'package:flutter_tools/src/device.dart';
|
import 'package:flutter_tools/src/device.dart';
|
||||||
|
import 'package:flutter_tools/src/project.dart';
|
||||||
|
import 'package:mockito/mockito.dart';
|
||||||
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/context.dart';
|
import '../src/context.dart';
|
||||||
@ -171,8 +169,7 @@ void main() {
|
|||||||
final MockAppplicationPackage package = MockAppplicationPackage();
|
final MockAppplicationPackage package = MockAppplicationPackage();
|
||||||
final LaunchResult result = await device.startApp(package, prebuiltApplication: true);
|
final LaunchResult result = await device.startApp(package, prebuiltApplication: true);
|
||||||
expect(result.started, false);
|
expect(result.started, false);
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.errorText, contains('Unable to find executable to run'));
|
||||||
expect(logger.errorText, contains('Unable to find executable to run'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('stopApp kills process started by startApp', () async {
|
testUsingContext('stopApp kills process started by startApp', () async {
|
||||||
|
@ -129,7 +129,7 @@ void main() {
|
|||||||
when(mockXcode.xcodeSelectPath).thenReturn('/fake/Xcode.app/Contents/Developer');
|
when(mockXcode.xcodeSelectPath).thenReturn('/fake/Xcode.app/Contents/Developer');
|
||||||
when(mockXcode.getSimulatorPath()).thenAnswer((_) => '/fake/simulator.app');
|
when(mockXcode.getSimulatorPath()).thenAnswer((_) => '/fake/simulator.app');
|
||||||
when(mockProcessManager.run(any)).thenAnswer((Invocation invocation) async {
|
when(mockProcessManager.run(any)).thenAnswer((Invocation invocation) async {
|
||||||
final List<String> args = invocation.positionalArguments[0];
|
final List<String> args = invocation.positionalArguments[0] as List<String>;
|
||||||
if (args.length >= 3 && args[0] == 'open' && args[1] == '-a' && args[2] == '/fake/simulator.app') {
|
if (args.length >= 3 && args[0] == 'open' && args[1] == '-a' && args[2] == '/fake/simulator.app') {
|
||||||
didAttemptToRunSimulator = true;
|
didAttemptToRunSimulator = true;
|
||||||
}
|
}
|
||||||
@ -206,9 +206,9 @@ class MockProcessManager extends Mock implements ProcessManager {
|
|||||||
Encoding stdoutEncoding = systemEncoding,
|
Encoding stdoutEncoding = systemEncoding,
|
||||||
Encoding stderrEncoding = systemEncoding,
|
Encoding stderrEncoding = systemEncoding,
|
||||||
}) {
|
}) {
|
||||||
final String program = command[0];
|
final String program = command[0] as String;
|
||||||
final List<String> args = command.sublist(1);
|
final List<String> args = command.sublist(1) as List<String>;
|
||||||
switch (command[0]) {
|
switch (program) {
|
||||||
case '/usr/bin/xcode-select':
|
case '/usr/bin/xcode-select':
|
||||||
throw ProcessException(program, args);
|
throw ProcessException(program, args);
|
||||||
break;
|
break;
|
||||||
|
@ -22,7 +22,7 @@ void main() {
|
|||||||
mockFlutterVerion = MockFlutterVerion();
|
mockFlutterVerion = MockFlutterVerion();
|
||||||
mockFlutterConfig = MockFlutterConfig();
|
mockFlutterConfig = MockFlutterConfig();
|
||||||
mockPlatform = MockPlatform();
|
mockPlatform = MockPlatform();
|
||||||
when<bool>(mockFlutterConfig.getValue(any)).thenReturn(false);
|
when<bool>(mockFlutterConfig.getValue(any) as bool).thenReturn(false);
|
||||||
when(mockPlatform.environment).thenReturn(const <String, String>{});
|
when(mockPlatform.environment).thenReturn(const <String, String>{});
|
||||||
testbed = Testbed(overrides: <Type, Generator>{
|
testbed = Testbed(overrides: <Type, Generator>{
|
||||||
FlutterVersion: () => mockFlutterVerion,
|
FlutterVersion: () => mockFlutterVerion,
|
||||||
@ -117,7 +117,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter web enabled with config on master', () => testbed.run(() {
|
test('flutter web enabled with config on master', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('master');
|
when(mockFlutterVerion.channel).thenReturn('master');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-web')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-web') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isWebEnabled, true);
|
expect(featureFlags.isWebEnabled, true);
|
||||||
}));
|
}));
|
||||||
@ -137,7 +137,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter web enabled with config on dev', () => testbed.run(() {
|
test('flutter web enabled with config on dev', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('dev');
|
when(mockFlutterVerion.channel).thenReturn('dev');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-web')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-web') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isWebEnabled, true);
|
expect(featureFlags.isWebEnabled, true);
|
||||||
}));
|
}));
|
||||||
@ -157,7 +157,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter web not enabled with config on beta', () => testbed.run(() {
|
test('flutter web not enabled with config on beta', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('beta');
|
when(mockFlutterVerion.channel).thenReturn('beta');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-web')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-web') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isWebEnabled, false);
|
expect(featureFlags.isWebEnabled, false);
|
||||||
}));
|
}));
|
||||||
@ -177,7 +177,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter web not enabled with config on stable', () => testbed.run(() {
|
test('flutter web not enabled with config on stable', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('stable');
|
when(mockFlutterVerion.channel).thenReturn('stable');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-web')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-web') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isWebEnabled, false);
|
expect(featureFlags.isWebEnabled, false);
|
||||||
}));
|
}));
|
||||||
@ -199,7 +199,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter macos desktop enabled with config on master', () => testbed.run(() {
|
test('flutter macos desktop enabled with config on master', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('master');
|
when(mockFlutterVerion.channel).thenReturn('master');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-macos-desktop')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-macos-desktop') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isMacOSEnabled, true);
|
expect(featureFlags.isMacOSEnabled, true);
|
||||||
}));
|
}));
|
||||||
@ -219,7 +219,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter macos desktop not enabled with config on dev', () => testbed.run(() {
|
test('flutter macos desktop not enabled with config on dev', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('dev');
|
when(mockFlutterVerion.channel).thenReturn('dev');
|
||||||
when<bool>(mockFlutterConfig.getValue('flutter-desktop-macos')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('flutter-desktop-macos') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isMacOSEnabled, false);
|
expect(featureFlags.isMacOSEnabled, false);
|
||||||
}));
|
}));
|
||||||
@ -239,7 +239,7 @@ void main() {
|
|||||||
|
|
||||||
test('fflutter macos desktop not enabled with config on beta', () => testbed.run(() {
|
test('fflutter macos desktop not enabled with config on beta', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('beta');
|
when(mockFlutterVerion.channel).thenReturn('beta');
|
||||||
when<bool>(mockFlutterConfig.getValue('flutter-desktop-macos')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('flutter-desktop-macos') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isMacOSEnabled, false);
|
expect(featureFlags.isMacOSEnabled, false);
|
||||||
}));
|
}));
|
||||||
@ -259,7 +259,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter macos desktop not enabled with config on stable', () => testbed.run(() {
|
test('flutter macos desktop not enabled with config on stable', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('stable');
|
when(mockFlutterVerion.channel).thenReturn('stable');
|
||||||
when<bool>(mockFlutterConfig.getValue('flutter-desktop-macos')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('flutter-desktop-macos') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isMacOSEnabled, false);
|
expect(featureFlags.isMacOSEnabled, false);
|
||||||
}));
|
}));
|
||||||
@ -280,7 +280,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter linux desktop enabled with config on master', () => testbed.run(() {
|
test('flutter linux desktop enabled with config on master', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('master');
|
when(mockFlutterVerion.channel).thenReturn('master');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-linux-desktop')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-linux-desktop') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isLinuxEnabled, true);
|
expect(featureFlags.isLinuxEnabled, true);
|
||||||
}));
|
}));
|
||||||
@ -300,7 +300,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter linux desktop not enabled with config on dev', () => testbed.run(() {
|
test('flutter linux desktop not enabled with config on dev', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('dev');
|
when(mockFlutterVerion.channel).thenReturn('dev');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-linux-desktop')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-linux-desktop') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isLinuxEnabled, false);
|
expect(featureFlags.isLinuxEnabled, false);
|
||||||
}));
|
}));
|
||||||
@ -320,7 +320,7 @@ void main() {
|
|||||||
|
|
||||||
test('fflutter linux desktop not enabled with config on beta', () => testbed.run(() {
|
test('fflutter linux desktop not enabled with config on beta', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('beta');
|
when(mockFlutterVerion.channel).thenReturn('beta');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-linux-desktop')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-linux-desktop') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isLinuxEnabled, false);
|
expect(featureFlags.isLinuxEnabled, false);
|
||||||
}));
|
}));
|
||||||
@ -340,7 +340,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter linux desktop not enabled with config on stable', () => testbed.run(() {
|
test('flutter linux desktop not enabled with config on stable', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('stable');
|
when(mockFlutterVerion.channel).thenReturn('stable');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-linux-desktop')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-linux-desktop') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isLinuxEnabled, false);
|
expect(featureFlags.isLinuxEnabled, false);
|
||||||
}));
|
}));
|
||||||
@ -361,7 +361,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter windows desktop enabled with config on master', () => testbed.run(() {
|
test('flutter windows desktop enabled with config on master', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('master');
|
when(mockFlutterVerion.channel).thenReturn('master');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-windows-desktop')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-windows-desktop') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isWindowsEnabled, true);
|
expect(featureFlags.isWindowsEnabled, true);
|
||||||
}));
|
}));
|
||||||
@ -381,7 +381,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter windows desktop not enabled with config on dev', () => testbed.run(() {
|
test('flutter windows desktop not enabled with config on dev', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('dev');
|
when(mockFlutterVerion.channel).thenReturn('dev');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-windows-desktop')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-windows-desktop') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isWindowsEnabled, false);
|
expect(featureFlags.isWindowsEnabled, false);
|
||||||
}));
|
}));
|
||||||
@ -401,7 +401,7 @@ void main() {
|
|||||||
|
|
||||||
test('fflutter windows desktop not enabled with config on beta', () => testbed.run(() {
|
test('fflutter windows desktop not enabled with config on beta', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('beta');
|
when(mockFlutterVerion.channel).thenReturn('beta');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-windows-desktop')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-windows-desktop') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isWindowsEnabled, false);
|
expect(featureFlags.isWindowsEnabled, false);
|
||||||
}));
|
}));
|
||||||
@ -421,7 +421,7 @@ void main() {
|
|||||||
|
|
||||||
test('flutter windows desktop not enabled with config on stable', () => testbed.run(() {
|
test('flutter windows desktop not enabled with config on stable', () => testbed.run(() {
|
||||||
when(mockFlutterVerion.channel).thenReturn('stable');
|
when(mockFlutterVerion.channel).thenReturn('stable');
|
||||||
when<bool>(mockFlutterConfig.getValue('enable-windows-desktop')).thenReturn(true);
|
when<bool>(mockFlutterConfig.getValue('enable-windows-desktop') as bool).thenReturn(true);
|
||||||
|
|
||||||
expect(featureFlags.isWindowsEnabled, false);
|
expect(featureFlags.isWindowsEnabled, false);
|
||||||
}));
|
}));
|
||||||
|
@ -8,7 +8,6 @@ import 'package:file/file.dart';
|
|||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/flutter_manifest.dart';
|
import 'package:flutter_tools/src/flutter_manifest.dart';
|
||||||
|
|
||||||
@ -401,7 +400,6 @@ flutter:
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('handles an invalid plugin declaration', () async {
|
testUsingContext('handles an invalid plugin declaration', () async {
|
||||||
final BufferLogger bufferLogger = context.get<Logger>();
|
|
||||||
const String manifest = '''
|
const String manifest = '''
|
||||||
name: test
|
name: test
|
||||||
flutter:
|
flutter:
|
||||||
@ -409,7 +407,7 @@ flutter:
|
|||||||
''';
|
''';
|
||||||
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
||||||
expect(flutterManifest, null);
|
expect(flutterManifest, null);
|
||||||
expect(bufferLogger.errorText, contains('Expected "plugin" to be an object, but got null'));
|
expect(testLogger.errorText, contains('Expected "plugin" to be an object, but got null'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -528,7 +526,6 @@ flutter:
|
|||||||
|
|
||||||
// Regression test for https://github.com/flutter/flutter/issues/31764
|
// Regression test for https://github.com/flutter/flutter/issues/31764
|
||||||
testUsingContext('Returns proper error when font detail is malformed', () async {
|
testUsingContext('Returns proper error when font detail is malformed', () async {
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
const String manifest = '''
|
const String manifest = '''
|
||||||
name: test
|
name: test
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -543,11 +540,10 @@ flutter:
|
|||||||
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
||||||
|
|
||||||
expect(flutterManifest, null);
|
expect(flutterManifest, null);
|
||||||
expect(logger.errorText, contains('Expected "fonts" to either be null or a list.'));
|
expect(testLogger.errorText, contains('Expected "fonts" to either be null or a list.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Returns proper error when font detail is not a list of maps', () async {
|
testUsingContext('Returns proper error when font detail is not a list of maps', () async {
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
const String manifest = '''
|
const String manifest = '''
|
||||||
name: test
|
name: test
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -562,11 +558,10 @@ flutter:
|
|||||||
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
||||||
|
|
||||||
expect(flutterManifest, null);
|
expect(flutterManifest, null);
|
||||||
expect(logger.errorText, contains('Expected "fonts" to be a list of maps.'));
|
expect(testLogger.errorText, contains('Expected "fonts" to be a list of maps.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Returns proper error when font is a map instead of a list', () async {
|
testUsingContext('Returns proper error when font is a map instead of a list', () async {
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
const String manifest = '''
|
const String manifest = '''
|
||||||
name: test
|
name: test
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -581,11 +576,10 @@ flutter:
|
|||||||
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
||||||
|
|
||||||
expect(flutterManifest, null);
|
expect(flutterManifest, null);
|
||||||
expect(logger.errorText, contains('Expected "fonts" to be a list'));
|
expect(testLogger.errorText, contains('Expected "fonts" to be a list'));
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Returns proper error when second font family is invalid', () async {
|
testUsingContext('Returns proper error when second font family is invalid', () async {
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
const String manifest = '''
|
const String manifest = '''
|
||||||
name: test
|
name: test
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -601,11 +595,10 @@ flutter:
|
|||||||
''';
|
''';
|
||||||
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
||||||
expect(flutterManifest, null);
|
expect(flutterManifest, null);
|
||||||
expect(logger.errorText, contains('Expected a map.'));
|
expect(testLogger.errorText, contains('Expected a map.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Does not crash on empty entry', () async {
|
testUsingContext('Does not crash on empty entry', () async {
|
||||||
final BufferLogger logger = context.get<Logger>();
|
|
||||||
const String manifest = '''
|
const String manifest = '''
|
||||||
name: test
|
name: test
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -620,7 +613,7 @@ flutter:
|
|||||||
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
final FlutterManifest flutterManifest = FlutterManifest.createFromString(manifest);
|
||||||
final List<Uri> assets = flutterManifest.assets;
|
final List<Uri> assets = flutterManifest.assets;
|
||||||
|
|
||||||
expect(logger.errorText, contains('Asset manifest contains a null or empty uri.'));
|
expect(testLogger.errorText, contains('Asset manifest contains a null or empty uri.'));
|
||||||
expect(assets.length, 1);
|
expect(assets.length, 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -51,7 +51,7 @@ void main() {
|
|||||||
final VerificationResult toVerify = verify(mockProcessManager.start(any, environment: captureAnyNamed('environment')));
|
final VerificationResult toVerify = verify(mockProcessManager.start(any, environment: captureAnyNamed('environment')));
|
||||||
expect(toVerify.captured, hasLength(1));
|
expect(toVerify.captured, hasLength(1));
|
||||||
expect(toVerify.captured.first, isInstanceOf<Map<String, String>>());
|
expect(toVerify.captured.first, isInstanceOf<Map<String, String>>());
|
||||||
return toVerify.captured.first;
|
return toVerify.captured.first as Map<String, String>;
|
||||||
}
|
}
|
||||||
|
|
||||||
testUsingContext('as true when not originally set', () async {
|
testUsingContext('as true when not originally set', () async {
|
||||||
|
@ -135,4 +135,4 @@ void main() {
|
|||||||
|
|
||||||
bool _isDartFile(FileSystemEntity entity) => entity is File && entity.path.endsWith('.dart');
|
bool _isDartFile(FileSystemEntity entity) => entity is File && entity.path.endsWith('.dart');
|
||||||
|
|
||||||
File _asFile(FileSystemEntity entity) => entity;
|
File _asFile(FileSystemEntity entity) => entity as File;
|
||||||
|
@ -147,8 +147,8 @@ void main() {
|
|||||||
)).thenAnswer((Invocation invocation) =>
|
)).thenAnswer((Invocation invocation) =>
|
||||||
Future<ProcessResult>.value(mockProcessResult));
|
Future<ProcessResult>.value(mockProcessResult));
|
||||||
when(mockProcessResult.exitCode).thenReturn(1);
|
when(mockProcessResult.exitCode).thenReturn(1);
|
||||||
when<String>(mockProcessResult.stdout).thenReturn('');
|
when<String>(mockProcessResult.stdout as String).thenReturn('');
|
||||||
when<String>(mockProcessResult.stderr).thenReturn('');
|
when<String>(mockProcessResult.stderr as String).thenReturn('');
|
||||||
when(mockFile.absolute).thenReturn(mockFile);
|
when(mockFile.absolute).thenReturn(mockFile);
|
||||||
when(mockFile.path).thenReturn('');
|
when(mockFile.path).thenReturn('');
|
||||||
|
|
||||||
@ -161,8 +161,8 @@ void main() {
|
|||||||
)).thenAnswer((Invocation invocation) =>
|
)).thenAnswer((Invocation invocation) =>
|
||||||
Future<ProcessResult>.value(emptyStdoutProcessResult));
|
Future<ProcessResult>.value(emptyStdoutProcessResult));
|
||||||
when(emptyStdoutProcessResult.exitCode).thenReturn(0);
|
when(emptyStdoutProcessResult.exitCode).thenReturn(0);
|
||||||
when<String>(emptyStdoutProcessResult.stdout).thenReturn('');
|
when<String>(emptyStdoutProcessResult.stdout as String).thenReturn('');
|
||||||
when<String>(emptyStdoutProcessResult.stderr).thenReturn('');
|
when<String>(emptyStdoutProcessResult.stderr as String).thenReturn('');
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('No vmservices found', () async {
|
testUsingContext('No vmservices found', () async {
|
||||||
@ -327,7 +327,7 @@ void main() {
|
|||||||
when(vmService.vm).thenReturn(vm);
|
when(vmService.vm).thenReturn(vm);
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<Uri> findUri(List<MockFlutterView> views, String expectedIsolateName) {
|
Future<Uri> findUri(List<MockFlutterView> views, String expectedIsolateName) async {
|
||||||
when(vm.views).thenReturn(views);
|
when(vm.views).thenReturn(views);
|
||||||
for (MockFlutterView view in views) {
|
for (MockFlutterView view in views) {
|
||||||
when(view.owner).thenReturn(vm);
|
when(view.owner).thenReturn(vm);
|
||||||
@ -350,7 +350,7 @@ void main() {
|
|||||||
when(vmService.refreshViews())
|
when(vmService.refreshViews())
|
||||||
.thenAnswer((Invocation invocation) => Future<void>.value(null));
|
.thenAnswer((Invocation invocation) => Future<void>.value(null));
|
||||||
when(vmService.httpAddress).thenReturn(Uri.parse('example'));
|
when(vmService.httpAddress).thenReturn(Uri.parse('example'));
|
||||||
return discoveryProtocol.uri;
|
return await discoveryProtocol.uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
testUsingContext('can find flutter view with matching isolate name', () async {
|
testUsingContext('can find flutter view with matching isolate name', () async {
|
||||||
@ -659,24 +659,24 @@ void main() {
|
|||||||
when(mockSuccessProcessManager.run(any)).thenAnswer(
|
when(mockSuccessProcessManager.run(any)).thenAnswer(
|
||||||
(Invocation invocation) => Future<ProcessResult>.value(mockSuccessProcessResult));
|
(Invocation invocation) => Future<ProcessResult>.value(mockSuccessProcessResult));
|
||||||
when(mockSuccessProcessResult.exitCode).thenReturn(0);
|
when(mockSuccessProcessResult.exitCode).thenReturn(0);
|
||||||
when<String>(mockSuccessProcessResult.stdout).thenReturn('version');
|
when<String>(mockSuccessProcessResult.stdout as String).thenReturn('version');
|
||||||
when<String>(mockSuccessProcessResult.stderr).thenReturn('');
|
when<String>(mockSuccessProcessResult.stderr as String).thenReturn('');
|
||||||
|
|
||||||
mockFailureProcessManager = MockProcessManager();
|
mockFailureProcessManager = MockProcessManager();
|
||||||
mockFailureProcessResult = MockProcessResult();
|
mockFailureProcessResult = MockProcessResult();
|
||||||
when(mockFailureProcessManager.run(any)).thenAnswer(
|
when(mockFailureProcessManager.run(any)).thenAnswer(
|
||||||
(Invocation invocation) => Future<ProcessResult>.value(mockFailureProcessResult));
|
(Invocation invocation) => Future<ProcessResult>.value(mockFailureProcessResult));
|
||||||
when(mockFailureProcessResult.exitCode).thenReturn(1);
|
when(mockFailureProcessResult.exitCode).thenReturn(1);
|
||||||
when<String>(mockFailureProcessResult.stdout).thenReturn('');
|
when<String>(mockFailureProcessResult.stdout as String).thenReturn('');
|
||||||
when<String>(mockFailureProcessResult.stderr).thenReturn('');
|
when<String>(mockFailureProcessResult.stderr as String).thenReturn('');
|
||||||
|
|
||||||
emptyStdoutProcessManager = MockProcessManager();
|
emptyStdoutProcessManager = MockProcessManager();
|
||||||
emptyStdoutProcessResult = MockProcessResult();
|
emptyStdoutProcessResult = MockProcessResult();
|
||||||
when(emptyStdoutProcessManager.run(any)).thenAnswer((Invocation invocation) =>
|
when(emptyStdoutProcessManager.run(any)).thenAnswer((Invocation invocation) =>
|
||||||
Future<ProcessResult>.value(emptyStdoutProcessResult));
|
Future<ProcessResult>.value(emptyStdoutProcessResult));
|
||||||
when(emptyStdoutProcessResult.exitCode).thenReturn(0);
|
when(emptyStdoutProcessResult.exitCode).thenReturn(0);
|
||||||
when<String>(emptyStdoutProcessResult.stdout).thenReturn('');
|
when<String>(emptyStdoutProcessResult.stdout as String).thenReturn('');
|
||||||
when<String>(emptyStdoutProcessResult.stderr).thenReturn('');
|
when<String>(emptyStdoutProcessResult.stderr as String).thenReturn('');
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('returns what we get from the device on success', () async {
|
testUsingContext('returns what we get from the device on success', () async {
|
||||||
|
@ -455,7 +455,7 @@ void main() {
|
|||||||
));
|
));
|
||||||
when(mockOpenSslProcess.stderr).thenAnswer((Invocation invocation) => mockOpenSslStdErr);
|
when(mockOpenSslProcess.stderr).thenAnswer((Invocation invocation) => mockOpenSslStdErr);
|
||||||
when(mockOpenSslProcess.exitCode).thenAnswer((_) => Future<int>.value(0));
|
when(mockOpenSslProcess.exitCode).thenAnswer((_) => Future<int>.value(0));
|
||||||
when<String>(mockConfig.getValue('ios-signing-cert')).thenReturn('iPhone Developer: Profile 3 (3333CCCC33)');
|
when<String>(mockConfig.getValue('ios-signing-cert') as String).thenReturn('iPhone Developer: Profile 3 (3333CCCC33)');
|
||||||
|
|
||||||
final Map<String, String> signingConfigs = await getCodeSigningIdentityDevelopmentTeam(iosApp: app);
|
final Map<String, String> signingConfigs = await getCodeSigningIdentityDevelopmentTeam(iosApp: app);
|
||||||
|
|
||||||
@ -535,7 +535,7 @@ void main() {
|
|||||||
));
|
));
|
||||||
when(mockOpenSslProcess.stderr).thenAnswer((Invocation invocation) => mockOpenSslStdErr);
|
when(mockOpenSslProcess.stderr).thenAnswer((Invocation invocation) => mockOpenSslStdErr);
|
||||||
when(mockOpenSslProcess.exitCode).thenAnswer((_) => Future<int>.value(0));
|
when(mockOpenSslProcess.exitCode).thenAnswer((_) => Future<int>.value(0));
|
||||||
when<String>(mockConfig.getValue('ios-signing-cert')).thenReturn('iPhone Developer: Invalid Profile');
|
when<String>(mockConfig.getValue('ios-signing-cert') as String).thenReturn('iPhone Developer: Invalid Profile');
|
||||||
|
|
||||||
final Map<String, String> signingConfigs = await getCodeSigningIdentityDevelopmentTeam(iosApp: app);
|
final Map<String, String> signingConfigs = await getCodeSigningIdentityDevelopmentTeam(iosApp: app);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ void main() {
|
|||||||
|
|
||||||
IOSDeviceLogReader createLogReader(
|
IOSDeviceLogReader createLogReader(
|
||||||
IOSDevice device,
|
IOSDevice device,
|
||||||
ApplicationPackage appPackage,
|
IOSApp appPackage,
|
||||||
Process process) {
|
Process process) {
|
||||||
final IOSDeviceLogReader logReader = IOSDeviceLogReader(device, appPackage);
|
final IOSDeviceLogReader logReader = IOSDeviceLogReader(device, appPackage);
|
||||||
logReader.idevicesyslogProcess = process;
|
logReader.idevicesyslogProcess = process;
|
||||||
@ -436,7 +436,7 @@ void main() {
|
|||||||
bundlePath: anyNamed('bundlePath'),
|
bundlePath: anyNamed('bundlePath'),
|
||||||
launchArguments: anyNamed('launchArguments'),
|
launchArguments: anyNamed('launchArguments'),
|
||||||
)).thenAnswer((Invocation inv) {
|
)).thenAnswer((Invocation inv) {
|
||||||
args = inv.namedArguments[const Symbol('launchArguments')];
|
args = inv.namedArguments[const Symbol('launchArguments')] as List<String>;
|
||||||
return Future<int>.value(0);
|
return Future<int>.value(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ void main() {
|
|||||||
await simulator.sideloadUpdatedAssetsForInstalledApplicationBundle(BuildInfo.debug, 'lib/main.dart');
|
await simulator.sideloadUpdatedAssetsForInstalledApplicationBundle(BuildInfo.debug, 'lib/main.dart');
|
||||||
|
|
||||||
final VerificationResult result = verify(buildSystem.build(any, captureAny));
|
final VerificationResult result = verify(buildSystem.build(any, captureAny));
|
||||||
final Environment environment = result.captured.single;
|
final Environment environment = result.captured.single as Environment;
|
||||||
expect(environment.defines, <String, String>{
|
expect(environment.defines, <String, String>{
|
||||||
kTargetFile: 'lib/main.dart',
|
kTargetFile: 'lib/main.dart',
|
||||||
kTargetPlatform: 'ios',
|
kTargetPlatform: 'ios',
|
||||||
|
@ -722,7 +722,7 @@ flutter:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform fakePlatform(String name) {
|
FakePlatform fakePlatform(String name) {
|
||||||
return FakePlatform.fromPlatform(const LocalPlatform())..operatingSystem = name;
|
return FakePlatform.fromPlatform(const LocalPlatform())..operatingSystem = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/compile.dart';
|
import 'package:flutter_tools/src/compile.dart';
|
||||||
import 'package:flutter_tools/src/convert.dart';
|
import 'package:flutter_tools/src/convert.dart';
|
||||||
@ -31,7 +33,7 @@ void main() {
|
|||||||
mockFile = MockFile();
|
mockFile = MockFile();
|
||||||
when(mockFileSystem.path).thenReturn(fs.path);
|
when(mockFileSystem.path).thenReturn(fs.path);
|
||||||
when(mockFileSystem.file(any)).thenReturn(mockFile);
|
when(mockFileSystem.file(any)).thenReturn(mockFile);
|
||||||
when(mockFile.readAsBytesSync()).thenReturn(utf8.encode(packagesContents));
|
when(mockFile.readAsBytesSync()).thenReturn(utf8.encode(packagesContents) as Uint8List);
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Can map main.dart to correct package', () async {
|
testUsingContext('Can map main.dart to correct package', () async {
|
||||||
@ -66,7 +68,7 @@ void main() {
|
|||||||
when(mockFileSystem.path).thenReturn(fs.path);
|
when(mockFileSystem.path).thenReturn(fs.path);
|
||||||
when(mockFileSystem.file(any)).thenReturn(mockFile);
|
when(mockFileSystem.file(any)).thenReturn(mockFile);
|
||||||
when(mockFile.readAsBytesSync())
|
when(mockFile.readAsBytesSync())
|
||||||
.thenReturn(utf8.encode(multiRootPackagesContents));
|
.thenReturn(utf8.encode(multiRootPackagesContents) as Uint8List);
|
||||||
final PackageUriMapper packageUriMapper = PackageUriMapper(
|
final PackageUriMapper packageUriMapper = PackageUriMapper(
|
||||||
'/example/lib/main.dart',
|
'/example/lib/main.dart',
|
||||||
'.packages',
|
'.packages',
|
||||||
|
@ -18,13 +18,13 @@ void main() {
|
|||||||
'iosPrefix: FLT\n'
|
'iosPrefix: FLT\n'
|
||||||
'pluginClass: SamplePlugin\n';
|
'pluginClass: SamplePlugin\n';
|
||||||
|
|
||||||
final dynamic pluginYaml = loadYaml(pluginYamlRaw);
|
final YamlMap pluginYaml = loadYaml(pluginYamlRaw) as YamlMap;
|
||||||
final Plugin plugin =
|
final Plugin plugin =
|
||||||
Plugin.fromYaml(_kTestPluginName, _kTestPluginPath, pluginYaml, const <String>[]);
|
Plugin.fromYaml(_kTestPluginName, _kTestPluginPath, pluginYaml, const <String>[]);
|
||||||
|
|
||||||
final AndroidPlugin androidPlugin =
|
final AndroidPlugin androidPlugin =
|
||||||
plugin.platforms[AndroidPlugin.kConfigKey];
|
plugin.platforms[AndroidPlugin.kConfigKey] as AndroidPlugin;
|
||||||
final IOSPlugin iosPlugin = plugin.platforms[IOSPlugin.kConfigKey];
|
final IOSPlugin iosPlugin = plugin.platforms[IOSPlugin.kConfigKey] as IOSPlugin;
|
||||||
final String androidPluginClass = androidPlugin.pluginClass;
|
final String androidPluginClass = androidPlugin.pluginClass;
|
||||||
final String iosPluginClass = iosPlugin.pluginClass;
|
final String iosPluginClass = iosPlugin.pluginClass;
|
||||||
|
|
||||||
@ -51,20 +51,20 @@ void main() {
|
|||||||
' windows:\n'
|
' windows:\n'
|
||||||
' pluginClass: WinSamplePlugin\n';
|
' pluginClass: WinSamplePlugin\n';
|
||||||
|
|
||||||
final dynamic pluginYaml = loadYaml(pluginYamlRaw);
|
final YamlMap pluginYaml = loadYaml(pluginYamlRaw) as YamlMap;
|
||||||
final Plugin plugin =
|
final Plugin plugin =
|
||||||
Plugin.fromYaml(_kTestPluginName, _kTestPluginPath, pluginYaml, const <String>[]);
|
Plugin.fromYaml(_kTestPluginName, _kTestPluginPath, pluginYaml, const <String>[]);
|
||||||
|
|
||||||
final AndroidPlugin androidPlugin =
|
final AndroidPlugin androidPlugin =
|
||||||
plugin.platforms[AndroidPlugin.kConfigKey];
|
plugin.platforms[AndroidPlugin.kConfigKey] as AndroidPlugin;
|
||||||
final IOSPlugin iosPlugin = plugin.platforms[IOSPlugin.kConfigKey];
|
final IOSPlugin iosPlugin = plugin.platforms[IOSPlugin.kConfigKey] as IOSPlugin;
|
||||||
final LinuxPlugin linuxPlugin =
|
final LinuxPlugin linuxPlugin =
|
||||||
plugin.platforms[LinuxPlugin.kConfigKey];
|
plugin.platforms[LinuxPlugin.kConfigKey] as LinuxPlugin;
|
||||||
final MacOSPlugin macOSPlugin =
|
final MacOSPlugin macOSPlugin =
|
||||||
plugin.platforms[MacOSPlugin.kConfigKey];
|
plugin.platforms[MacOSPlugin.kConfigKey] as MacOSPlugin;
|
||||||
final WebPlugin webPlugin = plugin.platforms[WebPlugin.kConfigKey];
|
final WebPlugin webPlugin = plugin.platforms[WebPlugin.kConfigKey] as WebPlugin;
|
||||||
final WindowsPlugin windowsPlugin =
|
final WindowsPlugin windowsPlugin =
|
||||||
plugin.platforms[WindowsPlugin.kConfigKey];
|
plugin.platforms[WindowsPlugin.kConfigKey] as WindowsPlugin;
|
||||||
final String androidPluginClass = androidPlugin.pluginClass;
|
final String androidPluginClass = androidPlugin.pluginClass;
|
||||||
final String iosPluginClass = iosPlugin.pluginClass;
|
final String iosPluginClass = iosPlugin.pluginClass;
|
||||||
|
|
||||||
@ -100,18 +100,14 @@ void main() {
|
|||||||
|
|
||||||
final dynamic pluginYaml = loadYaml(pluginYamlRaw);
|
final dynamic pluginYaml = loadYaml(pluginYamlRaw);
|
||||||
final Plugin plugin =
|
final Plugin plugin =
|
||||||
Plugin.fromYaml(_kTestPluginName, _kTestPluginPath, pluginYaml, const <String>[]);
|
Plugin.fromYaml(_kTestPluginName, _kTestPluginPath, pluginYaml as YamlMap, const <String>[]);
|
||||||
|
|
||||||
final AndroidPlugin androidPlugin =
|
final AndroidPlugin androidPlugin = plugin.platforms[AndroidPlugin.kConfigKey] as AndroidPlugin;
|
||||||
plugin.platforms[AndroidPlugin.kConfigKey];
|
final IOSPlugin iosPlugin = plugin.platforms[IOSPlugin.kConfigKey] as IOSPlugin;
|
||||||
final IOSPlugin iosPlugin = plugin.platforms[IOSPlugin.kConfigKey];
|
final LinuxPlugin linuxPlugin = plugin.platforms[LinuxPlugin.kConfigKey] as LinuxPlugin;
|
||||||
final LinuxPlugin linuxPlugin =
|
final MacOSPlugin macOSPlugin = plugin.platforms[MacOSPlugin.kConfigKey] as MacOSPlugin;
|
||||||
plugin.platforms[LinuxPlugin.kConfigKey];
|
final WebPlugin webPlugin = plugin.platforms[WebPlugin.kConfigKey] as WebPlugin;
|
||||||
final MacOSPlugin macOSPlugin =
|
final WindowsPlugin windowsPlugin = plugin.platforms[WindowsPlugin.kConfigKey] as WindowsPlugin;
|
||||||
plugin.platforms[MacOSPlugin.kConfigKey];
|
|
||||||
final WebPlugin webPlugin = plugin.platforms[WebPlugin.kConfigKey];
|
|
||||||
final WindowsPlugin windowsPlugin =
|
|
||||||
plugin.platforms[WindowsPlugin.kConfigKey];
|
|
||||||
final String androidPluginClass = androidPlugin.pluginClass;
|
final String androidPluginClass = androidPlugin.pluginClass;
|
||||||
final String iosPluginClass = iosPlugin.pluginClass;
|
final String iosPluginClass = iosPlugin.pluginClass;
|
||||||
|
|
||||||
@ -144,7 +140,7 @@ void main() {
|
|||||||
|
|
||||||
final dynamic pluginYaml = loadYaml(pluginYamlRaw);
|
final dynamic pluginYaml = loadYaml(pluginYamlRaw);
|
||||||
final Plugin plugin =
|
final Plugin plugin =
|
||||||
Plugin.fromYaml(_kTestPluginName, _kTestPluginPath, pluginYaml, const <String>[]);
|
Plugin.fromYaml(_kTestPluginName, _kTestPluginPath, pluginYaml as YamlMap, const <String>[]);
|
||||||
|
|
||||||
expect(plugin.platforms, <String, PluginPlatform> {});
|
expect(plugin.platforms, <String, PluginPlatform> {});
|
||||||
});
|
});
|
||||||
|
@ -10,7 +10,6 @@ import 'package:flutter_tools/src/base/common.dart';
|
|||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart' as io;
|
import 'package:flutter_tools/src/base/io.dart' as io;
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/compile.dart';
|
import 'package:flutter_tools/src/compile.dart';
|
||||||
import 'package:flutter_tools/src/devfs.dart';
|
import 'package:flutter_tools/src/devfs.dart';
|
||||||
@ -330,35 +329,33 @@ void main() {
|
|||||||
when(mockDevice.supportsScreenshot).thenReturn(true);
|
when(mockDevice.supportsScreenshot).thenReturn(true);
|
||||||
|
|
||||||
residentRunner.printHelp(details: true);
|
residentRunner.printHelp(details: true);
|
||||||
final BufferLogger bufferLogger = context.get<Logger>();
|
|
||||||
|
|
||||||
// supports service protocol
|
// supports service protocol
|
||||||
expect(residentRunner.supportsServiceProtocol, true);
|
expect(residentRunner.supportsServiceProtocol, true);
|
||||||
expect(bufferLogger.statusText, contains('"w"'));
|
expect(testLogger.statusText, contains('"w"'));
|
||||||
expect(bufferLogger.statusText, contains('"t"'));
|
expect(testLogger.statusText, contains('"t"'));
|
||||||
expect(bufferLogger.statusText, contains('"P"'));
|
expect(testLogger.statusText, contains('"P"'));
|
||||||
expect(bufferLogger.statusText, contains('"a"'));
|
expect(testLogger.statusText, contains('"a"'));
|
||||||
// isRunningDebug
|
// isRunningDebug
|
||||||
expect(residentRunner.isRunningDebug, true);
|
expect(residentRunner.isRunningDebug, true);
|
||||||
expect(bufferLogger.statusText, contains('"L"'));
|
expect(testLogger.statusText, contains('"L"'));
|
||||||
expect(bufferLogger.statusText, contains('"S"'));
|
expect(testLogger.statusText, contains('"S"'));
|
||||||
expect(bufferLogger.statusText, contains('"U"'));
|
expect(testLogger.statusText, contains('"U"'));
|
||||||
expect(bufferLogger.statusText, contains('"i"'));
|
expect(testLogger.statusText, contains('"i"'));
|
||||||
expect(bufferLogger.statusText, contains('"p"'));
|
expect(testLogger.statusText, contains('"p"'));
|
||||||
expect(bufferLogger.statusText, contains('"o"'));
|
expect(testLogger.statusText, contains('"o"'));
|
||||||
expect(bufferLogger.statusText, contains('"z"'));
|
expect(testLogger.statusText, contains('"z"'));
|
||||||
// screenshot
|
// screenshot
|
||||||
expect(bufferLogger.statusText, contains('"s"'));
|
expect(testLogger.statusText, contains('"s"'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('ResidentRunner can take screenshot on debug device', () => testbed.run(() async {
|
test('ResidentRunner can take screenshot on debug device', () => testbed.run(() async {
|
||||||
when(mockDevice.supportsScreenshot).thenReturn(true);
|
when(mockDevice.supportsScreenshot).thenReturn(true);
|
||||||
when(mockDevice.takeScreenshot(any))
|
when(mockDevice.takeScreenshot(any))
|
||||||
.thenAnswer((Invocation invocation) async {
|
.thenAnswer((Invocation invocation) async {
|
||||||
final File file = invocation.positionalArguments.first;
|
final File file = invocation.positionalArguments.first as File;
|
||||||
file.writeAsBytesSync(List<int>.generate(1024, (int i) => i));
|
file.writeAsBytesSync(List<int>.generate(1024, (int i) => i));
|
||||||
});
|
});
|
||||||
final BufferLogger bufferLogger = context.get<Logger>();
|
|
||||||
|
|
||||||
await residentRunner.screenshot(mockFlutterDevice);
|
await residentRunner.screenshot(mockFlutterDevice);
|
||||||
|
|
||||||
@ -366,37 +363,34 @@ void main() {
|
|||||||
verify(mockIsolate.flutterDebugAllowBanner(false)).called(1);
|
verify(mockIsolate.flutterDebugAllowBanner(false)).called(1);
|
||||||
// Enables debug banner.
|
// Enables debug banner.
|
||||||
verify(mockIsolate.flutterDebugAllowBanner(true)).called(1);
|
verify(mockIsolate.flutterDebugAllowBanner(true)).called(1);
|
||||||
expect(bufferLogger.statusText, contains('1kB'));
|
expect(testLogger.statusText, contains('1kB'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('ResidentRunner bails taking screenshot on debug device if debugAllowBanner throws pre', () => testbed.run(() async {
|
test('ResidentRunner bails taking screenshot on debug device if debugAllowBanner throws pre', () => testbed.run(() async {
|
||||||
when(mockDevice.supportsScreenshot).thenReturn(true);
|
when(mockDevice.supportsScreenshot).thenReturn(true);
|
||||||
when(mockIsolate.flutterDebugAllowBanner(false)).thenThrow(Exception());
|
when(mockIsolate.flutterDebugAllowBanner(false)).thenThrow(Exception());
|
||||||
final BufferLogger bufferLogger = context.get<Logger>();
|
|
||||||
|
|
||||||
await residentRunner.screenshot(mockFlutterDevice);
|
await residentRunner.screenshot(mockFlutterDevice);
|
||||||
|
|
||||||
expect(bufferLogger.errorText, contains('Error'));
|
expect(testLogger.errorText, contains('Error'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('ResidentRunner bails taking screenshot on debug device if debugAllowBanner throws post', () => testbed.run(() async {
|
test('ResidentRunner bails taking screenshot on debug device if debugAllowBanner throws post', () => testbed.run(() async {
|
||||||
when(mockDevice.supportsScreenshot).thenReturn(true);
|
when(mockDevice.supportsScreenshot).thenReturn(true);
|
||||||
when(mockIsolate.flutterDebugAllowBanner(true)).thenThrow(Exception());
|
when(mockIsolate.flutterDebugAllowBanner(true)).thenThrow(Exception());
|
||||||
final BufferLogger bufferLogger = context.get<Logger>();
|
|
||||||
|
|
||||||
await residentRunner.screenshot(mockFlutterDevice);
|
await residentRunner.screenshot(mockFlutterDevice);
|
||||||
|
|
||||||
expect(bufferLogger.errorText, contains('Error'));
|
expect(testLogger.errorText, contains('Error'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('ResidentRunner bails taking screenshot on debug device if takeScreenshot throws', () => testbed.run(() async {
|
test('ResidentRunner bails taking screenshot on debug device if takeScreenshot throws', () => testbed.run(() async {
|
||||||
when(mockDevice.supportsScreenshot).thenReturn(true);
|
when(mockDevice.supportsScreenshot).thenReturn(true);
|
||||||
when(mockDevice.takeScreenshot(any)).thenThrow(Exception());
|
when(mockDevice.takeScreenshot(any)).thenThrow(Exception());
|
||||||
final BufferLogger bufferLogger = context.get<Logger>();
|
|
||||||
|
|
||||||
await residentRunner.screenshot(mockFlutterDevice);
|
await residentRunner.screenshot(mockFlutterDevice);
|
||||||
|
|
||||||
expect(bufferLogger.errorText, contains('Error'));
|
expect(testLogger.errorText, contains('Error'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('ResidentRunner can\'t take screenshot on device without support', () => testbed.run(() {
|
test('ResidentRunner can\'t take screenshot on device without support', () => testbed.run(() {
|
||||||
@ -417,10 +411,9 @@ void main() {
|
|||||||
when(mockDevice.supportsScreenshot).thenReturn(true);
|
when(mockDevice.supportsScreenshot).thenReturn(true);
|
||||||
when(mockDevice.takeScreenshot(any))
|
when(mockDevice.takeScreenshot(any))
|
||||||
.thenAnswer((Invocation invocation) async {
|
.thenAnswer((Invocation invocation) async {
|
||||||
final File file = invocation.positionalArguments.first;
|
final File file = invocation.positionalArguments.first as File;
|
||||||
file.writeAsBytesSync(List<int>.generate(1024, (int i) => i));
|
file.writeAsBytesSync(List<int>.generate(1024, (int i) => i));
|
||||||
});
|
});
|
||||||
final BufferLogger bufferLogger = context.get<Logger>();
|
|
||||||
|
|
||||||
await residentRunner.screenshot(mockFlutterDevice);
|
await residentRunner.screenshot(mockFlutterDevice);
|
||||||
|
|
||||||
@ -428,7 +421,7 @@ void main() {
|
|||||||
verifyNever(mockIsolate.flutterDebugAllowBanner(false));
|
verifyNever(mockIsolate.flutterDebugAllowBanner(false));
|
||||||
// doesn't enable debug banner.
|
// doesn't enable debug banner.
|
||||||
verifyNever(mockIsolate.flutterDebugAllowBanner(true));
|
verifyNever(mockIsolate.flutterDebugAllowBanner(true));
|
||||||
expect(bufferLogger.statusText, contains('1kB'));
|
expect(testLogger.statusText, contains('1kB'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('FlutterDevice will not exit a paused isolate', () => testbed.run(() async {
|
test('FlutterDevice will not exit a paused isolate', () => testbed.run(() async {
|
||||||
@ -560,7 +553,6 @@ void main() {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
test('HotRunner handles failure to write vmservice file', () => testbed.run(() async {
|
test('HotRunner handles failure to write vmservice file', () => testbed.run(() async {
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
fs.file(fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
fs.file(fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
residentRunner = HotRunner(
|
residentRunner = HotRunner(
|
||||||
<FlutterDevice>[
|
<FlutterDevice>[
|
||||||
@ -577,7 +569,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
await residentRunner.run();
|
await residentRunner.run();
|
||||||
|
|
||||||
expect(bufferLogger.errorText, contains('Failed to write vmservice-out-file at foo'));
|
expect(testLogger.errorText, contains('Failed to write vmservice-out-file at foo'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => ThrowingForwardingFileSystem(MemoryFileSystem()),
|
FileSystem: () => ThrowingForwardingFileSystem(MemoryFileSystem()),
|
||||||
}));
|
}));
|
||||||
@ -615,7 +607,7 @@ void main() {
|
|||||||
flutterProject: FlutterProject.current(),
|
flutterProject: FlutterProject.current(),
|
||||||
target: null,
|
target: null,
|
||||||
trackWidgetCreation: true,
|
trackWidgetCreation: true,
|
||||||
)).generator;
|
)).generator as DefaultResidentCompiler;
|
||||||
|
|
||||||
expect(residentCompiler.targetModel, TargetModel.dartdevc);
|
expect(residentCompiler.targetModel, TargetModel.dartdevc);
|
||||||
expect(residentCompiler.sdkRoot,
|
expect(residentCompiler.sdkRoot,
|
||||||
|
@ -42,7 +42,7 @@ void main() {
|
|||||||
ipv6: true,
|
ipv6: true,
|
||||||
stayResident: true,
|
stayResident: true,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
);
|
) as ResidentWebRunner;
|
||||||
},
|
},
|
||||||
overrides: <Type, Generator>{
|
overrides: <Type, Generator>{
|
||||||
WebFsFactory: () => ({
|
WebFsFactory: () => ({
|
||||||
@ -70,7 +70,7 @@ void main() {
|
|||||||
|
|
||||||
test('Can successfully run and connect without vmservice', () => testbed.run(() async {
|
test('Can successfully run and connect without vmservice', () => testbed.run(() async {
|
||||||
_setupMocks();
|
_setupMocks();
|
||||||
final DelegateLogger delegateLogger = logger;
|
final DelegateLogger delegateLogger = logger as DelegateLogger;
|
||||||
final MockStatus mockStatus = MockStatus();
|
final MockStatus mockStatus = MockStatus();
|
||||||
delegateLogger.status = mockStatus;
|
delegateLogger.status = mockStatus;
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
|
@ -12,6 +12,8 @@ import 'package:flutter_tools/src/base/file_system.dart';
|
|||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
|
import 'package:flutter_tools/src/build_runner/resident_web_runner.dart';
|
||||||
|
import 'package:flutter_tools/src/build_runner/web_fs.dart';
|
||||||
import 'package:flutter_tools/src/compile.dart';
|
import 'package:flutter_tools/src/compile.dart';
|
||||||
import 'package:flutter_tools/src/devfs.dart';
|
import 'package:flutter_tools/src/devfs.dart';
|
||||||
import 'package:flutter_tools/src/device.dart';
|
import 'package:flutter_tools/src/device.dart';
|
||||||
@ -20,8 +22,6 @@ import 'package:flutter_tools/src/globals.dart';
|
|||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||||
import 'package:flutter_tools/src/resident_runner.dart';
|
import 'package:flutter_tools/src/resident_runner.dart';
|
||||||
import 'package:flutter_tools/src/build_runner/resident_web_runner.dart';
|
|
||||||
import 'package:flutter_tools/src/build_runner/web_fs.dart';
|
|
||||||
import 'package:flutter_tools/src/web/chrome.dart';
|
import 'package:flutter_tools/src/web/chrome.dart';
|
||||||
import 'package:flutter_tools/src/web/web_device.dart';
|
import 'package:flutter_tools/src/web/web_device.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
@ -30,6 +30,7 @@ import 'package:vm_service/vm_service.dart';
|
|||||||
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
|
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
|
import '../src/context.dart';
|
||||||
import '../src/testbed.dart';
|
import '../src/testbed.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@ -75,7 +76,7 @@ void main() {
|
|||||||
ipv6: true,
|
ipv6: true,
|
||||||
stayResident: true,
|
stayResident: true,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
);
|
) as ResidentWebRunner;
|
||||||
},
|
},
|
||||||
overrides: <Type, Generator>{
|
overrides: <Type, Generator>{
|
||||||
WebFsFactory: () => ({
|
WebFsFactory: () => ({
|
||||||
@ -139,7 +140,7 @@ void main() {
|
|||||||
ipv6: true,
|
ipv6: true,
|
||||||
stayResident: true,
|
stayResident: true,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
);
|
) as ResidentWebRunner;
|
||||||
|
|
||||||
expect(profileResidentWebRunner.debuggingEnabled, false);
|
expect(profileResidentWebRunner.debuggingEnabled, false);
|
||||||
|
|
||||||
@ -177,8 +178,6 @@ void main() {
|
|||||||
test('runner with web server device uses debug extension with --start-paused', () => testbed.run(() async {
|
test('runner with web server device uses debug extension with --start-paused', () => testbed.run(() async {
|
||||||
_setupMocks();
|
_setupMocks();
|
||||||
when(mockFlutterDevice.device).thenReturn(WebServerDevice());
|
when(mockFlutterDevice.device).thenReturn(WebServerDevice());
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
|
|
||||||
final ResidentWebRunner runner = DwdsWebRunnerFactory().createWebRunner(
|
final ResidentWebRunner runner = DwdsWebRunnerFactory().createWebRunner(
|
||||||
mockFlutterDevice,
|
mockFlutterDevice,
|
||||||
flutterProject: FlutterProject.current(),
|
flutterProject: FlutterProject.current(),
|
||||||
@ -186,7 +185,7 @@ void main() {
|
|||||||
ipv6: true,
|
ipv6: true,
|
||||||
stayResident: true,
|
stayResident: true,
|
||||||
dartDefines: <String>[],
|
dartDefines: <String>[],
|
||||||
);
|
) as ResidentWebRunner;
|
||||||
|
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
unawaited(runner.run(
|
unawaited(runner.run(
|
||||||
@ -197,7 +196,7 @@ void main() {
|
|||||||
// Check connect() was told to use the debug extension.
|
// Check connect() was told to use the debug extension.
|
||||||
verify(mockWebFs.connect(true)).called(1);
|
verify(mockWebFs.connect(true)).called(1);
|
||||||
// And ensure the debug services was started.
|
// And ensure the debug services was started.
|
||||||
expect(bufferLogger.statusText, contains('Debug service listening on'));
|
expect(testLogger.statusText, contains('Debug service listening on'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('profile does not supportsServiceProtocol', () => testbed.run(() {
|
test('profile does not supportsServiceProtocol', () => testbed.run(() {
|
||||||
@ -217,26 +216,24 @@ void main() {
|
|||||||
|
|
||||||
test('Exits on run if application does not support the web', () => testbed.run(() async {
|
test('Exits on run if application does not support the web', () => testbed.run(() async {
|
||||||
fs.file('pubspec.yaml').createSync();
|
fs.file('pubspec.yaml').createSync();
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
|
|
||||||
expect(await residentWebRunner.run(), 1);
|
expect(await residentWebRunner.run(), 1);
|
||||||
expect(bufferLogger.errorText, contains('This application is not configured to build on the web'));
|
expect(testLogger.errorText, contains('This application is not configured to build on the web'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('Exits on run if target file does not exist', () => testbed.run(() async {
|
test('Exits on run if target file does not exist', () => testbed.run(() async {
|
||||||
fs.file('pubspec.yaml').createSync();
|
fs.file('pubspec.yaml').createSync();
|
||||||
fs.file(fs.path.join('web', 'index.html')).createSync(recursive: true);
|
fs.file(fs.path.join('web', 'index.html')).createSync(recursive: true);
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
|
|
||||||
expect(await residentWebRunner.run(), 1);
|
expect(await residentWebRunner.run(), 1);
|
||||||
final String absoluteMain = fs.path.absolute(fs.path.join('lib', 'main.dart'));
|
final String absoluteMain = fs.path.absolute(fs.path.join('lib', 'main.dart'));
|
||||||
expect(bufferLogger.errorText, contains('Tried to run $absoluteMain, but that file does not exist.'));
|
expect(testLogger.errorText, contains('Tried to run $absoluteMain, but that file does not exist.'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('Can successfully run and connect to vmservice', () => testbed.run(() async {
|
test('Can successfully run and connect to vmservice', () => testbed.run(() async {
|
||||||
_setupMocks();
|
_setupMocks();
|
||||||
final DelegateLogger delegateLogger = logger;
|
final DelegateLogger delegateLogger = logger as DelegateLogger;
|
||||||
final BufferLogger bufferLogger = delegateLogger.delegate;
|
final BufferLogger bufferLogger = delegateLogger.delegate as BufferLogger;
|
||||||
final MockStatus status = MockStatus();
|
final MockStatus status = MockStatus();
|
||||||
delegateLogger.status = status;
|
delegateLogger.status = status;
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
@ -264,14 +261,13 @@ void main() {
|
|||||||
ipv6: true,
|
ipv6: true,
|
||||||
stayResident: false,
|
stayResident: false,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
);
|
) as ResidentWebRunner;
|
||||||
|
|
||||||
expect(await residentWebRunner.run(), 0);
|
expect(await residentWebRunner.run(), 0);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('Listens to stdout streams before running main', () => testbed.run(() async {
|
test('Listens to stdout streams before running main', () => testbed.run(() async {
|
||||||
_setupMocks();
|
_setupMocks();
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
final StreamController<Event> controller = StreamController<Event>.broadcast();
|
final StreamController<Event> controller = StreamController<Event>.broadcast();
|
||||||
when(mockVmService.onStdoutEvent).thenAnswer((Invocation _) {
|
when(mockVmService.onStdoutEvent).thenAnswer((Invocation _) {
|
||||||
@ -290,7 +286,7 @@ void main() {
|
|||||||
));
|
));
|
||||||
await connectionInfoCompleter.future;
|
await connectionInfoCompleter.future;
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('THIS MESSAGE IS IMPORTANT'));
|
expect(testLogger.statusText, contains('THIS MESSAGE IS IMPORTANT'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('Does not run main with --start-paused', () => testbed.run(() async {
|
test('Does not run main with --start-paused', () => testbed.run(() async {
|
||||||
@ -301,7 +297,7 @@ void main() {
|
|||||||
ipv6: true,
|
ipv6: true,
|
||||||
stayResident: true,
|
stayResident: true,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
);
|
) as ResidentWebRunner;
|
||||||
_setupMocks();
|
_setupMocks();
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
final StreamController<Event> controller = StreamController<Event>.broadcast();
|
final StreamController<Event> controller = StreamController<Event>.broadcast();
|
||||||
@ -318,7 +314,6 @@ void main() {
|
|||||||
|
|
||||||
test('Can hot reload after attaching', () => testbed.run(() async {
|
test('Can hot reload after attaching', () => testbed.run(() async {
|
||||||
_setupMocks();
|
_setupMocks();
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
unawaited(residentWebRunner.run(
|
unawaited(residentWebRunner.run(
|
||||||
connectionInfoCompleter: connectionInfoCompleter,
|
connectionInfoCompleter: connectionInfoCompleter,
|
||||||
@ -332,7 +327,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
final OperationResult result = await residentWebRunner.restart(fullRestart: false);
|
final OperationResult result = await residentWebRunner.restart(fullRestart: false);
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('Reloaded application in'));
|
expect(testLogger.statusText, contains('Reloaded application in'));
|
||||||
expect(result.code, 0);
|
expect(result.code, 0);
|
||||||
// ensure that analytics are sent.
|
// ensure that analytics are sent.
|
||||||
verify(Usage.instance.sendEvent('hot', 'restart', parameters: <String, String>{
|
verify(Usage.instance.sendEvent('hot', 'restart', parameters: <String, String>{
|
||||||
@ -368,7 +363,6 @@ void main() {
|
|||||||
return UpdateFSReport(success: true)
|
return UpdateFSReport(success: true)
|
||||||
..invalidatedModules = <String>['example'];
|
..invalidatedModules = <String>['example'];
|
||||||
});
|
});
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
unawaited(residentWebRunner.run(
|
unawaited(residentWebRunner.run(
|
||||||
connectionInfoCompleter: connectionInfoCompleter,
|
connectionInfoCompleter: connectionInfoCompleter,
|
||||||
@ -376,7 +370,7 @@ void main() {
|
|||||||
await connectionInfoCompleter.future;
|
await connectionInfoCompleter.future;
|
||||||
final OperationResult result = await residentWebRunner.restart(fullRestart: false);
|
final OperationResult result = await residentWebRunner.restart(fullRestart: false);
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('Reloaded application in'));
|
expect(testLogger.statusText, contains('Reloaded application in'));
|
||||||
expect(result.code, 0);
|
expect(result.code, 0);
|
||||||
verify(mockResidentCompiler.accept()).called(2);
|
verify(mockResidentCompiler.accept()).called(2);
|
||||||
// ensure that analytics are sent.
|
// ensure that analytics are sent.
|
||||||
@ -412,7 +406,6 @@ void main() {
|
|||||||
return UpdateFSReport(success: true)
|
return UpdateFSReport(success: true)
|
||||||
..invalidatedModules = <String>['example'];
|
..invalidatedModules = <String>['example'];
|
||||||
});
|
});
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
unawaited(residentWebRunner.run(
|
unawaited(residentWebRunner.run(
|
||||||
connectionInfoCompleter: connectionInfoCompleter,
|
connectionInfoCompleter: connectionInfoCompleter,
|
||||||
@ -420,7 +413,7 @@ void main() {
|
|||||||
await connectionInfoCompleter.future;
|
await connectionInfoCompleter.future;
|
||||||
final OperationResult result = await residentWebRunner.restart(fullRestart: true);
|
final OperationResult result = await residentWebRunner.restart(fullRestart: true);
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('Restarted application in'));
|
expect(testLogger.statusText, contains('Restarted application in'));
|
||||||
expect(result.code, 0);
|
expect(result.code, 0);
|
||||||
verify(mockResidentCompiler.accept()).called(2);
|
verify(mockResidentCompiler.accept()).called(2);
|
||||||
// ensure that analytics are sent.
|
// ensure that analytics are sent.
|
||||||
@ -438,7 +431,6 @@ void main() {
|
|||||||
|
|
||||||
test('Can hot restart after attaching', () => testbed.run(() async {
|
test('Can hot restart after attaching', () => testbed.run(() async {
|
||||||
_setupMocks();
|
_setupMocks();
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
unawaited(residentWebRunner.run(
|
unawaited(residentWebRunner.run(
|
||||||
connectionInfoCompleter: connectionInfoCompleter,
|
connectionInfoCompleter: connectionInfoCompleter,
|
||||||
@ -452,7 +444,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
final OperationResult result = await residentWebRunner.restart(fullRestart: true);
|
final OperationResult result = await residentWebRunner.restart(fullRestart: true);
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('Restarted application in'));
|
expect(testLogger.statusText, contains('Restarted application in'));
|
||||||
expect(result.code, 0);
|
expect(result.code, 0);
|
||||||
// ensure that analytics are sent.
|
// ensure that analytics are sent.
|
||||||
verify(Usage.instance.sendEvent('hot', 'restart', parameters: <String, String>{
|
verify(Usage.instance.sendEvent('hot', 'restart', parameters: <String, String>{
|
||||||
@ -556,11 +548,10 @@ void main() {
|
|||||||
|
|
||||||
test('printHelp without details has web warning', () => testbed.run(() async {
|
test('printHelp without details has web warning', () => testbed.run(() async {
|
||||||
residentWebRunner.printHelp(details: false);
|
residentWebRunner.printHelp(details: false);
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('Warning'));
|
expect(testLogger.statusText, contains('Warning'));
|
||||||
expect(bufferLogger.statusText, contains('https://flutter.dev/web'));
|
expect(testLogger.statusText, contains('https://flutter.dev/web'));
|
||||||
expect(bufferLogger.statusText, isNot(contains('https://flutter.dev/web.')));
|
expect(testLogger.statusText, isNot(contains('https://flutter.dev/web.')));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('debugDumpApp', () => testbed.run(() async {
|
test('debugDumpApp', () => testbed.run(() async {
|
||||||
@ -697,7 +688,6 @@ void main() {
|
|||||||
|
|
||||||
test('debugTogglePlatform', () => testbed.run(() async {
|
test('debugTogglePlatform', () => testbed.run(() async {
|
||||||
_setupMocks();
|
_setupMocks();
|
||||||
final BufferLogger bufferLogger = logger;
|
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
unawaited(residentWebRunner.run(
|
unawaited(residentWebRunner.run(
|
||||||
connectionInfoCompleter: connectionInfoCompleter,
|
connectionInfoCompleter: connectionInfoCompleter,
|
||||||
@ -710,7 +700,7 @@ void main() {
|
|||||||
|
|
||||||
await residentWebRunner.debugTogglePlatform();
|
await residentWebRunner.debugTogglePlatform();
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('Switched operating system to android'));
|
expect(testLogger.statusText, contains('Switched operating system to android'));
|
||||||
verify(mockVmService.callServiceExtension('ext.flutter.platformOverride',
|
verify(mockVmService.callServiceExtension('ext.flutter.platformOverride',
|
||||||
args: <String, Object>{'value': 'android'})).called(1);
|
args: <String, Object>{'value': 'android'})).called(1);
|
||||||
}));
|
}));
|
||||||
@ -763,16 +753,14 @@ void main() {
|
|||||||
));
|
));
|
||||||
await connectionInfoCompleter.future;
|
await connectionInfoCompleter.future;
|
||||||
|
|
||||||
final BufferLogger bufferLogger = logger;
|
expect(testLogger.statusText, contains('Launching ${fs.path.join('lib', 'main.dart')} on Chromez in debug mode'));
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('Launching ${fs.path.join('lib', 'main.dart')} on Chromez in debug mode'));
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test('Sends launched app.webLaunchUrl event for Chrome device', () => testbed.run(() async {
|
test('Sends launched app.webLaunchUrl event for Chrome device', () => testbed.run(() async {
|
||||||
_setupMocks();
|
_setupMocks();
|
||||||
when(mockFlutterDevice.device).thenReturn(ChromeDevice());
|
when(mockFlutterDevice.device).thenReturn(ChromeDevice());
|
||||||
|
|
||||||
final DelegateLogger delegateLogger = logger;
|
final DelegateLogger delegateLogger = logger as DelegateLogger;
|
||||||
final MockStatus mockStatus = MockStatus();
|
final MockStatus mockStatus = MockStatus();
|
||||||
delegateLogger.status = mockStatus;
|
delegateLogger.status = mockStatus;
|
||||||
final ResidentWebRunner runner = DwdsWebRunnerFactory().createWebRunner(
|
final ResidentWebRunner runner = DwdsWebRunnerFactory().createWebRunner(
|
||||||
@ -782,7 +770,7 @@ void main() {
|
|||||||
ipv6: true,
|
ipv6: true,
|
||||||
stayResident: true,
|
stayResident: true,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
);
|
) as ResidentWebRunner;
|
||||||
|
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
unawaited(runner.run(
|
unawaited(runner.run(
|
||||||
@ -807,7 +795,7 @@ void main() {
|
|||||||
_setupMocks();
|
_setupMocks();
|
||||||
when(mockFlutterDevice.device).thenReturn(WebServerDevice());
|
when(mockFlutterDevice.device).thenReturn(WebServerDevice());
|
||||||
|
|
||||||
final DelegateLogger delegateLogger = logger;
|
final DelegateLogger delegateLogger = logger as DelegateLogger;
|
||||||
final MockStatus mockStatus = MockStatus();
|
final MockStatus mockStatus = MockStatus();
|
||||||
delegateLogger.status = mockStatus;
|
delegateLogger.status = mockStatus;
|
||||||
final ResidentWebRunner runner = DwdsWebRunnerFactory().createWebRunner(
|
final ResidentWebRunner runner = DwdsWebRunnerFactory().createWebRunner(
|
||||||
@ -817,7 +805,7 @@ void main() {
|
|||||||
ipv6: true,
|
ipv6: true,
|
||||||
stayResident: true,
|
stayResident: true,
|
||||||
dartDefines: const <String>[],
|
dartDefines: const <String>[],
|
||||||
);
|
) as ResidentWebRunner;
|
||||||
|
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
unawaited(runner.run(
|
unawaited(runner.run(
|
||||||
@ -992,7 +980,7 @@ void main() {
|
|||||||
|
|
||||||
test('Rethrows unknown exception type from web tooling', () => testbed.run(() async {
|
test('Rethrows unknown exception type from web tooling', () => testbed.run(() async {
|
||||||
_setupMocks();
|
_setupMocks();
|
||||||
final DelegateLogger delegateLogger = logger;
|
final DelegateLogger delegateLogger = logger as DelegateLogger;
|
||||||
final MockStatus mockStatus = MockStatus();
|
final MockStatus mockStatus = MockStatus();
|
||||||
delegateLogger.status = mockStatus;
|
delegateLogger.status = mockStatus;
|
||||||
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
|
||||||
|
@ -50,13 +50,13 @@ void main() {
|
|||||||
version: '1 2 3 4 5',
|
version: '1 2 3 4 5',
|
||||||
);
|
);
|
||||||
|
|
||||||
runner = createTestCommandRunner(DummyFlutterCommand());
|
runner = createTestCommandRunner(DummyFlutterCommand()) as FlutterCommandRunner;
|
||||||
processManager = MockProcessManager();
|
processManager = MockProcessManager();
|
||||||
});
|
});
|
||||||
|
|
||||||
group('run', () {
|
group('run', () {
|
||||||
testUsingContext('checks that Flutter installation is up-to-date', () async {
|
testUsingContext('checks that Flutter installation is up-to-date', () async {
|
||||||
final MockFlutterVersion version = FlutterVersion.instance;
|
final MockFlutterVersion version = FlutterVersion.instance as MockFlutterVersion;
|
||||||
bool versionChecked = false;
|
bool versionChecked = false;
|
||||||
when(version.checkFlutterVersionFreshness()).thenAnswer((_) async {
|
when(version.checkFlutterVersionFreshness()).thenAnswer((_) async {
|
||||||
versionChecked = true;
|
versionChecked = true;
|
||||||
@ -72,7 +72,7 @@ void main() {
|
|||||||
}, initializeFlutterRoot: false);
|
}, initializeFlutterRoot: false);
|
||||||
|
|
||||||
testUsingContext('throw tool exit if the version file cannot be written', () async {
|
testUsingContext('throw tool exit if the version file cannot be written', () async {
|
||||||
final MockFlutterVersion version = FlutterVersion.instance;
|
final MockFlutterVersion version = FlutterVersion.instance as MockFlutterVersion;
|
||||||
when(version.ensureVersionFile()).thenThrow(const FileSystemException());
|
when(version.ensureVersionFile()).thenThrow(const FileSystemException());
|
||||||
|
|
||||||
expect(() async => await runner.run(<String>['dummy']), throwsA(isA<ToolExit>()));
|
expect(() async => await runner.run(<String>['dummy']), throwsA(isA<ToolExit>()));
|
||||||
|
@ -58,7 +58,7 @@ void main() {
|
|||||||
Cache: () => cache,
|
Cache: () => cache,
|
||||||
});
|
});
|
||||||
|
|
||||||
void testUsingCommandContext(String testName, Function testBody) {
|
void testUsingCommandContext(String testName, dynamic Function() testBody) {
|
||||||
testUsingContext(testName, testBody, overrides: <Type, Generator>{
|
testUsingContext(testName, testBody, overrides: <Type, Generator>{
|
||||||
ProcessInfo: () => mockProcessInfo,
|
ProcessInfo: () => mockProcessInfo,
|
||||||
SystemClock: () => clock,
|
SystemClock: () => clock,
|
||||||
|
@ -63,7 +63,7 @@ void main() {
|
|||||||
// exception on the first attempt, the second attempt tries to report the
|
// exception on the first attempt, the second attempt tries to report the
|
||||||
// *original* crash, and not the crash from the first crash report
|
// *original* crash, and not the crash from the first crash report
|
||||||
// attempt.
|
// attempt.
|
||||||
final CrashingUsage crashingUsage = flutterUsage;
|
final CrashingUsage crashingUsage = flutterUsage as CrashingUsage;
|
||||||
expect(crashingUsage.sentException, 'runCommand');
|
expect(crashingUsage.sentException, 'runCommand');
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Platform: () => FakePlatform(environment: <String, String>{
|
Platform: () => FakePlatform(environment: <String, String>{
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/common.dart';
|
import 'package:flutter_tools/src/base/common.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/device.dart';
|
import 'package:flutter_tools/src/device.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart';
|
|
||||||
import 'package:flutter_tools/src/resident_runner.dart';
|
import 'package:flutter_tools/src/resident_runner.dart';
|
||||||
import 'package:flutter_tools/src/vmservice.dart';
|
import 'package:flutter_tools/src/vmservice.dart';
|
||||||
import 'package:mockito/mockito.dart';
|
import 'package:mockito/mockito.dart';
|
||||||
@ -123,9 +122,7 @@ void main() {
|
|||||||
|
|
||||||
await terminalHandler.processTerminalInput('l');
|
await terminalHandler.processTerminalInput('l');
|
||||||
|
|
||||||
final BufferLogger bufferLogger = logger;
|
expect(testLogger.statusText, contains('Connected views:\n'));
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('Connected views:\n'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('L - debugDumpLayerTree with service protocol', () async {
|
testUsingContext('L - debugDumpLayerTree with service protocol', () async {
|
||||||
@ -242,9 +239,7 @@ void main() {
|
|||||||
|
|
||||||
verify(mockResidentRunner.restart(fullRestart: false)).called(1);
|
verify(mockResidentRunner.restart(fullRestart: false)).called(1);
|
||||||
|
|
||||||
final BufferLogger bufferLogger = logger;
|
expect(testLogger.statusText, contains('Try again after fixing the above error(s).'));
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('Try again after fixing the above error(s).'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('r - hotReload supported and fails fatally', () async {
|
testUsingContext('r - hotReload supported and fails fatally', () async {
|
||||||
@ -287,9 +282,7 @@ void main() {
|
|||||||
|
|
||||||
verify(mockResidentRunner.restart(fullRestart: true)).called(1);
|
verify(mockResidentRunner.restart(fullRestart: true)).called(1);
|
||||||
|
|
||||||
final BufferLogger bufferLogger = logger;
|
expect(testLogger.statusText, contains('Try again after fixing the above error(s).'));
|
||||||
|
|
||||||
expect(bufferLogger.statusText, contains('Try again after fixing the above error(s).'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('R - hotRestart supported and fails fatally', () async {
|
testUsingContext('R - hotRestart supported and fails fatally', () async {
|
||||||
|
@ -153,13 +153,13 @@ baz=qux
|
|||||||
'wrapped and indentation preserved.';
|
'wrapped and indentation preserved.';
|
||||||
final FakeStdio fakeStdio = FakeStdio();
|
final FakeStdio fakeStdio = FakeStdio();
|
||||||
|
|
||||||
void testWrap(String description, Function body) {
|
void testWrap(String description, dynamic Function() body) {
|
||||||
testUsingContext(description, body, overrides: <Type, Generator>{
|
testUsingContext(description, body, overrides: <Type, Generator>{
|
||||||
OutputPreferences: () => OutputPreferences(wrapText: true, wrapColumn: _lineLength),
|
OutputPreferences: () => OutputPreferences(wrapText: true, wrapColumn: _lineLength),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void testNoWrap(String description, Function body) {
|
void testNoWrap(String description, dynamic Function() body) {
|
||||||
testUsingContext(description, body, overrides: <Type, Generator>{
|
testUsingContext(description, body, overrides: <Type, Generator>{
|
||||||
OutputPreferences: () => OutputPreferences(wrapText: false),
|
OutputPreferences: () => OutputPreferences(wrapText: false),
|
||||||
});
|
});
|
||||||
|
@ -5,15 +5,14 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:collection/collection.dart' show ListEquality;
|
import 'package:collection/collection.dart' show ListEquality;
|
||||||
import 'package:flutter_tools/src/base/time.dart';
|
|
||||||
import 'package:mockito/mockito.dart';
|
|
||||||
import 'package:process/process.dart';
|
|
||||||
|
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/time.dart';
|
||||||
|
import 'package:flutter_tools/src/base/utils.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/version.dart';
|
import 'package:flutter_tools/src/version.dart';
|
||||||
|
import 'package:mockito/mockito.dart';
|
||||||
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
import '../src/common.dart';
|
import '../src/common.dart';
|
||||||
import '../src/context.dart';
|
import '../src/context.dart';
|
||||||
@ -414,9 +413,8 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _expectVersionMessage(String message) {
|
void _expectVersionMessage(String message) {
|
||||||
final BufferLogger logger = context.get<Logger>();
|
expect(testLogger.statusText.trim(), message.trim());
|
||||||
expect(logger.statusText.trim(), message.trim());
|
testLogger.clear();
|
||||||
logger.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void fakeData(
|
void fakeData(
|
||||||
@ -457,7 +455,7 @@ void fakeData(
|
|||||||
expect(invocation.positionalArguments.first, VersionCheckStamp.flutterVersionCheckStampFile);
|
expect(invocation.positionalArguments.first, VersionCheckStamp.flutterVersionCheckStampFile);
|
||||||
|
|
||||||
if (expectSetStamp) {
|
if (expectSetStamp) {
|
||||||
stamp = VersionCheckStamp.fromJson(json.decode(invocation.positionalArguments[1]));
|
stamp = VersionCheckStamp.fromJson(castStringKeyedMap(json.decode(invocation.positionalArguments[1] as String)));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,13 +465,13 @@ void fakeData(
|
|||||||
final Answering<ProcessResult> syncAnswer = (Invocation invocation) {
|
final Answering<ProcessResult> syncAnswer = (Invocation invocation) {
|
||||||
bool argsAre(String a1, [ String a2, String a3, String a4, String a5, String a6, String a7, String a8, String a9 ]) {
|
bool argsAre(String a1, [ String a2, String a3, String a4, String a5, String a6, String a7, String a8, String a9 ]) {
|
||||||
const ListEquality<String> equality = ListEquality<String>();
|
const ListEquality<String> equality = ListEquality<String>();
|
||||||
final List<String> args = invocation.positionalArguments.single;
|
final List<String> args = invocation.positionalArguments.single as List<String>;
|
||||||
final List<String> expectedArgs = <String>[a1, a2, a3, a4, a5, a6, a7, a8, a9].where((String arg) => arg != null).toList();
|
final List<String> expectedArgs = <String>[a1, a2, a3, a4, a5, a6, a7, a8, a9].where((String arg) => arg != null).toList();
|
||||||
return equality.equals(args, expectedArgs);
|
return equality.equals(args, expectedArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool listArgsAre(List<String> a) {
|
bool listArgsAre(List<String> a) {
|
||||||
return Function.apply(argsAre, a);
|
return Function.apply(argsAre, a) as bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listArgsAre(FlutterVersion.gitLog(<String>['-n', '1', '--pretty=format:%ad', '--date=iso']))) {
|
if (listArgsAre(FlutterVersion.gitLog(<String>['-n', '1', '--pretty=format:%ad', '--date=iso']))) {
|
||||||
|
@ -85,7 +85,7 @@ void main() {
|
|||||||
|
|
||||||
await chromeLauncher.launch('example_url', skipCheck: true, dataDir: dataDir);
|
await chromeLauncher.launch('example_url', skipCheck: true, dataDir: dataDir);
|
||||||
final VerificationResult result = verify(processManager.start(captureAny));
|
final VerificationResult result = verify(processManager.start(captureAny));
|
||||||
final String arg = result.captured.single
|
final String arg = (result.captured.single as List<String>)
|
||||||
.firstWhere((String arg) => arg.startsWith('--user-data-dir='));
|
.firstWhere((String arg) => arg.startsWith('--user-data-dir='));
|
||||||
final Directory tempDirectory = fs.directory(arg.split('=')[1]);
|
final Directory tempDirectory = fs.directory(arg.split('=')[1]);
|
||||||
final File tempFile = tempDirectory
|
final File tempFile = tempDirectory
|
||||||
|
@ -51,7 +51,7 @@ void main() {
|
|||||||
headers = MockHttpHeaders();
|
headers = MockHttpHeaders();
|
||||||
closeCompleter = Completer<void>();
|
closeCompleter = Completer<void>();
|
||||||
when(mockHttpServer.listen(any, onError: anyNamed('onError'))).thenAnswer((Invocation invocation) {
|
when(mockHttpServer.listen(any, onError: anyNamed('onError'))).thenAnswer((Invocation invocation) {
|
||||||
final Function callback = invocation.positionalArguments.first;
|
final void Function(HttpRequest) callback = invocation.positionalArguments.first as void Function(HttpRequest);
|
||||||
return requestController.stream.listen(callback);
|
return requestController.stream.listen(callback);
|
||||||
});
|
});
|
||||||
when(request.response).thenReturn(response);
|
when(request.response).thenReturn(response);
|
||||||
|
@ -48,7 +48,7 @@ void main() {
|
|||||||
mockProcessUtils = MockProcessUtils();
|
mockProcessUtils = MockProcessUtils();
|
||||||
when(mockBuildDaemonCreator.startBuildDaemon(any, release: anyNamed('release'), initializePlatform: anyNamed('initializePlatform')))
|
when(mockBuildDaemonCreator.startBuildDaemon(any, release: anyNamed('release'), initializePlatform: anyNamed('initializePlatform')))
|
||||||
.thenAnswer((Invocation invocation) async {
|
.thenAnswer((Invocation invocation) async {
|
||||||
lastInitializePlatform = invocation.namedArguments[#initializePlatform];
|
lastInitializePlatform = invocation.namedArguments[#initializePlatform] as bool;
|
||||||
return mockBuildDaemonClient;
|
return mockBuildDaemonClient;
|
||||||
});
|
});
|
||||||
when(mockOperatingSystemUtils.findFreePort()).thenAnswer((Invocation _) async {
|
when(mockOperatingSystemUtils.findFreePort()).thenAnswer((Invocation _) async {
|
||||||
@ -60,7 +60,7 @@ void main() {
|
|||||||
mapFunction: anyNamed('mapFunction'),
|
mapFunction: anyNamed('mapFunction'),
|
||||||
environment: anyNamed('environment'),
|
environment: anyNamed('environment'),
|
||||||
)).thenAnswer((Invocation invocation) async {
|
)).thenAnswer((Invocation invocation) async {
|
||||||
final String workingDirectory = invocation.namedArguments[#workingDirectory];
|
final String workingDirectory = invocation.namedArguments[#workingDirectory] as String;
|
||||||
fs.file(fs.path.join(workingDirectory, '.packages')).createSync(recursive: true);
|
fs.file(fs.path.join(workingDirectory, '.packages')).createSync(recursive: true);
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
@ -81,8 +81,8 @@ void main() {
|
|||||||
|
|
||||||
final String finalResponse = responseOverride ??
|
final String finalResponse = responseOverride ??
|
||||||
json.encode(<Map<String, dynamic>>[response]);
|
json.encode(<Map<String, dynamic>>[response]);
|
||||||
when<String>(result.stdout).thenReturn(finalResponse);
|
when<String>(result.stdout as String).thenReturn(finalResponse);
|
||||||
when<String>(result.stderr).thenReturn('');
|
when<String>(result.stderr as String).thenReturn('');
|
||||||
final List<String> requirementArguments = requiredComponents == null
|
final List<String> requirementArguments = requiredComponents == null
|
||||||
? <String>[]
|
? <String>[]
|
||||||
: <String>['-requires', ...requiredComponents];
|
: <String>['-requires', ...requiredComponents];
|
||||||
@ -180,8 +180,8 @@ void main() {
|
|||||||
)).thenAnswer((Invocation invocation) {
|
)).thenAnswer((Invocation invocation) {
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
when<String>(result.stdout).thenReturn('');
|
when<String>(result.stdout as String).thenReturn('');
|
||||||
when<String>(result.stderr).thenReturn('');
|
when<String>(result.stderr as String).thenReturn('');
|
||||||
|
|
||||||
visualStudio = VisualStudio();
|
visualStudio = VisualStudio();
|
||||||
expect(visualStudio.isInstalled, false);
|
expect(visualStudio.isInstalled, false);
|
||||||
|
@ -9,6 +9,7 @@ import 'package:file/file.dart';
|
|||||||
import 'package:flutter_tools/src/base/common.dart';
|
import 'package:flutter_tools/src/base/common.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
import 'package:flutter_tools/src/base/utils.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
import 'package:vm_service/vm_service.dart';
|
import 'package:vm_service/vm_service.dart';
|
||||||
@ -186,7 +187,7 @@ abstract class FlutterTestDriver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Isolate> _getFlutterIsolate() async {
|
Future<Isolate> _getFlutterIsolate() async {
|
||||||
final Isolate isolate = await _vmService.getIsolate(await _getFlutterIsolateId());
|
final Isolate isolate = await _vmService.getIsolate(await _getFlutterIsolateId()) as Isolate;
|
||||||
return isolate;
|
return isolate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +237,7 @@ abstract class FlutterTestDriver {
|
|||||||
// But also check if the isolate was already paused (only after we've set
|
// But also check if the isolate was already paused (only after we've set
|
||||||
// up the subscription) to avoid races. If it was paused, we don't need to wait
|
// up the subscription) to avoid races. If it was paused, we don't need to wait
|
||||||
// for the event.
|
// for the event.
|
||||||
final Isolate isolate = await _vmService.getIsolate(flutterIsolate);
|
final Isolate isolate = await _vmService.getIsolate(flutterIsolate) as Isolate;
|
||||||
if (isolate.pauseEvent.kind.startsWith('Pause')) {
|
if (isolate.pauseEvent.kind.startsWith('Pause')) {
|
||||||
_debugPrint('Isolate was already paused (${isolate.pauseEvent.kind}).');
|
_debugPrint('Isolate was already paused (${isolate.pauseEvent.kind}).');
|
||||||
} else {
|
} else {
|
||||||
@ -282,14 +283,14 @@ abstract class FlutterTestDriver {
|
|||||||
|
|
||||||
Future<InstanceRef> evaluateInFrame(String expression) async {
|
Future<InstanceRef> evaluateInFrame(String expression) async {
|
||||||
return _timeoutWithMessages<InstanceRef>(
|
return _timeoutWithMessages<InstanceRef>(
|
||||||
() async => await _vmService.evaluateInFrame(await _getFlutterIsolateId(), 0, expression),
|
() async => await _vmService.evaluateInFrame(await _getFlutterIsolateId(), 0, expression) as InstanceRef,
|
||||||
task: 'Evaluating expression ($expression)',
|
task: 'Evaluating expression ($expression)',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<InstanceRef> evaluate(String targetId, String expression) async {
|
Future<InstanceRef> evaluate(String targetId, String expression) async {
|
||||||
return _timeoutWithMessages<InstanceRef>(
|
return _timeoutWithMessages<InstanceRef>(
|
||||||
() async => await _vmService.evaluate(await _getFlutterIsolateId(), targetId, expression),
|
() async => await _vmService.evaluate(await _getFlutterIsolateId(), targetId, expression) as InstanceRef,
|
||||||
task: 'Evaluating expression ($expression for $targetId)',
|
task: 'Evaluating expression ($expression for $targetId)',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -306,7 +307,7 @@ abstract class FlutterTestDriver {
|
|||||||
Future<SourcePosition> getSourceLocation() async {
|
Future<SourcePosition> getSourceLocation() async {
|
||||||
final String flutterIsolateId = await _getFlutterIsolateId();
|
final String flutterIsolateId = await _getFlutterIsolateId();
|
||||||
final Frame frame = await getTopStackFrame();
|
final Frame frame = await getTopStackFrame();
|
||||||
final Script script = await _vmService.getObject(flutterIsolateId, frame.location.script.id);
|
final Script script = await _vmService.getObject(flutterIsolateId, frame.location.script.id) as Script;
|
||||||
return _lookupTokenPos(script.tokenPosTable, frame.location.tokenPos);
|
return _lookupTokenPos(script.tokenPosTable, frame.location.tokenPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +339,7 @@ abstract class FlutterTestDriver {
|
|||||||
final Completer<Map<String, dynamic>> response = Completer<Map<String, dynamic>>();
|
final Completer<Map<String, dynamic>> response = Completer<Map<String, dynamic>>();
|
||||||
StreamSubscription<String> subscription;
|
StreamSubscription<String> subscription;
|
||||||
subscription = _stdout.stream.listen((String line) async {
|
subscription = _stdout.stream.listen((String line) async {
|
||||||
final dynamic json = parseFlutterResponse(line);
|
final Map<String, dynamic> json = parseFlutterResponse(line);
|
||||||
_lastResponse = line;
|
_lastResponse = line;
|
||||||
if (json == null) {
|
if (json == null) {
|
||||||
return;
|
return;
|
||||||
@ -504,7 +505,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
|
|||||||
// _process.kill() (`flutter` is a shell script so _process itself is a
|
// _process.kill() (`flutter` is a shell script so _process itself is a
|
||||||
// shell, not the flutter tool's Dart process).
|
// shell, not the flutter tool's Dart process).
|
||||||
final Map<String, dynamic> connected = await _waitFor(event: 'daemon.connected');
|
final Map<String, dynamic> connected = await _waitFor(event: 'daemon.connected');
|
||||||
_processPid = connected['params']['pid'];
|
_processPid = connected['params']['pid'] as int;
|
||||||
|
|
||||||
// Set this up now, but we don't wait it yet. We want to make sure we don't
|
// Set this up now, but we don't wait it yet. We want to make sure we don't
|
||||||
// miss it while waiting for debugPort below.
|
// miss it while waiting for debugPort below.
|
||||||
@ -512,7 +513,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
|
|||||||
|
|
||||||
if (withDebugger) {
|
if (withDebugger) {
|
||||||
final Map<String, dynamic> debugPort = await _waitFor(event: 'app.debugPort', timeout: appStartTimeout);
|
final Map<String, dynamic> debugPort = await _waitFor(event: 'app.debugPort', timeout: appStartTimeout);
|
||||||
final String wsUriString = debugPort['params']['wsUri'];
|
final String wsUriString = debugPort['params']['wsUri'] as String;
|
||||||
_vmServiceWsUri = Uri.parse(wsUriString);
|
_vmServiceWsUri = Uri.parse(wsUriString);
|
||||||
await connectToVmService(pauseOnExceptions: pauseOnExceptions);
|
await connectToVmService(pauseOnExceptions: pauseOnExceptions);
|
||||||
if (!startPaused) {
|
if (!startPaused) {
|
||||||
@ -522,7 +523,7 @@ class FlutterRunTestDriver extends FlutterTestDriver {
|
|||||||
|
|
||||||
// Now await the started event; if it had already happened the future will
|
// Now await the started event; if it had already happened the future will
|
||||||
// have already completed.
|
// have already completed.
|
||||||
_currentRunningAppId = (await started)['params']['appId'];
|
_currentRunningAppId = (await started)['params']['appId'] as String;
|
||||||
prematureExitGuard.complete();
|
prematureExitGuard.complete();
|
||||||
} catch(error, stackTrace) {
|
} catch(error, stackTrace) {
|
||||||
prematureExitGuard.completeError(error, stackTrace);
|
prematureExitGuard.completeError(error, stackTrace);
|
||||||
@ -677,11 +678,11 @@ class FlutterTestTestDriver extends FlutterTestDriver {
|
|||||||
// _proc.kill() (because _proc is a shell, because `flutter` is a shell
|
// _proc.kill() (because _proc is a shell, because `flutter` is a shell
|
||||||
// script).
|
// script).
|
||||||
final Map<String, dynamic> version = await _waitForJson();
|
final Map<String, dynamic> version = await _waitForJson();
|
||||||
_processPid = version['pid'];
|
_processPid = version['pid'] as int;
|
||||||
|
|
||||||
if (withDebugger) {
|
if (withDebugger) {
|
||||||
final Map<String, dynamic> startedProcess = await _waitFor(event: 'test.startedProcess', timeout: appStartTimeout);
|
final Map<String, dynamic> startedProcess = await _waitFor(event: 'test.startedProcess', timeout: appStartTimeout);
|
||||||
final String vmServiceHttpString = startedProcess['params']['observatoryUri'];
|
final String vmServiceHttpString = startedProcess['params']['observatoryUri'] as String;
|
||||||
_vmServiceWsUri = Uri.parse(vmServiceHttpString).replace(scheme: 'ws', path: '/ws');
|
_vmServiceWsUri = Uri.parse(vmServiceHttpString).replace(scheme: 'ws', path: '/ws');
|
||||||
await connectToVmService(pauseOnExceptions: pauseOnExceptions);
|
await connectToVmService(pauseOnExceptions: pauseOnExceptions);
|
||||||
// Allow us to run code before we start, eg. to set up breakpoints.
|
// Allow us to run code before we start, eg. to set up breakpoints.
|
||||||
@ -706,7 +707,7 @@ class FlutterTestTestDriver extends FlutterTestDriver {
|
|||||||
|
|
||||||
Map<String, dynamic> _parseJsonResponse(String line) {
|
Map<String, dynamic> _parseJsonResponse(String line) {
|
||||||
try {
|
try {
|
||||||
return json.decode(line);
|
return castStringKeyedMap(json.decode(line));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Not valid JSON, so likely some other output.
|
// Not valid JSON, so likely some other output.
|
||||||
return null;
|
return null;
|
||||||
@ -721,7 +722,7 @@ Stream<String> transformToLines(Stream<List<int>> byteStream) {
|
|||||||
Map<String, dynamic> parseFlutterResponse(String line) {
|
Map<String, dynamic> parseFlutterResponse(String line) {
|
||||||
if (line.startsWith('[') && line.endsWith(']')) {
|
if (line.startsWith('[') && line.endsWith(']')) {
|
||||||
try {
|
try {
|
||||||
final Map<String, dynamic> response = json.decode(line)[0];
|
final Map<String, dynamic> response = castStringKeyedMap(json.decode(line)[0]);
|
||||||
return response;
|
return response;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Not valid JSON, so likely some other output that was surrounded by [brackets]
|
// Not valid JSON, so likely some other output that was surrounded by [brackets]
|
||||||
|
@ -38,10 +38,10 @@ export 'package:flutter_tools/src/base/context.dart' show Generator;
|
|||||||
export 'fake_process_manager.dart' show ProcessManager, FakeProcessManager, FakeCommand;
|
export 'fake_process_manager.dart' show ProcessManager, FakeProcessManager, FakeCommand;
|
||||||
|
|
||||||
/// Return the test logger. This assumes that the current Logger is a BufferLogger.
|
/// Return the test logger. This assumes that the current Logger is a BufferLogger.
|
||||||
BufferLogger get testLogger => context.get<Logger>();
|
BufferLogger get testLogger => context.get<Logger>() as BufferLogger;
|
||||||
|
|
||||||
FakeDeviceManager get testDeviceManager => context.get<DeviceManager>();
|
FakeDeviceManager get testDeviceManager => context.get<DeviceManager>() as FakeDeviceManager;
|
||||||
FakeDoctor get testDoctor => context.get<Doctor>();
|
FakeDoctor get testDoctor => context.get<Doctor>() as FakeDoctor;
|
||||||
|
|
||||||
typedef ContextInitializer = void Function(AppContext testContext);
|
typedef ContextInitializer = void Function(AppContext testContext);
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ void testUsingContext(
|
|||||||
|
|
||||||
void _printBufferedErrors(AppContext testContext) {
|
void _printBufferedErrors(AppContext testContext) {
|
||||||
if (testContext.get<Logger>() is BufferLogger) {
|
if (testContext.get<Logger>() is BufferLogger) {
|
||||||
final BufferLogger bufferLogger = testContext.get<Logger>();
|
final BufferLogger bufferLogger = testContext.get<Logger>() as BufferLogger;
|
||||||
if (bufferLogger.errorText.isNotEmpty) {
|
if (bufferLogger.errorText.isNotEmpty) {
|
||||||
print(bufferLogger.errorText);
|
print(bufferLogger.errorText);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ abstract class FakeProcessManager implements ProcessManager {
|
|||||||
bool includeParentEnvironment = true, // ignored
|
bool includeParentEnvironment = true, // ignored
|
||||||
bool runInShell = false, // ignored
|
bool runInShell = false, // ignored
|
||||||
ProcessStartMode mode = ProcessStartMode.normal, // ignored
|
ProcessStartMode mode = ProcessStartMode.normal, // ignored
|
||||||
}) async => _runCommand(command, workingDirectory, environment);
|
}) async => _runCommand(command.cast<String>(), workingDirectory, environment);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<ProcessResult> run(
|
Future<ProcessResult> run(
|
||||||
@ -224,7 +224,7 @@ abstract class FakeProcessManager implements ProcessManager {
|
|||||||
Encoding stdoutEncoding = systemEncoding,
|
Encoding stdoutEncoding = systemEncoding,
|
||||||
Encoding stderrEncoding = systemEncoding,
|
Encoding stderrEncoding = systemEncoding,
|
||||||
}) async {
|
}) async {
|
||||||
final _FakeProcess process = _runCommand(command, workingDirectory, environment);
|
final _FakeProcess process = _runCommand(command.cast<String>(), workingDirectory, environment);
|
||||||
await process.exitCode;
|
await process.exitCode;
|
||||||
return ProcessResult(
|
return ProcessResult(
|
||||||
process.pid,
|
process.pid,
|
||||||
@ -244,7 +244,7 @@ abstract class FakeProcessManager implements ProcessManager {
|
|||||||
Encoding stdoutEncoding = systemEncoding, // actual encoder is ignored
|
Encoding stdoutEncoding = systemEncoding, // actual encoder is ignored
|
||||||
Encoding stderrEncoding = systemEncoding, // actual encoder is ignored
|
Encoding stderrEncoding = systemEncoding, // actual encoder is ignored
|
||||||
}) {
|
}) {
|
||||||
final _FakeProcess process = _runCommand(command, workingDirectory, environment);
|
final _FakeProcess process = _runCommand(command.cast<String>(), workingDirectory, environment);
|
||||||
return ProcessResult(
|
return ProcessResult(
|
||||||
process.pid,
|
process.pid,
|
||||||
process._exitCode,
|
process._exitCode,
|
||||||
|
@ -177,14 +177,15 @@ class MockProcessManager extends Mock implements ProcessManager {
|
|||||||
bool runInShell = false,
|
bool runInShell = false,
|
||||||
ProcessStartMode mode = ProcessStartMode.normal,
|
ProcessStartMode mode = ProcessStartMode.normal,
|
||||||
}) {
|
}) {
|
||||||
|
final List<String> commands = command.cast<String>();
|
||||||
if (!runSucceeds) {
|
if (!runSucceeds) {
|
||||||
final String executable = command[0];
|
final String executable = commands[0];
|
||||||
final List<String> arguments = command.length > 1 ? command.sublist(1) : <String>[];
|
final List<String> arguments = commands.length > 1 ? commands.sublist(1) : <String>[];
|
||||||
throw ProcessException(executable, arguments);
|
throw ProcessException(executable, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
commands = command;
|
this.commands = commands;
|
||||||
return Future<Process>.value(processFactory(command));
|
return Future<Process>.value(processFactory(commands));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +255,7 @@ class MockProcess extends Mock implements Process {
|
|||||||
this.stdout = const Stream<List<int>>.empty(),
|
this.stdout = const Stream<List<int>>.empty(),
|
||||||
this.stderr = const Stream<List<int>>.empty(),
|
this.stderr = const Stream<List<int>>.empty(),
|
||||||
}) : exitCode = exitCode ?? Future<int>.value(0),
|
}) : exitCode = exitCode ?? Future<int>.value(0),
|
||||||
stdin = stdin ?? MemoryIOSink();
|
stdin = stdin as IOSink ?? MemoryIOSink();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final int pid;
|
final int pid;
|
||||||
@ -281,7 +282,7 @@ class FakeProcess implements Process {
|
|||||||
this.stdout = const Stream<List<int>>.empty(),
|
this.stdout = const Stream<List<int>>.empty(),
|
||||||
this.stderr = const Stream<List<int>>.empty(),
|
this.stderr = const Stream<List<int>>.empty(),
|
||||||
}) : exitCode = exitCode ?? Future<int>.value(0),
|
}) : exitCode = exitCode ?? Future<int>.value(0),
|
||||||
stdin = stdin ?? MemoryIOSink();
|
stdin = stdin as IOSink ?? MemoryIOSink();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final int pid;
|
final int pid;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
|
||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
@ -171,7 +170,7 @@ class NoOpUsage implements Usage {
|
|||||||
bool get isFirstRun => false;
|
bool get isFirstRun => false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<Map<String, Object>> get onSend => const Stream<Object>.empty();
|
Stream<Map<String, Object>> get onSend => const Stream<Map<String, Object>>.empty();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void printWelcome() {}
|
void printWelcome() {}
|
||||||
@ -373,7 +372,7 @@ class FakeHttpClientRequest implements HttpClientRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FakeHttpClientResponse implements HttpClientResponse {
|
class FakeHttpClientResponse implements HttpClientResponse {
|
||||||
final Stream<Uint8List> _delegate = Stream<Uint8List>.fromIterable(const Iterable<Uint8List>.empty());
|
final Stream<List<int>> _delegate = Stream<List<int>>.fromIterable(const Iterable<List<int>>.empty());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final HttpHeaders headers = FakeHttpHeaders();
|
final HttpHeaders headers = FakeHttpHeaders();
|
||||||
@ -404,8 +403,8 @@ class FakeHttpClientResponse implements HttpClientResponse {
|
|||||||
bool get isRedirect => false;
|
bool get isRedirect => false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
StreamSubscription<Uint8List> listen(void Function(Uint8List event) onData, { Function onError, void Function() onDone, bool cancelOnError }) {
|
StreamSubscription<List<int>> listen(void Function(List<int> event) onData, { Function onError, void Function() onDone, bool cancelOnError }) {
|
||||||
return const Stream<Uint8List>.empty().listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
return const Stream<List<int>>.empty().listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -426,25 +425,25 @@ class FakeHttpClientResponse implements HttpClientResponse {
|
|||||||
int get statusCode => 400;
|
int get statusCode => 400;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> any(bool Function(Uint8List element) test) {
|
Future<bool> any(bool Function(List<int> element) test) {
|
||||||
return _delegate.any(test);
|
return _delegate.any(test);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<Uint8List> asBroadcastStream({
|
Stream<List<int>> asBroadcastStream({
|
||||||
void Function(StreamSubscription<Uint8List> subscription) onListen,
|
void Function(StreamSubscription<List<int>> subscription) onListen,
|
||||||
void Function(StreamSubscription<Uint8List> subscription) onCancel,
|
void Function(StreamSubscription<List<int>> subscription) onCancel,
|
||||||
}) {
|
}) {
|
||||||
return _delegate.asBroadcastStream(onListen: onListen, onCancel: onCancel);
|
return _delegate.asBroadcastStream(onListen: onListen, onCancel: onCancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<E> asyncExpand<E>(Stream<E> Function(Uint8List event) convert) {
|
Stream<E> asyncExpand<E>(Stream<E> Function(List<int> event) convert) {
|
||||||
return _delegate.asyncExpand<E>(convert);
|
return _delegate.asyncExpand<E>(convert);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<E> asyncMap<E>(FutureOr<E> Function(Uint8List event) convert) {
|
Stream<E> asyncMap<E>(FutureOr<E> Function(List<int> event) convert) {
|
||||||
return _delegate.asyncMap<E>(convert);
|
return _delegate.asyncMap<E>(convert);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,7 +458,7 @@ class FakeHttpClientResponse implements HttpClientResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<Uint8List> distinct([bool Function(Uint8List previous, Uint8List next) equals]) {
|
Stream<List<int>> distinct([bool Function(List<int> previous, List<int> next) equals]) {
|
||||||
return _delegate.distinct(equals);
|
return _delegate.distinct(equals);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,43 +468,43 @@ class FakeHttpClientResponse implements HttpClientResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Uint8List> elementAt(int index) {
|
Future<List<int>> elementAt(int index) {
|
||||||
return _delegate.elementAt(index);
|
return _delegate.elementAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> every(bool Function(Uint8List element) test) {
|
Future<bool> every(bool Function(List<int> element) test) {
|
||||||
return _delegate.every(test);
|
return _delegate.every(test);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<S> expand<S>(Iterable<S> Function(Uint8List element) convert) {
|
Stream<S> expand<S>(Iterable<S> Function(List<int> element) convert) {
|
||||||
return _delegate.expand(convert);
|
return _delegate.expand(convert);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Uint8List> get first => _delegate.first;
|
Future<List<int>> get first => _delegate.first;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Uint8List> firstWhere(
|
Future<List<int>> firstWhere(
|
||||||
bool Function(Uint8List element) test, {
|
bool Function(List<int> element) test, {
|
||||||
List<int> Function() orElse,
|
List<int> Function() orElse,
|
||||||
}) {
|
}) {
|
||||||
return _delegate.firstWhere(test, orElse: orElse);
|
return _delegate.firstWhere(test, orElse: orElse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<S> fold<S>(S initialValue, S Function(S previous, Uint8List element) combine) {
|
Future<S> fold<S>(S initialValue, S Function(S previous, List<int> element) combine) {
|
||||||
return _delegate.fold<S>(initialValue, combine);
|
return _delegate.fold<S>(initialValue, combine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<dynamic> forEach(void Function(Uint8List element) action) {
|
Future<dynamic> forEach(void Function(List<int> element) action) {
|
||||||
return _delegate.forEach(action);
|
return _delegate.forEach(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<Uint8List> handleError(
|
Stream<List<int>> handleError(
|
||||||
Function onError, {
|
Function onError, {
|
||||||
bool Function(dynamic error) test,
|
bool Function(dynamic error) test,
|
||||||
}) {
|
}) {
|
||||||
@ -524,11 +523,11 @@ class FakeHttpClientResponse implements HttpClientResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Uint8List> get last => _delegate.last;
|
Future<List<int>> get last => _delegate.last;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Uint8List> lastWhere(
|
Future<List<int>> lastWhere(
|
||||||
bool Function(Uint8List element) test, {
|
bool Function(List<int> element) test, {
|
||||||
List<int> Function() orElse,
|
List<int> Function() orElse,
|
||||||
}) {
|
}) {
|
||||||
return _delegate.lastWhere(test, orElse: orElse);
|
return _delegate.lastWhere(test, orElse: orElse);
|
||||||
@ -538,7 +537,7 @@ class FakeHttpClientResponse implements HttpClientResponse {
|
|||||||
Future<int> get length => _delegate.length;
|
Future<int> get length => _delegate.length;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<S> map<S>(S Function(Uint8List event) convert) {
|
Stream<S> map<S>(S Function(List<int> event) convert) {
|
||||||
return _delegate.map<S>(convert);
|
return _delegate.map<S>(convert);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,53 +547,53 @@ class FakeHttpClientResponse implements HttpClientResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Uint8List> reduce(List<int> Function(Uint8List previous, Uint8List element) combine) {
|
Future<List<int>> reduce(List<int> Function(List<int> previous, List<int> element) combine) {
|
||||||
return _delegate.reduce(combine);
|
return _delegate.reduce(combine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Uint8List> get single => _delegate.single;
|
Future<List<int>> get single => _delegate.single;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Uint8List> singleWhere(bool Function(Uint8List element) test, {List<int> Function() orElse}) {
|
Future<List<int>> singleWhere(bool Function(List<int> element) test, {List<int> Function() orElse}) {
|
||||||
return _delegate.singleWhere(test, orElse: orElse);
|
return _delegate.singleWhere(test, orElse: orElse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<Uint8List> skip(int count) {
|
Stream<List<int>> skip(int count) {
|
||||||
return _delegate.skip(count);
|
return _delegate.skip(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<Uint8List> skipWhile(bool Function(Uint8List element) test) {
|
Stream<List<int>> skipWhile(bool Function(List<int> element) test) {
|
||||||
return _delegate.skipWhile(test);
|
return _delegate.skipWhile(test);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<Uint8List> take(int count) {
|
Stream<List<int>> take(int count) {
|
||||||
return _delegate.take(count);
|
return _delegate.take(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<Uint8List> takeWhile(bool Function(Uint8List element) test) {
|
Stream<List<int>> takeWhile(bool Function(List<int> element) test) {
|
||||||
return _delegate.takeWhile(test);
|
return _delegate.takeWhile(test);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<Uint8List> timeout(
|
Stream<List<int>> timeout(
|
||||||
Duration timeLimit, {
|
Duration timeLimit, {
|
||||||
void Function(EventSink<Uint8List> sink) onTimeout,
|
void Function(EventSink<List<int>> sink) onTimeout,
|
||||||
}) {
|
}) {
|
||||||
return _delegate.timeout(timeLimit, onTimeout: onTimeout);
|
return _delegate.timeout(timeLimit, onTimeout: onTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<Uint8List>> toList() {
|
Future<List<List<int>>> toList() {
|
||||||
return _delegate.toList();
|
return _delegate.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Set<Uint8List>> toSet() {
|
Future<Set<List<int>>> toSet() {
|
||||||
return _delegate.toSet();
|
return _delegate.toSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,7 +603,7 @@ class FakeHttpClientResponse implements HttpClientResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<Uint8List> where(bool Function(Uint8List event) test) {
|
Stream<List<int>> where(bool Function(List<int> event) test) {
|
||||||
return _delegate.where(test);
|
return _delegate.where(test);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ Future<void> main() async {
|
|||||||
.transform<String>(utf8.decoder)
|
.transform<String>(utf8.decoder)
|
||||||
.transform<String>(const LineSplitter())
|
.transform<String>(const LineSplitter())
|
||||||
.listen((String line) => print('<== $line'));
|
.listen((String line) => print('<== $line'));
|
||||||
daemon.stderr.listen((dynamic data) => stderr.add(data));
|
daemon.stderr.listen(stderr.add);
|
||||||
|
|
||||||
stdout.write('> ');
|
stdout.write('> ');
|
||||||
stdin.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).listen((String line) {
|
stdin.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).listen((String line) {
|
||||||
|
@ -89,7 +89,7 @@ class VMPlatform extends PlatformPlugin {
|
|||||||
_pending.remove(codePath);
|
_pending.remove(codePath);
|
||||||
}));
|
}));
|
||||||
final ServiceProtocolInfo info = await Service.controlWebServer(enable: true);
|
final ServiceProtocolInfo info = await Service.controlWebServer(enable: true);
|
||||||
final dynamic channel = IsolateChannel<Object>.connectReceive(receivePort)
|
final StreamChannel<Object> channel = IsolateChannel<Object>.connectReceive(receivePort)
|
||||||
.transformStream(StreamTransformer<Object, Object>.fromHandlers(
|
.transformStream(StreamTransformer<Object, Object>.fromHandlers(
|
||||||
handleDone: (EventSink<Object> sink) async {
|
handleDone: (EventSink<Object> sink) async {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user