Null safety migration of packages/flutter_tools/test/general.shard, part 1/2 (#110711)
* Migrate packages/flutter_tools/test/general.shard, part 1/2 * Fix most of the tests * Fix analysis * Fix analysis * Fix test * Fix analysis * Fix analysis * Fix nit
This commit is contained in:
parent
6f9bcec40b
commit
ec75399beb
@ -80,7 +80,7 @@ class CleanCommand extends FlutterCommand {
|
|||||||
try {
|
try {
|
||||||
final XcodeProjectInterpreter xcodeProjectInterpreter = globals.xcodeProjectInterpreter!;
|
final XcodeProjectInterpreter xcodeProjectInterpreter = globals.xcodeProjectInterpreter!;
|
||||||
final Directory xcodeWorkspace = xcodeProject.xcodeWorkspace;
|
final Directory xcodeWorkspace = xcodeProject.xcodeWorkspace;
|
||||||
final XcodeProjectInfo projectInfo = await xcodeProjectInterpreter.getInfo(xcodeWorkspace.parent.path);
|
final XcodeProjectInfo projectInfo = (await xcodeProjectInterpreter.getInfo(xcodeWorkspace.parent.path))!;
|
||||||
for (final String scheme in projectInfo.schemes) {
|
for (final String scheme in projectInfo.schemes) {
|
||||||
await xcodeProjectInterpreter.cleanWorkspace(xcodeWorkspace.path, scheme, verbose: _verbose);
|
await xcodeProjectInterpreter.cleanWorkspace(xcodeWorkspace.path, scheme, verbose: _verbose);
|
||||||
}
|
}
|
||||||
|
@ -96,15 +96,15 @@ class WebDriverService extends DriverService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
bool isAppStarted = false;
|
bool isAppStarted = false;
|
||||||
await Future.any<Object>(<Future<Object>>[
|
await Future.any(<Future<Object?>>[
|
||||||
runFuture.then((int? result) {
|
runFuture.then((int? result) {
|
||||||
_runResult = result;
|
_runResult = result;
|
||||||
return null;
|
return null;
|
||||||
} as FutureOr<Object> Function(int?)),
|
}),
|
||||||
appStartedCompleter.future.then((_) {
|
appStartedCompleter.future.then((_) {
|
||||||
isAppStarted = true;
|
isAppStarted = true;
|
||||||
return null;
|
return null;
|
||||||
} as FutureOr<Object> Function(void)),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (_runResult != null) {
|
if (_runResult != null) {
|
||||||
|
@ -306,7 +306,7 @@ class XcodeProjectInterpreter {
|
|||||||
], workingDirectory: _fileSystem.currentDirectory.path);
|
], workingDirectory: _fileSystem.currentDirectory.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<XcodeProjectInfo> getInfo(String projectPath, {String? projectFilename}) async {
|
Future<XcodeProjectInfo?> getInfo(String projectPath, {String? projectFilename}) async {
|
||||||
// The exit code returned by 'xcodebuild -list' when either:
|
// The exit code returned by 'xcodebuild -list' when either:
|
||||||
// * -project is passed and the given project isn't there, or
|
// * -project is passed and the given project isn't there, or
|
||||||
// * no -project is passed and there isn't a project.
|
// * no -project is passed and there isn't a project.
|
||||||
|
@ -84,15 +84,15 @@ Future<void> buildMacOS({
|
|||||||
// other Xcode projects in the macos/ directory. Otherwise pass no name, which will work
|
// other Xcode projects in the macos/ directory. Otherwise pass no name, which will work
|
||||||
// regardless of the project name so long as there is exactly one project.
|
// regardless of the project name so long as there is exactly one project.
|
||||||
final String? xcodeProjectName = xcodeProject.existsSync() ? xcodeProject.basename : null;
|
final String? xcodeProjectName = xcodeProject.existsSync() ? xcodeProject.basename : null;
|
||||||
final XcodeProjectInfo projectInfo = await globals.xcodeProjectInterpreter!.getInfo(
|
final XcodeProjectInfo? projectInfo = await globals.xcodeProjectInterpreter?.getInfo(
|
||||||
xcodeProject.parent.path,
|
xcodeProject.parent.path,
|
||||||
projectFilename: xcodeProjectName,
|
projectFilename: xcodeProjectName,
|
||||||
);
|
);
|
||||||
final String? scheme = projectInfo.schemeFor(buildInfo);
|
final String? scheme = projectInfo?.schemeFor(buildInfo);
|
||||||
if (scheme == null) {
|
if (scheme == null) {
|
||||||
projectInfo.reportFlavorNotFoundAndExit();
|
projectInfo!.reportFlavorNotFoundAndExit();
|
||||||
}
|
}
|
||||||
final String? configuration = projectInfo.buildConfigurationFor(buildInfo, scheme);
|
final String? configuration = projectInfo?.buildConfigurationFor(buildInfo, scheme);
|
||||||
if (configuration == null) {
|
if (configuration == null) {
|
||||||
throwToolExit('Unable to find expected configuration in Xcode project.');
|
throwToolExit('Unable to find expected configuration in Xcode project.');
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:fake_async/fake_async.dart';
|
import 'package:fake_async/fake_async.dart';
|
||||||
@ -13,7 +11,6 @@ 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/commands/daemon.dart';
|
import 'package:flutter_tools/src/commands/daemon.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
@ -232,7 +229,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('AppContext', () {
|
group('AppContext', () {
|
||||||
FakeStopwatch fakeStopWatch;
|
late FakeStopwatch fakeStopWatch;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
fakeStopWatch = FakeStopwatch();
|
fakeStopWatch = FakeStopwatch();
|
||||||
@ -365,10 +362,10 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('Spinners', () {
|
group('Spinners', () {
|
||||||
FakeStdio mockStdio;
|
late FakeStdio mockStdio;
|
||||||
FakeStopwatch mockStopwatch;
|
late FakeStopwatch mockStopwatch;
|
||||||
FakeStopwatchFactory stopwatchFactory;
|
late FakeStopwatchFactory stopwatchFactory;
|
||||||
int called;
|
late int called;
|
||||||
final List<Platform> testPlatforms = <Platform>[
|
final List<Platform> testPlatforms = <Platform>[
|
||||||
FakePlatform(
|
FakePlatform(
|
||||||
environment: <String, String>{},
|
environment: <String, String>{},
|
||||||
@ -404,8 +401,8 @@ void main() {
|
|||||||
stopwatchFactory = FakeStopwatchFactory(stopwatch: mockStopwatch);
|
stopwatchFactory = FakeStopwatchFactory(stopwatch: mockStopwatch);
|
||||||
});
|
});
|
||||||
|
|
||||||
List<String> outputStdout() => mockStdio.writtenToStdout.join('').split('\n');
|
List<String> outputStdout() => mockStdio.writtenToStdout.join().split('\n');
|
||||||
List<String> outputStderr() => mockStdio.writtenToStderr.join('').split('\n');
|
List<String> outputStderr() => mockStdio.writtenToStderr.join().split('\n');
|
||||||
|
|
||||||
void doWhileAsync(FakeAsync time, bool Function() doThis) {
|
void doWhileAsync(FakeAsync time, bool Function() doThis) {
|
||||||
do {
|
do {
|
||||||
@ -416,11 +413,11 @@ void main() {
|
|||||||
|
|
||||||
for (final Platform testPlatform in testPlatforms) {
|
for (final Platform testPlatform in testPlatforms) {
|
||||||
group('(${testPlatform.operatingSystem})', () {
|
group('(${testPlatform.operatingSystem})', () {
|
||||||
Platform platform;
|
late Platform platform;
|
||||||
Platform ansiPlatform;
|
late Platform ansiPlatform;
|
||||||
AnsiTerminal terminal;
|
late AnsiTerminal terminal;
|
||||||
AnsiTerminal coloredTerminal;
|
late AnsiTerminal coloredTerminal;
|
||||||
SpinnerStatus spinnerStatus;
|
late SpinnerStatus spinnerStatus;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
platform = FakePlatform();
|
platform = FakePlatform();
|
||||||
@ -517,7 +514,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
final Status status = logger.startProgress(
|
final Status status = logger.startProgress(
|
||||||
'Hello',
|
'Hello',
|
||||||
progressId: null,
|
|
||||||
progressIndicatorPadding: 20, // this minus the "Hello" equals the 15 below.
|
progressIndicatorPadding: 20, // this minus the "Hello" equals the 15 below.
|
||||||
);
|
);
|
||||||
expect(outputStderr().length, equals(1));
|
expect(outputStderr().length, equals(1));
|
||||||
@ -679,7 +675,7 @@ void main() {
|
|||||||
expect(times, hasLength(1));
|
expect(times, hasLength(1));
|
||||||
final Match match = times.single;
|
final Match match = times.single;
|
||||||
|
|
||||||
expect(lines[0], endsWith(match.group(0)));
|
expect(lines[0], endsWith(match.group(0)!));
|
||||||
expect(called, equals(1));
|
expect(called, equals(1));
|
||||||
expect(lines.length, equals(2));
|
expect(lines.length, equals(2));
|
||||||
expect(lines[1], equals(''));
|
expect(lines[1], equals(''));
|
||||||
@ -696,9 +692,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('Output format', () {
|
group('Output format', () {
|
||||||
FakeStdio fakeStdio;
|
late FakeStdio fakeStdio;
|
||||||
SummaryStatus summaryStatus;
|
late SummaryStatus summaryStatus;
|
||||||
int called;
|
late int called;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
fakeStdio = FakeStdio();
|
fakeStdio = FakeStdio();
|
||||||
@ -712,8 +708,8 @@ void main() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
List<String> outputStdout() => fakeStdio.writtenToStdout.join('').split('\n');
|
List<String> outputStdout() => fakeStdio.writtenToStdout.join().split('\n');
|
||||||
List<String> outputStderr() => fakeStdio.writtenToStderr.join('').split('\n');
|
List<String> outputStderr() => fakeStdio.writtenToStderr.join().split('\n');
|
||||||
|
|
||||||
testWithoutContext('Error logs are wrapped', () async {
|
testWithoutContext('Error logs are wrapped', () async {
|
||||||
final Logger logger = StdoutLogger(
|
final Logger logger = StdoutLogger(
|
||||||
@ -739,7 +735,7 @@ void main() {
|
|||||||
final BufferLogger buffer = BufferLogger.test();
|
final BufferLogger buffer = BufferLogger.test();
|
||||||
final AppRunLogger logger = AppRunLogger(parent: buffer);
|
final AppRunLogger logger = AppRunLogger(parent: buffer);
|
||||||
|
|
||||||
logger.startProgress('Test status...', timeout: null).stop();
|
logger.startProgress('Test status...').stop();
|
||||||
|
|
||||||
expect(buffer.statusText.trim(), equals('Test status...'));
|
expect(buffer.statusText.trim(), equals('Test status...'));
|
||||||
});
|
});
|
||||||
@ -936,51 +932,6 @@ void main() {
|
|||||||
expect(lines[0], equals('All good.'));
|
expect(lines[0], equals('All good.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Stdout printStatus handle null inputs on colored terminal', () async {
|
|
||||||
final Logger logger = StdoutLogger(
|
|
||||||
terminal: AnsiTerminal(
|
|
||||||
stdio: fakeStdio,
|
|
||||||
platform: FakePlatform(),
|
|
||||||
),
|
|
||||||
stdio: fakeStdio,
|
|
||||||
outputPreferences: OutputPreferences.test(showColor: true),
|
|
||||||
);
|
|
||||||
logger.printStatus(
|
|
||||||
null,
|
|
||||||
emphasis: null,
|
|
||||||
color: null,
|
|
||||||
newline: null,
|
|
||||||
indent: null,
|
|
||||||
);
|
|
||||||
final List<String> lines = outputStdout();
|
|
||||||
|
|
||||||
expect(outputStderr().length, equals(1));
|
|
||||||
expect(outputStderr().first, isEmpty);
|
|
||||||
expect(lines[0], equals(''));
|
|
||||||
});
|
|
||||||
|
|
||||||
testWithoutContext('Stdout printStatus handle null inputs on non-color terminal', () async {
|
|
||||||
final Logger logger = StdoutLogger(
|
|
||||||
terminal: AnsiTerminal(
|
|
||||||
stdio: fakeStdio,
|
|
||||||
platform: _kNoAnsiPlatform,
|
|
||||||
),
|
|
||||||
stdio: fakeStdio,
|
|
||||||
outputPreferences: OutputPreferences.test(),
|
|
||||||
);
|
|
||||||
logger.printStatus(
|
|
||||||
null,
|
|
||||||
emphasis: null,
|
|
||||||
color: null,
|
|
||||||
newline: null,
|
|
||||||
indent: null,
|
|
||||||
);
|
|
||||||
final List<String> lines = outputStdout();
|
|
||||||
expect(outputStderr().length, equals(1));
|
|
||||||
expect(outputStderr().first, isEmpty);
|
|
||||||
expect(lines[0], equals(''));
|
|
||||||
});
|
|
||||||
|
|
||||||
testWithoutContext('Stdout printBox puts content inside a box', () {
|
testWithoutContext('Stdout printBox puts content inside a box', () {
|
||||||
final Logger logger = StdoutLogger(
|
final Logger logger = StdoutLogger(
|
||||||
terminal: AnsiTerminal(
|
terminal: AnsiTerminal(
|
||||||
@ -991,7 +942,7 @@ void main() {
|
|||||||
outputPreferences: OutputPreferences.test(showColor: true),
|
outputPreferences: OutputPreferences.test(showColor: true),
|
||||||
);
|
);
|
||||||
logger.printBox('Hello world', title: 'Test title');
|
logger.printBox('Hello world', title: 'Test title');
|
||||||
final String stdout = fakeStdio.writtenToStdout.join('');
|
final String stdout = fakeStdio.writtenToStdout.join();
|
||||||
expect(stdout,
|
expect(stdout,
|
||||||
contains(
|
contains(
|
||||||
'\n'
|
'\n'
|
||||||
@ -1012,7 +963,7 @@ void main() {
|
|||||||
outputPreferences: OutputPreferences.test(showColor: true),
|
outputPreferences: OutputPreferences.test(showColor: true),
|
||||||
);
|
);
|
||||||
logger.printBox('Hello world');
|
logger.printBox('Hello world');
|
||||||
final String stdout = fakeStdio.writtenToStdout.join('');
|
final String stdout = fakeStdio.writtenToStdout.join();
|
||||||
expect(stdout,
|
expect(stdout,
|
||||||
contains(
|
contains(
|
||||||
'\n'
|
'\n'
|
||||||
@ -1033,7 +984,7 @@ void main() {
|
|||||||
outputPreferences: OutputPreferences.test(showColor: true),
|
outputPreferences: OutputPreferences.test(showColor: true),
|
||||||
);
|
);
|
||||||
logger.printBox('Hello world\nThis is a new line', title: 'Test title');
|
logger.printBox('Hello world\nThis is a new line', title: 'Test title');
|
||||||
final String stdout = fakeStdio.writtenToStdout.join('');
|
final String stdout = fakeStdio.writtenToStdout.join();
|
||||||
expect(stdout,
|
expect(stdout,
|
||||||
contains(
|
contains(
|
||||||
'\n'
|
'\n'
|
||||||
@ -1057,7 +1008,7 @@ void main() {
|
|||||||
const String bold = '\u001B[1m';
|
const String bold = '\u001B[1m';
|
||||||
const String clear = '\u001B[2J\u001B[H';
|
const String clear = '\u001B[2J\u001B[H';
|
||||||
logger.printBox('${bold}Hello world$clear', title: 'Test title');
|
logger.printBox('${bold}Hello world$clear', title: 'Test title');
|
||||||
final String stdout = fakeStdio.writtenToStdout.join('');
|
final String stdout = fakeStdio.writtenToStdout.join();
|
||||||
expect(stdout,
|
expect(stdout,
|
||||||
contains(
|
contains(
|
||||||
'\n'
|
'\n'
|
||||||
@ -1079,7 +1030,7 @@ void main() {
|
|||||||
outputPreferences: OutputPreferences.test(showColor: true, wrapColumn: columnLimit),
|
outputPreferences: OutputPreferences.test(showColor: true, wrapColumn: columnLimit),
|
||||||
);
|
);
|
||||||
logger.printBox('This line is longer than $columnLimit characters', title: 'Test');
|
logger.printBox('This line is longer than $columnLimit characters', title: 'Test');
|
||||||
final String stdout = fakeStdio.writtenToStdout.join('');
|
final String stdout = fakeStdio.writtenToStdout.join();
|
||||||
final List<String> stdoutLines = stdout.split('\n');
|
final List<String> stdoutLines = stdout.split('\n');
|
||||||
|
|
||||||
expect(stdoutLines.length, greaterThan(1));
|
expect(stdoutLines.length, greaterThan(1));
|
||||||
@ -1108,7 +1059,7 @@ void main() {
|
|||||||
outputPreferences: OutputPreferences.test(showColor: true, wrapColumn: columnLimit),
|
outputPreferences: OutputPreferences.test(showColor: true, wrapColumn: columnLimit),
|
||||||
);
|
);
|
||||||
logger.printBox('This\nline is longer than\n\n$columnLimit characters', title: 'Test');
|
logger.printBox('This\nline is longer than\n\n$columnLimit characters', title: 'Test');
|
||||||
final String stdout = fakeStdio.writtenToStdout.join('');
|
final String stdout = fakeStdio.writtenToStdout.join();
|
||||||
final List<String> stdoutLines = stdout.split('\n');
|
final List<String> stdoutLines = stdout.split('\n');
|
||||||
|
|
||||||
expect(stdoutLines.length, greaterThan(1));
|
expect(stdoutLines.length, greaterThan(1));
|
||||||
@ -1140,7 +1091,7 @@ void main() {
|
|||||||
outputPreferences: OutputPreferences.test(showColor: true, wrapColumn: columnLimit),
|
outputPreferences: OutputPreferences.test(showColor: true, wrapColumn: columnLimit),
|
||||||
);
|
);
|
||||||
logger.printBox('Thiswordislongerthan${columnLimit}characters', title: 'Test');
|
logger.printBox('Thiswordislongerthan${columnLimit}characters', title: 'Test');
|
||||||
final String stdout = fakeStdio.writtenToStdout.join('');
|
final String stdout = fakeStdio.writtenToStdout.join();
|
||||||
final List<String> stdoutLines = stdout.split('\n');
|
final List<String> stdoutLines = stdout.split('\n');
|
||||||
|
|
||||||
expect(stdoutLines.length, greaterThan(1));
|
expect(stdoutLines.length, greaterThan(1));
|
||||||
@ -1172,7 +1123,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
final Status status = logger.startProgress(
|
final Status status = logger.startProgress(
|
||||||
'Hello',
|
'Hello',
|
||||||
progressId: null,
|
|
||||||
progressIndicatorPadding: 20, // this minus the "Hello" equals the 15 below.
|
progressIndicatorPadding: 20, // this minus the "Hello" equals the 15 below.
|
||||||
);
|
);
|
||||||
expect(outputStderr().length, equals(1));
|
expect(outputStderr().length, equals(1));
|
||||||
@ -1328,14 +1278,14 @@ Matcher _throwsInvocationFor(dynamic Function() fakeCall) =>
|
|||||||
throwsA(_matchesInvocation(_invocationFor(fakeCall)));
|
throwsA(_matchesInvocation(_invocationFor(fakeCall)));
|
||||||
|
|
||||||
class FakeStdout extends Fake implements Stdout {
|
class FakeStdout extends Fake implements Stdout {
|
||||||
FakeStdout({@required this.syncError, this.completeWithError = false});
|
FakeStdout({required this.syncError, this.completeWithError = false});
|
||||||
|
|
||||||
final bool syncError;
|
final bool syncError;
|
||||||
final bool completeWithError;
|
final bool completeWithError;
|
||||||
final Completer<void> _completer = Completer<void>();
|
final Completer<void> _completer = Completer<void>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void write(Object object) {
|
void write(Object? object) {
|
||||||
if (syncError) {
|
if (syncError) {
|
||||||
throw Exception('Error!');
|
throw Exception('Error!');
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:args/args.dart';
|
import 'package:args/args.dart';
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:file/src/interface/file_system.dart';
|
import 'package:file/src/interface/file_system.dart';
|
||||||
@ -282,7 +280,7 @@ class FakeWebRunnerFactory implements WebRunnerFactory {
|
|||||||
final bool doResolveToError;
|
final bool doResolveToError;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ResidentRunner createWebRunner(FlutterDevice device, {String target, bool stayResident, FlutterProject flutterProject, bool ipv6, DebuggingOptions debuggingOptions, UrlTunneller urlTunneller, Logger logger, FileSystem fileSystem, SystemClock systemClock, Usage usage, bool machine = false}) {
|
ResidentRunner createWebRunner(FlutterDevice device, {String? target, bool? stayResident, FlutterProject? flutterProject, bool? ipv6, DebuggingOptions? debuggingOptions, UrlTunneller? urlTunneller, Logger? logger, FileSystem? fileSystem, SystemClock? systemClock, Usage? usage, bool machine = false}) {
|
||||||
expect(stayResident, isTrue);
|
expect(stayResident, isTrue);
|
||||||
return FakeResidentRunner(
|
return FakeResidentRunner(
|
||||||
doResolveToError: doResolveToError,
|
doResolveToError: doResolveToError,
|
||||||
@ -292,12 +290,12 @@ class FakeWebRunnerFactory implements WebRunnerFactory {
|
|||||||
|
|
||||||
class FakeResidentRunner extends Fake implements ResidentRunner {
|
class FakeResidentRunner extends Fake implements ResidentRunner {
|
||||||
FakeResidentRunner({
|
FakeResidentRunner({
|
||||||
this.doResolveToError,
|
required this.doResolveToError,
|
||||||
}) {
|
}) {
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FakeResidentRunner instance;
|
static late FakeResidentRunner instance;
|
||||||
|
|
||||||
final bool doResolveToError;
|
final bool doResolveToError;
|
||||||
final Completer<int> _exitCompleter = Completer<int>();
|
final Completer<int> _exitCompleter = Completer<int>();
|
||||||
@ -308,10 +306,10 @@ class FakeResidentRunner extends Fake implements ResidentRunner {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<int> run({
|
Future<int> run({
|
||||||
Completer<DebugConnectionInfo> connectionInfoCompleter,
|
Completer<DebugConnectionInfo>? connectionInfoCompleter,
|
||||||
Completer<void> appStartedCompleter,
|
Completer<void>? appStartedCompleter,
|
||||||
bool enableDevTools = false,
|
bool enableDevTools = false,
|
||||||
String route,
|
String? route,
|
||||||
}) async {
|
}) async {
|
||||||
callLog.add('run');
|
callLog.add('run');
|
||||||
|
|
||||||
@ -319,7 +317,7 @@ class FakeResidentRunner extends Fake implements ResidentRunner {
|
|||||||
return Future<int>.error('This is a test error');
|
return Future<int>.error('This is a test error');
|
||||||
}
|
}
|
||||||
|
|
||||||
appStartedCompleter.complete();
|
appStartedCompleter?.complete();
|
||||||
// Emulate stayResident by completing after exitApp is called.
|
// Emulate stayResident by completing after exitApp is called.
|
||||||
return _exitCompleter.future;
|
return _exitCompleter.future;
|
||||||
}
|
}
|
||||||
@ -327,7 +325,7 @@ class FakeResidentRunner extends Fake implements ResidentRunner {
|
|||||||
@override
|
@override
|
||||||
Future<void> exitApp() async {
|
Future<void> exitApp() async {
|
||||||
callLog.add('exitApp');
|
callLog.add('exitApp');
|
||||||
_exitCompleter.complete();
|
_exitCompleter.complete(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
@ -24,7 +22,6 @@ import 'package:flutter_tools/src/fuchsia/fuchsia_sdk.dart';
|
|||||||
import 'package:flutter_tools/src/fuchsia/pkgctl.dart';
|
import 'package:flutter_tools/src/fuchsia/pkgctl.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
@ -33,14 +30,14 @@ import '../../src/fakes.dart';
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('Fuchsia app start and stop: ', () {
|
group('Fuchsia app start and stop: ', () {
|
||||||
MemoryFileSystem memoryFileSystem;
|
late MemoryFileSystem memoryFileSystem;
|
||||||
FakeOperatingSystemUtils osUtils;
|
late FakeOperatingSystemUtils osUtils;
|
||||||
FakeFuchsiaDeviceTools fuchsiaDeviceTools;
|
late FakeFuchsiaDeviceTools fuchsiaDeviceTools;
|
||||||
FakeFuchsiaSdk fuchsiaSdk;
|
late FakeFuchsiaSdk fuchsiaSdk;
|
||||||
Artifacts artifacts;
|
late Artifacts artifacts;
|
||||||
FakeProcessManager fakeSuccessfulProcessManager;
|
late FakeProcessManager fakeSuccessfulProcessManager;
|
||||||
FakeProcessManager fakeFailedProcessManagerForHostAddress;
|
late FakeProcessManager fakeFailedProcessManagerForHostAddress;
|
||||||
File sshConfig;
|
late File sshConfig;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
memoryFileSystem = MemoryFileSystem.test();
|
memoryFileSystem = MemoryFileSystem.test();
|
||||||
@ -113,8 +110,8 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Future<LaunchResult> setupAndStartApp({
|
Future<LaunchResult> setupAndStartApp({
|
||||||
@required bool prebuilt,
|
required bool prebuilt,
|
||||||
@required BuildMode mode,
|
required BuildMode mode,
|
||||||
}) async {
|
}) async {
|
||||||
const String appName = 'app_name';
|
const String appName = 'app_name';
|
||||||
final FuchsiaDevice device = FuchsiaDeviceWithFakeDiscovery('123');
|
final FuchsiaDevice device = FuchsiaDeviceWithFakeDiscovery('123');
|
||||||
@ -122,7 +119,7 @@ void main() {
|
|||||||
final File pubspecFile = globals.fs.file('pubspec.yaml')..createSync();
|
final File pubspecFile = globals.fs.file('pubspec.yaml')..createSync();
|
||||||
pubspecFile.writeAsStringSync('name: $appName');
|
pubspecFile.writeAsStringSync('name: $appName');
|
||||||
|
|
||||||
FuchsiaApp app;
|
FuchsiaApp? app;
|
||||||
if (prebuilt) {
|
if (prebuilt) {
|
||||||
final File far = globals.fs.file('app_name-0.far')..createSync();
|
final File far = globals.fs.file('app_name-0.far')..createSync();
|
||||||
app = FuchsiaApp.fromPrebuiltApp(far);
|
app = FuchsiaApp.fromPrebuiltApp(far);
|
||||||
@ -143,7 +140,7 @@ void main() {
|
|||||||
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(
|
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(
|
||||||
BuildInfo(mode, null, treeShakeIcons: false));
|
BuildInfo(mode, null, treeShakeIcons: false));
|
||||||
return device.startApp(
|
return device.startApp(
|
||||||
app,
|
app!,
|
||||||
prebuiltApplication: prebuilt,
|
prebuiltApplication: prebuilt,
|
||||||
debuggingOptions: debuggingOptions,
|
debuggingOptions: debuggingOptions,
|
||||||
);
|
);
|
||||||
@ -191,7 +188,7 @@ void main() {
|
|||||||
pubspecFile.writeAsStringSync('name: $appName');
|
pubspecFile.writeAsStringSync('name: $appName');
|
||||||
final File far = globals.fs.file('app_name-0.far')..createSync();
|
final File far = globals.fs.file('app_name-0.far')..createSync();
|
||||||
|
|
||||||
final FuchsiaApp app = FuchsiaApp.fromPrebuiltApp(far);
|
final FuchsiaApp app = FuchsiaApp.fromPrebuiltApp(far)!;
|
||||||
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(
|
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(
|
||||||
const BuildInfo(BuildMode.release, null, treeShakeIcons: false));
|
const BuildInfo(BuildMode.release, null, treeShakeIcons: false));
|
||||||
final LaunchResult launchResult = await device.startApp(app,
|
final LaunchResult launchResult = await device.startApp(app,
|
||||||
@ -217,7 +214,7 @@ void main() {
|
|||||||
pubspecFile.writeAsStringSync('name: $appName');
|
pubspecFile.writeAsStringSync('name: $appName');
|
||||||
final File far = globals.fs.file('app_name-0.far')..createSync();
|
final File far = globals.fs.file('app_name-0.far')..createSync();
|
||||||
|
|
||||||
final FuchsiaApp app = FuchsiaApp.fromPrebuiltApp(far);
|
final FuchsiaApp app = FuchsiaApp.fromPrebuiltApp(far)!;
|
||||||
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(
|
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(
|
||||||
const BuildInfo(BuildMode.release, null, treeShakeIcons: false));
|
const BuildInfo(BuildMode.release, null, treeShakeIcons: false));
|
||||||
final LaunchResult launchResult = await device.startApp(app,
|
final LaunchResult launchResult = await device.startApp(app,
|
||||||
@ -470,8 +467,7 @@ Process _createFakeProcess({
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FuchsiaDeviceWithFakeDiscovery extends FuchsiaDevice {
|
class FuchsiaDeviceWithFakeDiscovery extends FuchsiaDevice {
|
||||||
FuchsiaDeviceWithFakeDiscovery(String id, {String name})
|
FuchsiaDeviceWithFakeDiscovery(super.id, {super.name = ''});
|
||||||
: super(id, name: name);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FuchsiaIsolateDiscoveryProtocol getIsolateDiscoveryProtocol(
|
FuchsiaIsolateDiscoveryProtocol getIsolateDiscoveryProtocol(
|
||||||
@ -533,8 +529,8 @@ class FailingPkgctl implements FuchsiaPkgctl {
|
|||||||
|
|
||||||
class FakeFuchsiaDeviceTools implements FuchsiaDeviceTools {
|
class FakeFuchsiaDeviceTools implements FuchsiaDeviceTools {
|
||||||
FakeFuchsiaDeviceTools({
|
FakeFuchsiaDeviceTools({
|
||||||
FuchsiaPkgctl pkgctl,
|
FuchsiaPkgctl? pkgctl,
|
||||||
FuchsiaFfx ffx,
|
FuchsiaFfx? ffx,
|
||||||
}) : pkgctl = pkgctl ?? FakeFuchsiaPkgctl(),
|
}) : pkgctl = pkgctl ?? FakeFuchsiaPkgctl(),
|
||||||
ffx = ffx ?? FakeFuchsiaFfx();
|
ffx = ffx ?? FakeFuchsiaFfx();
|
||||||
|
|
||||||
@ -546,7 +542,7 @@ class FakeFuchsiaDeviceTools implements FuchsiaDeviceTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FakeFuchsiaPM implements FuchsiaPM {
|
class FakeFuchsiaPM implements FuchsiaPM {
|
||||||
String _appName;
|
String? _appName;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> init(String buildPath, String appName) async {
|
Future<bool> init(String buildPath, String appName) async {
|
||||||
@ -651,8 +647,8 @@ class FailingPM implements FuchsiaPM {
|
|||||||
class FakeFuchsiaKernelCompiler implements FuchsiaKernelCompiler {
|
class FakeFuchsiaKernelCompiler implements FuchsiaKernelCompiler {
|
||||||
@override
|
@override
|
||||||
Future<void> build({
|
Future<void> build({
|
||||||
@required FuchsiaProject fuchsiaProject,
|
required FuchsiaProject fuchsiaProject,
|
||||||
@required String target, // E.g., lib/main.dart
|
required String target, // E.g., lib/main.dart
|
||||||
BuildInfo buildInfo = BuildInfo.debug,
|
BuildInfo buildInfo = BuildInfo.debug,
|
||||||
}) async {
|
}) async {
|
||||||
final String outDir = getFuchsiaBuildDirectory();
|
final String outDir = getFuchsiaBuildDirectory();
|
||||||
@ -665,7 +661,7 @@ class FakeFuchsiaKernelCompiler implements FuchsiaKernelCompiler {
|
|||||||
|
|
||||||
class FakeFuchsiaFfx implements FuchsiaFfx {
|
class FakeFuchsiaFfx implements FuchsiaFfx {
|
||||||
@override
|
@override
|
||||||
Future<List<String>> list({Duration timeout}) async {
|
Future<List<String>> list({Duration? timeout}) async {
|
||||||
return <String>['192.168.42.172 scare-cable-skip-ffx'];
|
return <String>['192.168.42.172 scare-cable-skip-ffx'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -675,7 +671,7 @@ class FakeFuchsiaFfx implements FuchsiaFfx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<String> sessionShow() async {
|
Future<String?> sessionShow() async {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,7 +683,7 @@ class FakeFuchsiaFfx implements FuchsiaFfx {
|
|||||||
|
|
||||||
class FakeFuchsiaFfxWithSession implements FuchsiaFfx {
|
class FakeFuchsiaFfxWithSession implements FuchsiaFfx {
|
||||||
@override
|
@override
|
||||||
Future<List<String>> list({Duration timeout}) async {
|
Future<List<String>> list({Duration? timeout}) async {
|
||||||
return <String>['192.168.42.172 scare-cable-skip-ffx'];
|
return <String>['192.168.42.172 scare-cable-skip-ffx'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,9 +705,9 @@ class FakeFuchsiaFfxWithSession implements FuchsiaFfx {
|
|||||||
|
|
||||||
class FakeFuchsiaSdk extends Fake implements FuchsiaSdk {
|
class FakeFuchsiaSdk extends Fake implements FuchsiaSdk {
|
||||||
FakeFuchsiaSdk({
|
FakeFuchsiaSdk({
|
||||||
FuchsiaPM pm,
|
FuchsiaPM? pm,
|
||||||
FuchsiaKernelCompiler compiler,
|
FuchsiaKernelCompiler? compiler,
|
||||||
FuchsiaFfx ffx,
|
FuchsiaFfx? ffx,
|
||||||
}) : fuchsiaPM = pm ?? FakeFuchsiaPM(),
|
}) : fuchsiaPM = pm ?? FakeFuchsiaPM(),
|
||||||
fuchsiaKernelCompiler = compiler ?? FakeFuchsiaKernelCompiler(),
|
fuchsiaKernelCompiler = compiler ?? FakeFuchsiaKernelCompiler(),
|
||||||
fuchsiaFfx = ffx ?? FakeFuchsiaFfx();
|
fuchsiaFfx = ffx ?? FakeFuchsiaFfx();
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
@ -28,7 +26,6 @@ import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart';
|
|||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:flutter_tools/src/vmservice.dart';
|
import 'package:flutter_tools/src/vmservice.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
import 'package:vm_service/vm_service.dart' as vm_service;
|
import 'package:vm_service/vm_service.dart' as vm_service;
|
||||||
|
|
||||||
@ -56,9 +53,9 @@ final vm_service.Isolate fakeIsolate = vm_service.Isolate(
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('fuchsia device', () {
|
group('fuchsia device', () {
|
||||||
MemoryFileSystem memoryFileSystem;
|
late MemoryFileSystem memoryFileSystem;
|
||||||
File sshConfig;
|
late File sshConfig;
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
memoryFileSystem = MemoryFileSystem.test();
|
memoryFileSystem = MemoryFileSystem.test();
|
||||||
@ -306,8 +303,8 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('displays friendly error when', () {
|
group('displays friendly error when', () {
|
||||||
File artifactFile;
|
late File artifactFile;
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
processManager = FakeProcessManager.empty();
|
processManager = FakeProcessManager.empty();
|
||||||
@ -350,9 +347,9 @@ void main() {
|
|||||||
[2018-11-09 01:30:12][52580][52983][log] INFO: example_app.cm(flutter): Did thing this time
|
[2018-11-09 01:30:12][52580][52983][log] INFO: example_app.cm(flutter): Did thing this time
|
||||||
|
|
||||||
''';
|
''';
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
File ffx;
|
late File ffx;
|
||||||
File sshConfig;
|
late File sshConfig;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
processManager = FakeProcessManager.empty();
|
processManager = FakeProcessManager.empty();
|
||||||
@ -475,7 +472,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('screenshot', () {
|
group('screenshot', () {
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
processManager = FakeProcessManager.empty();
|
processManager = FakeProcessManager.empty();
|
||||||
@ -681,8 +678,8 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('portForwarder', () {
|
group('portForwarder', () {
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
File sshConfig;
|
late File sshConfig;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
processManager = FakeProcessManager.empty();
|
processManager = FakeProcessManager.empty();
|
||||||
@ -746,7 +743,7 @@ void main() {
|
|||||||
fuchsiaDevice,
|
fuchsiaDevice,
|
||||||
expectedIsolateName,
|
expectedIsolateName,
|
||||||
(Uri uri) async => fakeVmServiceHost.vmService,
|
(Uri uri) async => fakeVmServiceHost.vmService,
|
||||||
(Device device, Uri uri, bool enableServiceAuthCodes) => null,
|
(Device device, Uri uri, bool enableServiceAuthCodes) async {},
|
||||||
true, // only poll once.
|
true, // only poll once.
|
||||||
);
|
);
|
||||||
return discoveryProtocol.uri;
|
return discoveryProtocol.uri;
|
||||||
@ -789,7 +786,7 @@ void main() {
|
|||||||
// wrong name.
|
// wrong name.
|
||||||
FlutterView(
|
FlutterView(
|
||||||
id: '2',
|
id: '2',
|
||||||
uiIsolate: vm_service.Isolate.parse(<String, Object>{
|
uiIsolate: vm_service.Isolate.parse(<String, Object?>{
|
||||||
...fakeIsolate.toJson(),
|
...fakeIsolate.toJson(),
|
||||||
'name': 'wrong name',
|
'name': 'wrong name',
|
||||||
})),
|
})),
|
||||||
@ -854,8 +851,8 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('sdkNameAndVersion: ', () {
|
group('sdkNameAndVersion: ', () {
|
||||||
File sshConfig;
|
late File sshConfig;
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
sshConfig = MemoryFileSystem.test().file('ssh_config')
|
sshConfig = MemoryFileSystem.test().file('ssh_config')
|
||||||
@ -934,7 +931,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FuchsiaModulePackage extends ApplicationPackage {
|
class FuchsiaModulePackage extends ApplicationPackage {
|
||||||
FuchsiaModulePackage({@required this.name}) : super(id: name);
|
FuchsiaModulePackage({required this.name}) : super(id: name);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String name;
|
final String name;
|
||||||
@ -982,7 +979,7 @@ class FakePortForwarder extends Fake implements DevicePortForwarder {
|
|||||||
|
|
||||||
class FakeFuchsiaFfx implements FuchsiaFfx {
|
class FakeFuchsiaFfx implements FuchsiaFfx {
|
||||||
@override
|
@override
|
||||||
Future<List<String>> list({Duration timeout}) async {
|
Future<List<String>> list({Duration? timeout}) async {
|
||||||
return <String>['192.168.42.172 scare-cable-skip-ffx'];
|
return <String>['192.168.42.172 scare-cable-skip-ffx'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -992,7 +989,7 @@ class FakeFuchsiaFfx implements FuchsiaFfx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<String> sessionShow() async {
|
Future<String?> sessionShow() async {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1002,14 +999,18 @@ class FakeFuchsiaFfx implements FuchsiaFfx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class FakeFuchsiaPM extends Fake implements FuchsiaPM {}
|
||||||
|
|
||||||
|
class FakeFuchsiaKernelCompiler extends Fake implements FuchsiaKernelCompiler {}
|
||||||
|
|
||||||
class FakeFuchsiaSdk extends Fake implements FuchsiaSdk {
|
class FakeFuchsiaSdk extends Fake implements FuchsiaSdk {
|
||||||
FakeFuchsiaSdk({
|
FakeFuchsiaSdk({
|
||||||
FuchsiaPM pm,
|
FuchsiaPM? pm,
|
||||||
FuchsiaKernelCompiler compiler,
|
FuchsiaKernelCompiler? compiler,
|
||||||
FuchsiaFfx ffx,
|
FuchsiaFfx? ffx,
|
||||||
String devices,
|
String? devices,
|
||||||
}) : fuchsiaPM = pm,
|
}) : fuchsiaPM = pm ?? FakeFuchsiaPM(),
|
||||||
fuchsiaKernelCompiler = compiler,
|
fuchsiaKernelCompiler = compiler ?? FakeFuchsiaKernelCompiler(),
|
||||||
fuchsiaFfx = ffx ?? FakeFuchsiaFfx(),
|
fuchsiaFfx = ffx ?? FakeFuchsiaFfx(),
|
||||||
_devices = devices;
|
_devices = devices;
|
||||||
|
|
||||||
@ -1022,10 +1023,10 @@ class FakeFuchsiaSdk extends Fake implements FuchsiaSdk {
|
|||||||
@override
|
@override
|
||||||
final FuchsiaFfx fuchsiaFfx;
|
final FuchsiaFfx fuchsiaFfx;
|
||||||
|
|
||||||
final String _devices;
|
final String? _devices;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<String> listDevices({Duration timeout}) async {
|
Future<String?> listDevices({Duration? timeout}) async {
|
||||||
return _devices;
|
return _devices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1035,10 +1036,10 @@ class FakeDartDevelopmentService extends Fake
|
|||||||
@override
|
@override
|
||||||
Future<void> startDartDevelopmentService(
|
Future<void> startDartDevelopmentService(
|
||||||
Uri observatoryUri, {
|
Uri observatoryUri, {
|
||||||
@required Logger logger,
|
required Logger logger,
|
||||||
int hostPort,
|
int? hostPort,
|
||||||
bool ipv6,
|
bool? ipv6,
|
||||||
bool disableServiceAuthCodes,
|
bool? disableServiceAuthCodes,
|
||||||
bool cacheStartupProfile = false,
|
bool cacheStartupProfile = false,
|
||||||
}) async {}
|
}) async {}
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:fake_async/fake_async.dart';
|
import 'package:fake_async/fake_async.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:file_testing/file_testing.dart';
|
import 'package:file_testing/file_testing.dart';
|
||||||
@ -23,7 +21,6 @@ import 'package:flutter_tools/src/ios/mac.dart';
|
|||||||
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
||||||
import 'package:flutter_tools/src/macos/xcode.dart';
|
import 'package:flutter_tools/src/macos/xcode.dart';
|
||||||
import 'package:flutter_tools/src/project.dart';
|
import 'package:flutter_tools/src/project.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
@ -76,8 +73,8 @@ final FakePlatform macPlatform = FakePlatform(
|
|||||||
);
|
);
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
Artifacts artifacts;
|
late Artifacts artifacts;
|
||||||
String iosDeployPath;
|
late String iosDeployPath;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
artifacts = Artifacts.test();
|
artifacts = Artifacts.test();
|
||||||
@ -85,12 +82,12 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('IOSDevice.startApp succeeds in release mode', () {
|
group('IOSDevice.startApp succeeds in release mode', () {
|
||||||
FileSystem fileSystem;
|
late FileSystem fileSystem;
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
BufferLogger logger;
|
late BufferLogger logger;
|
||||||
Xcode xcode;
|
late Xcode xcode;
|
||||||
FakeXcodeProjectInterpreter fakeXcodeProjectInterpreter;
|
late FakeXcodeProjectInterpreter fakeXcodeProjectInterpreter;
|
||||||
XcodeProjectInfo projectInfo;
|
late XcodeProjectInfo projectInfo;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
logger = BufferLogger.test();
|
logger = BufferLogger.test();
|
||||||
@ -168,7 +165,7 @@ void main() {
|
|||||||
FileSystem: () => fileSystem,
|
FileSystem: () => fileSystem,
|
||||||
Logger: () => logger,
|
Logger: () => logger,
|
||||||
Platform: () => macPlatform,
|
Platform: () => macPlatform,
|
||||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreter(projectInfo: null),
|
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreter(),
|
||||||
Xcode: () => xcode,
|
Xcode: () => xcode,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -305,10 +302,10 @@ void setUpIOSProject(FileSystem fileSystem) {
|
|||||||
|
|
||||||
IOSDevice setUpIOSDevice({
|
IOSDevice setUpIOSDevice({
|
||||||
String sdkVersion = '13.0.1',
|
String sdkVersion = '13.0.1',
|
||||||
FileSystem fileSystem,
|
FileSystem? fileSystem,
|
||||||
Logger logger,
|
Logger? logger,
|
||||||
ProcessManager processManager,
|
ProcessManager? processManager,
|
||||||
Artifacts artifacts,
|
Artifacts? artifacts,
|
||||||
}) {
|
}) {
|
||||||
artifacts ??= Artifacts.test();
|
artifacts ??= Artifacts.test();
|
||||||
final Cache cache = Cache.test(
|
final Cache cache = Cache.test(
|
||||||
@ -347,7 +344,7 @@ IOSDevice setUpIOSDevice({
|
|||||||
|
|
||||||
class FakeXcodeProjectInterpreter extends Fake implements XcodeProjectInterpreter {
|
class FakeXcodeProjectInterpreter extends Fake implements XcodeProjectInterpreter {
|
||||||
FakeXcodeProjectInterpreter({
|
FakeXcodeProjectInterpreter({
|
||||||
@required this.projectInfo,
|
this.projectInfo,
|
||||||
this.buildSettings = const <String, String>{
|
this.buildSettings = const <String, String>{
|
||||||
'TARGET_BUILD_DIR': 'build/ios/Release-iphoneos',
|
'TARGET_BUILD_DIR': 'build/ios/Release-iphoneos',
|
||||||
'WRAPPER_NAME': 'My Super Awesome App.app',
|
'WRAPPER_NAME': 'My Super Awesome App.app',
|
||||||
@ -356,7 +353,7 @@ class FakeXcodeProjectInterpreter extends Fake implements XcodeProjectInterprete
|
|||||||
});
|
});
|
||||||
|
|
||||||
final Map<String, String> buildSettings;
|
final Map<String, String> buildSettings;
|
||||||
final XcodeProjectInfo projectInfo;
|
final XcodeProjectInfo? projectInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final bool isInstalled = true;
|
final bool isInstalled = true;
|
||||||
@ -371,15 +368,15 @@ class FakeXcodeProjectInterpreter extends Fake implements XcodeProjectInterprete
|
|||||||
List<String> xcrunCommand() => <String>['xcrun'];
|
List<String> xcrunCommand() => <String>['xcrun'];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<XcodeProjectInfo> getInfo(
|
Future<XcodeProjectInfo?> getInfo(
|
||||||
String projectPath, {
|
String projectPath, {
|
||||||
String projectFilename,
|
String? projectFilename,
|
||||||
}) async => projectInfo;
|
}) async => projectInfo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Map<String, String>> getBuildSettings(
|
Future<Map<String, String>> getBuildSettings(
|
||||||
String projectPath, {
|
String projectPath, {
|
||||||
@required XcodeProjectBuildContext buildContext,
|
required XcodeProjectBuildContext buildContext,
|
||||||
Duration timeout = const Duration(minutes: 1),
|
Duration timeout = const Duration(minutes: 1),
|
||||||
}) async => buildSettings;
|
}) async => buildSettings;
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
import 'package:flutter_tools/src/base/bot_detector.dart';
|
import 'package:flutter_tools/src/base/bot_detector.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
@ -26,8 +24,8 @@ const String _kProjectRoot = '/project';
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('FlutterCommandRunner', () {
|
group('FlutterCommandRunner', () {
|
||||||
MemoryFileSystem fileSystem;
|
late MemoryFileSystem fileSystem;
|
||||||
Platform platform;
|
late Platform platform;
|
||||||
|
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
Cache.disableLocking();
|
Cache.disableLocking();
|
||||||
@ -173,7 +171,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('getRepoPackages', () {
|
group('getRepoPackages', () {
|
||||||
String oldFlutterRoot;
|
late String? oldFlutterRoot;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
oldFlutterRoot = Cache.flutterRoot;
|
oldFlutterRoot = Cache.flutterRoot;
|
||||||
@ -270,7 +268,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FakeFlutterCommand extends FlutterCommand {
|
class FakeFlutterCommand extends FlutterCommand {
|
||||||
OutputPreferences preferences;
|
late OutputPreferences preferences;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FlutterCommandResult> runCommand() {
|
Future<FlutterCommandResult> runCommand() {
|
||||||
@ -279,14 +277,14 @@ class FakeFlutterCommand extends FlutterCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get description => null;
|
String get description => '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get name => 'fake';
|
String get name => 'fake';
|
||||||
}
|
}
|
||||||
|
|
||||||
class FakeStdio extends Stdio {
|
class FakeStdio extends Stdio {
|
||||||
FakeStdio({this.hasFakeTerminal});
|
FakeStdio({required this.hasFakeTerminal});
|
||||||
|
|
||||||
final bool hasFakeTerminal;
|
final bool hasFakeTerminal;
|
||||||
|
|
||||||
@ -294,10 +292,10 @@ class FakeStdio extends Stdio {
|
|||||||
bool get hasTerminal => hasFakeTerminal;
|
bool get hasTerminal => hasFakeTerminal;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get terminalColumns => hasFakeTerminal ? 80 : null;
|
int? get terminalColumns => hasFakeTerminal ? 80 : null;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get terminalLines => hasFakeTerminal ? 24 : null;
|
int? get terminalLines => hasFakeTerminal ? 24 : null;
|
||||||
@override
|
@override
|
||||||
bool get supportsAnsiEscapes => hasFakeTerminal;
|
bool get supportsAnsiEscapes => hasFakeTerminal;
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io' as io;
|
import 'dart:io' as io;
|
||||||
|
|
||||||
@ -32,13 +30,13 @@ import 'utils.dart';
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('Flutter Command', () {
|
group('Flutter Command', () {
|
||||||
FakeCache cache;
|
late FakeCache cache;
|
||||||
TestUsage usage;
|
late TestUsage usage;
|
||||||
FakeClock clock;
|
late FakeClock clock;
|
||||||
FakeProcessInfo processInfo;
|
late FakeProcessInfo processInfo;
|
||||||
MemoryFileSystem fileSystem;
|
late MemoryFileSystem fileSystem;
|
||||||
FakeProcessManager processManager;
|
late FakeProcessManager processManager;
|
||||||
PreRunValidator preRunValidator;
|
late PreRunValidator preRunValidator;
|
||||||
|
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
Cache.flutterRoot = '/path/to/sdk/flutter';
|
Cache.flutterRoot = '/path/to/sdk/flutter';
|
||||||
@ -246,7 +244,7 @@ void main() {
|
|||||||
final DummyFlutterCommand flutterCommand = DummyFlutterCommand(
|
final DummyFlutterCommand flutterCommand = DummyFlutterCommand(
|
||||||
commandFunction: () async {
|
commandFunction: () async {
|
||||||
throwToolExit('fail');
|
throwToolExit('fail');
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() => flutterCommand.run(),
|
() => flutterCommand.run(),
|
||||||
@ -324,9 +322,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('signals tests', () {
|
group('signals tests', () {
|
||||||
FakeIoProcessSignal mockSignal;
|
late FakeIoProcessSignal mockSignal;
|
||||||
ProcessSignal signalUnderTest;
|
late ProcessSignal signalUnderTest;
|
||||||
StreamController<io.ProcessSignal> signalController;
|
late StreamController<io.ProcessSignal> signalController;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
mockSignal = FakeIoProcessSignal();
|
mockSignal = FakeIoProcessSignal();
|
||||||
@ -350,7 +348,7 @@ void main() {
|
|||||||
commandFunction: () async {
|
commandFunction: () async {
|
||||||
final Completer<void> c = Completer<void>();
|
final Completer<void> c = Completer<void>();
|
||||||
await c.future;
|
await c.future;
|
||||||
return null; // unreachable
|
throw UnsupportedError('Unreachable');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -398,7 +396,7 @@ void main() {
|
|||||||
checkLockCompleter.complete();
|
checkLockCompleter.complete();
|
||||||
final Completer<void> c = Completer<void>();
|
final Completer<void> c = Completer<void>();
|
||||||
await c.future;
|
await c.future;
|
||||||
return null; // unreachable
|
throw UnsupportedError('Unreachable');
|
||||||
});
|
});
|
||||||
|
|
||||||
unawaited(flutterCommand.run());
|
unawaited(flutterCommand.run());
|
||||||
@ -454,7 +452,7 @@ void main() {
|
|||||||
final FlutterCommandResult commandResult = FlutterCommandResult(
|
final FlutterCommandResult commandResult = FlutterCommandResult(
|
||||||
ExitStatus.success,
|
ExitStatus.success,
|
||||||
// nulls should be cleaned up.
|
// nulls should be cleaned up.
|
||||||
timingLabelParts: <String> ['blah1', 'blah2', null, 'blah3'],
|
timingLabelParts: <String?> ['blah1', 'blah2', null, 'blah3'],
|
||||||
endTimeOverride: DateTime.fromMillisecondsSinceEpoch(1500),
|
endTimeOverride: DateTime.fromMillisecondsSinceEpoch(1500),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -701,7 +699,7 @@ class FakeTargetCommand extends FlutterCommand {
|
|||||||
return FlutterCommandResult.success();
|
return FlutterCommandResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
String cachedTargetFile;
|
String? cachedTargetFile;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get description => '';
|
String get description => '';
|
||||||
@ -759,7 +757,7 @@ class FakeProcessInfo extends Fake implements ProcessInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FakeIoProcessSignal extends Fake implements io.ProcessSignal {
|
class FakeIoProcessSignal extends Fake implements io.ProcessSignal {
|
||||||
Stream<io.ProcessSignal> stream;
|
late Stream<io.ProcessSignal> stream;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<io.ProcessSignal> watch() => stream;
|
Stream<io.ProcessSignal> watch() => stream;
|
||||||
@ -779,8 +777,8 @@ class FakeCache extends Fake implements Cache {
|
|||||||
|
|
||||||
class FakeSignals implements Signals {
|
class FakeSignals implements Signals {
|
||||||
FakeSignals({
|
FakeSignals({
|
||||||
this.subForSigTerm,
|
required this.subForSigTerm,
|
||||||
List<ProcessSignal> exitSignals,
|
required List<ProcessSignal> exitSignals,
|
||||||
}) : delegate = Signals.test(exitSignals: exitSignals);
|
}) : delegate = Signals.test(exitSignals: exitSignals);
|
||||||
|
|
||||||
final ProcessSignal subForSigTerm;
|
final ProcessSignal subForSigTerm;
|
||||||
@ -814,14 +812,12 @@ class FakeClock extends Fake implements SystemClock {
|
|||||||
class FakePub extends Fake implements Pub {
|
class FakePub extends Fake implements Pub {
|
||||||
@override
|
@override
|
||||||
Future<void> get({
|
Future<void> get({
|
||||||
PubContext context,
|
required PubContext context,
|
||||||
FlutterProject project,
|
required FlutterProject project,
|
||||||
bool skipIfAbsent = false,
|
bool skipIfAbsent = false,
|
||||||
bool upgrade = false,
|
bool upgrade = false,
|
||||||
bool offline = false,
|
bool offline = false,
|
||||||
bool generateSyntheticPackage = false,
|
String? flutterRootOverride,
|
||||||
bool generateSyntheticPackageForExample = false,
|
|
||||||
String flutterRootOverride,
|
|
||||||
bool checkUpToDate = false,
|
bool checkUpToDate = false,
|
||||||
bool shouldSkipThirdPartyGenerator = true,
|
bool shouldSkipThirdPartyGenerator = true,
|
||||||
bool printProgress = true,
|
bool printProgress = true,
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
@ -28,7 +26,7 @@ import '../../src/fake_http_client.dart';
|
|||||||
const String kCustomBugInstructions = 'These are instructions to report with a custom bug tracker.';
|
const String kCustomBugInstructions = 'These are instructions to report with a custom bug tracker.';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
int firstExitCode;
|
int? firstExitCode;
|
||||||
|
|
||||||
group('runner', () {
|
group('runner', () {
|
||||||
setUp(() {
|
setUp(() {
|
||||||
@ -59,7 +57,7 @@ void main() {
|
|||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
// runner.run() asynchronously calls the exit function set above, so we
|
// runner.run() asynchronously calls the exit function set above, so we
|
||||||
// catch it in a zone.
|
// catch it in a zone.
|
||||||
unawaited(runZoned<Future<void>>(
|
unawaited(runZoned<Future<void>?>(
|
||||||
() {
|
() {
|
||||||
unawaited(runner.run(
|
unawaited(runner.run(
|
||||||
<String>['crash'],
|
<String>['crash'],
|
||||||
@ -112,7 +110,7 @@ void main() {
|
|||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
// runner.run() asynchronously calls the exit function set above, so we
|
// runner.run() asynchronously calls the exit function set above, so we
|
||||||
// catch it in a zone.
|
// catch it in a zone.
|
||||||
unawaited(runZoned<Future<void>>(
|
unawaited(runZoned<Future<void>?>(
|
||||||
() {
|
() {
|
||||||
unawaited(runner.run(
|
unawaited(runner.run(
|
||||||
<String>['crash'],
|
<String>['crash'],
|
||||||
@ -160,7 +158,7 @@ void main() {
|
|||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
// runner.run() asynchronously calls the exit function set above, so we
|
// runner.run() asynchronously calls the exit function set above, so we
|
||||||
// catch it in a zone.
|
// catch it in a zone.
|
||||||
unawaited(runZoned<Future<void>>(
|
unawaited(runZoned<Future<void>?>(
|
||||||
() {
|
() {
|
||||||
unawaited(runner.run(
|
unawaited(runner.run(
|
||||||
<String>['crash'],
|
<String>['crash'],
|
||||||
@ -197,7 +195,7 @@ void main() {
|
|||||||
expect(logContents, contains('CrashingFlutterCommand.runCommand'));
|
expect(logContents, contains('CrashingFlutterCommand.runCommand'));
|
||||||
expect(logContents, contains('[!] Flutter'));
|
expect(logContents, contains('[!] Flutter'));
|
||||||
|
|
||||||
final CrashDetails sentDetails = (globals.crashReporter as WaitingCrashReporter)._details;
|
final CrashDetails sentDetails = (globals.crashReporter! as WaitingCrashReporter)._details;
|
||||||
expect(sentDetails.command, 'flutter crash');
|
expect(sentDetails.command, 'flutter crash');
|
||||||
expect(sentDetails.error.toString(), 'Exception: an exception % --');
|
expect(sentDetails.error.toString(), 'Exception: an exception % --');
|
||||||
expect(sentDetails.stackTrace.toString(), contains('CrashingFlutterCommand.runCommand'));
|
expect(sentDetails.stackTrace.toString(), contains('CrashingFlutterCommand.runCommand'));
|
||||||
@ -222,15 +220,15 @@ void main() {
|
|||||||
class CrashingFlutterCommand extends FlutterCommand {
|
class CrashingFlutterCommand extends FlutterCommand {
|
||||||
CrashingFlutterCommand({
|
CrashingFlutterCommand({
|
||||||
bool asyncCrash = false,
|
bool asyncCrash = false,
|
||||||
Completer<void> completer,
|
Completer<void>? completer,
|
||||||
}) : _asyncCrash = asyncCrash,
|
}) : _asyncCrash = asyncCrash,
|
||||||
_completer = completer;
|
_completer = completer;
|
||||||
|
|
||||||
final bool _asyncCrash;
|
final bool _asyncCrash;
|
||||||
final Completer<void> _completer;
|
final Completer<void>? _completer;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get description => null;
|
String get description => '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get name => 'crash';
|
String get name => 'crash';
|
||||||
@ -249,7 +247,7 @@ class CrashingFlutterCommand extends FlutterCommand {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await completer.future;
|
await completer.future;
|
||||||
_completer.complete();
|
_completer!.complete();
|
||||||
|
|
||||||
return FlutterCommandResult.success();
|
return FlutterCommandResult.success();
|
||||||
}
|
}
|
||||||
@ -298,16 +296,16 @@ class CrashingUsage implements Usage {
|
|||||||
String get clientId => _impl.clientId;
|
String get clientId => _impl.clientId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void sendCommand(String command, {CustomDimensions parameters}) =>
|
void sendCommand(String command, {CustomDimensions? parameters}) =>
|
||||||
_impl.sendCommand(command, parameters: parameters);
|
_impl.sendCommand(command, parameters: parameters);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void sendEvent(
|
void sendEvent(
|
||||||
String category,
|
String category,
|
||||||
String parameter, {
|
String parameter, {
|
||||||
String label,
|
String? label,
|
||||||
int value,
|
int? value,
|
||||||
CustomDimensions parameters,
|
CustomDimensions? parameters,
|
||||||
}) => _impl.sendEvent(
|
}) => _impl.sendEvent(
|
||||||
category,
|
category,
|
||||||
parameter,
|
parameter,
|
||||||
@ -321,7 +319,7 @@ class CrashingUsage implements Usage {
|
|||||||
String category,
|
String category,
|
||||||
String variableName,
|
String variableName,
|
||||||
Duration duration, {
|
Duration duration, {
|
||||||
String label,
|
String? label,
|
||||||
}) => _impl.sendTiming(category, variableName, duration, label: label);
|
}) => _impl.sendTiming(category, variableName, duration, label: label);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -347,7 +345,7 @@ class WaitingCrashReporter implements CrashReporter {
|
|||||||
WaitingCrashReporter(Future<void> future) : _future = future;
|
WaitingCrashReporter(Future<void> future) : _future = future;
|
||||||
|
|
||||||
final Future<void> _future;
|
final Future<void> _future;
|
||||||
CrashDetails _details;
|
late CrashDetails _details;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> informUser(CrashDetails details, File crashFile) {
|
Future<void> informUser(CrashDetails details, File crashFile) {
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
// @dart = 2.8
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
|
import 'package:flutter_tools/src/application_package.dart';
|
||||||
import 'package:flutter_tools/src/artifacts.dart';
|
import 'package:flutter_tools/src/artifacts.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.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';
|
||||||
@ -15,6 +14,7 @@ import 'package:flutter_tools/src/build_info.dart';
|
|||||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||||
import 'package:flutter_tools/src/device.dart';
|
import 'package:flutter_tools/src/device.dart';
|
||||||
import 'package:flutter_tools/src/tester/flutter_tester.dart';
|
import 'package:flutter_tools/src/tester/flutter_tester.dart';
|
||||||
|
import 'package:test/fake.dart';
|
||||||
|
|
||||||
import '../../src/common.dart';
|
import '../../src/common.dart';
|
||||||
import '../../src/context.dart';
|
import '../../src/context.dart';
|
||||||
@ -23,7 +23,7 @@ import '../../src/fakes.dart';
|
|||||||
import '../../src/test_build_system.dart';
|
import '../../src/test_build_system.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
MemoryFileSystem fileSystem;
|
late MemoryFileSystem fileSystem;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
fileSystem = MemoryFileSystem.test();
|
fileSystem = MemoryFileSystem.test();
|
||||||
@ -74,12 +74,12 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('startApp', () {
|
group('startApp', () {
|
||||||
FlutterTesterDevice device;
|
late FlutterTesterDevice device;
|
||||||
List<String> logLines;
|
late List<String> logLines;
|
||||||
String mainPath;
|
String? mainPath;
|
||||||
|
|
||||||
FakeProcessManager fakeProcessManager;
|
late FakeProcessManager fakeProcessManager;
|
||||||
TestBuildSystem buildSystem;
|
late TestBuildSystem buildSystem;
|
||||||
|
|
||||||
final Map<Type, Generator> startOverrides = <Type, Generator>{
|
final Map<Type, Generator> startOverrides = <Type, Generator>{
|
||||||
Platform: () => FakePlatform(),
|
Platform: () => FakePlatform(),
|
||||||
@ -111,24 +111,24 @@ void main() {
|
|||||||
expect(device.portForwarder, isNot(isNull));
|
expect(device.portForwarder, isNot(isNull));
|
||||||
expect(await device.targetPlatform, TargetPlatform.tester);
|
expect(await device.targetPlatform, TargetPlatform.tester);
|
||||||
|
|
||||||
expect(await device.installApp(null), isTrue);
|
expect(await device.installApp(FakeApplicationPackage()), isTrue);
|
||||||
expect(await device.isAppInstalled(null), isFalse);
|
expect(await device.isAppInstalled(FakeApplicationPackage()), isFalse);
|
||||||
expect(await device.isLatestBuildInstalled(null), isFalse);
|
expect(await device.isLatestBuildInstalled(FakeApplicationPackage()), isFalse);
|
||||||
expect(await device.uninstallApp(null), isTrue);
|
expect(await device.uninstallApp(FakeApplicationPackage()), isTrue);
|
||||||
|
|
||||||
expect(device.isSupported(), isTrue);
|
expect(device.isSupported(), isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('does not accept profile, release, or jit-release builds', () async {
|
testWithoutContext('does not accept profile, release, or jit-release builds', () async {
|
||||||
final LaunchResult releaseResult = await device.startApp(null,
|
final LaunchResult releaseResult = await device.startApp(FakeApplicationPackage(),
|
||||||
mainPath: mainPath,
|
mainPath: mainPath,
|
||||||
debuggingOptions: DebuggingOptions.disabled(BuildInfo.release),
|
debuggingOptions: DebuggingOptions.disabled(BuildInfo.release),
|
||||||
);
|
);
|
||||||
final LaunchResult profileResult = await device.startApp(null,
|
final LaunchResult profileResult = await device.startApp(FakeApplicationPackage(),
|
||||||
mainPath: mainPath,
|
mainPath: mainPath,
|
||||||
debuggingOptions: DebuggingOptions.disabled(BuildInfo.profile),
|
debuggingOptions: DebuggingOptions.disabled(BuildInfo.profile),
|
||||||
);
|
);
|
||||||
final LaunchResult jitReleaseResult = await device.startApp(null,
|
final LaunchResult jitReleaseResult = await device.startApp(FakeApplicationPackage(),
|
||||||
mainPath: mainPath,
|
mainPath: mainPath,
|
||||||
debuggingOptions: DebuggingOptions.disabled(BuildInfo.jitRelease),
|
debuggingOptions: DebuggingOptions.disabled(BuildInfo.jitRelease),
|
||||||
);
|
);
|
||||||
@ -216,3 +216,5 @@ FlutterTesterDevices setUpFlutterTesterDevices() {
|
|||||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class FakeApplicationPackage extends Fake implements ApplicationPackage {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user